Giter VIP home page Giter VIP logo

dcm's People

Contributors

bmoloney avatar joshy avatar moloney avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

dcm's Issues

Output for additional elements like e.g. PatientBirthdate, PatientSex, AccessionNumber or StudyDescription

Hi,

is there a way to query for additional elements?

My dream would be that I can have a --level series query with the ability to output additional elements on the following levels:

  • patient level
    • patient birth date
    • patient sex
  • study level
    • study description
    • accession number

Or to have the possibility to query for additional fields per level query. Than I would query for all patients (+birth date, + sex), than the studies (+accession number) and than the series.

Thanks a lot for your time,
Joshy

Getting information on Series is possible?

Hi,

super nice project. I really like the cli and a query like dcm query pacs AccessionNumber=1234 works. Awesome!
In the above query would it be possible to print out some information on the series as well e.g. SeriesNumber, SeriesDescription?

Thanks a lot!

Cheers,
Joshy

Working with DICOM Files

Thanks so much for this package. I'm wondering if there is any support for working directly with DICOM files (i.e. sending to an AE).

Roadmap / release plan?

Hello,

thank you for creating this awesome tool. I feel like it plugs in lots of features that are missing from pynetdicom (perhaps rightfully so because out of scope), like abstractions centered on typical use cases, async operations, etc.

Since I am considering to incorporate the tool in our lab's analysis pipelines, it would help to know the following:

  1. Do you have an estimate on the project's status, whether it will be maintained in the near future?
  2. Are there any plans to release the package on some official channel (pypi, conda)? This would help with keeping track of versions and updates.
  3. Do you have any preferences for how this tool should be cited?

dcm not compatible with Python v3.9.7

Running the example with Python 3.9.7 throws the following error:

TypeError: DcmNode() takes no arguments

However, with version 3.7.11 it works as expected.

Gracefully cancel move

Is it possible to send a c_cancel, e.g., to gracefully interrupt the move of a series?

cnt = 1
async for instance_ds in local.retrieve(
        remote,
        query_res=QueryResult(QueryLevel.SERIES, data_sets=[query_dataset]),
        report=retrieve_report
):
   # process image
   cnt += 1
   if cnt == 15:
      # cancel move

Retrieve request so slow

Why is the retrieve request so slow? @moloney

import asyncio
import time

from dcm._globals import QueryLevel
from dcm.net import DcmNode, LocalEntity
from dcm.node import RemoteNode
from pydicom import Dataset


async def main() -> None:
    local = LocalEntity(DcmNode("localhost", "MY_AE_TITLE", 1111))
    mypacs = RemoteNode("localhost", "CONQUESTSRV1", 5678)

    query = Dataset()
    query.StudyID = "433724515"

    datasets = []

    qr = await local.query(
        mypacs,
        query=query,
        level=QueryLevel.IMAGE
    )

    start_perf_count = time.perf_counter()

    async for ds in local.retrieve(remote=mypacs, query_res=qr):
        datasets.append(ds)

    print(f"Datasets length: {len(datasets)}, perf counter time: {time.perf_counter() - start_perf_count}")


if __name__ == "__main__":
    asyncio.run(main())

Output: Datasets length: 384, perf counter time: 9.486925958000938

import time
from typing import List

from pydicom.dataset import Dataset

from pynetdicom import AE, evt, sop_class, StoragePresentationContexts
from pydicom.uid import ImplicitVRLittleEndian


class DicomClient:

    def __init__(self, hostname, port, ae_title):
        self.port = port
        self.hostname = hostname
        self.ae_title = ae_title

    def fetch(self, datasets: List[Dataset]):
        def handle_store(event):
            dataset = event.dataset
            dataset.file_meta = event.file_meta

            datasets.append(dataset)

            return 0x0000

        handlers = [(evt.EVT_C_STORE, handle_store)]

        ae = AE(ae_title=self.ae_title)

        ae.add_requested_context(
            sop_class._QR_CLASSES["PatientRootQueryRetrieveInformationModelMove"],
            ImplicitVRLittleEndian
        )
        ae.supported_contexts = StoragePresentationContexts

        scp = ae.start_server(("127.0.0.1", 1111), block=False, evt_handlers=handlers)

        ds = Dataset()
        ds.QueryRetrieveLevel = "IMAGE"
        ds.StudyID = "433724515"

        assoc = ae.associate(
            addr=self.hostname,
            port=self.port,
            ae_title=self.ae_title,
            evt_handlers=handlers
        )

        if assoc.is_established:
            responses = assoc.send_c_move(
                ds,
                "MY_AE_TITLE",
                sop_class._QR_CLASSES["PatientRootQueryRetrieveInformationModelMove"]
            )

            """
            for (status, _) in responses:
                if status:
                    pass
                else:
                    print('Connection timed out, was aborted or received invalid response')
            """

            assoc.release()
        else:
            print('Association rejected, aborted or never connected')

        scp.shutdown()


def main():
    client = DicomClient(
        hostname="localhost",
        port=5678,
        ae_title="CONQUESTSRV1"
    )

    datasets = []

    start_perf_count = time.perf_counter()

    client.fetch(datasets=datasets)

    print(f"Datasets length: {len(datasets)}, perf counter time: {time.perf_counter() - start_perf_count}")


if __name__ == "__main__":
    main()

Output: Datasets length: 384, perf counter time: 2.612817499997618

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.