question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to read incoming dataset from c-find?

See original GitHub issue

Hello again! One final piece of the application I’m writing is to perform a c-find to query for patient info, study info and to get all series under a patient/study. I was wondering in the handle_find handler, on how to read the incoming data set? When I do a

def handle_find(event):
  ds = event.identifier
  print (ds)
  print ('hello world')
  return

Nothing regarding this dataset is printed to the screen. Here is the set up code:

handlers = [(evt.EVT_C_FIND, handle_find)]

ae = AE()
ae.ae_title = pacsLocalAETitle
ae.add_supported_context(PatientRootQueryRetrieveInformationModelFind)
scp = ae.start_server(('', int(pacsLocalPort)), block=False, evt_handlers=handlers)

ae.ae_title = pacsLocalAETitle
ae.add_requested_context(PatientRootQueryRetrieveInformationModelFind)
assoc = ae.associate(pacsServerHost, int(pacsServerPort), ae_title=pacsServerAETitle)

if assoc.is_established:
    ds = Dataset()
    ds.QueryRetrieveLevel = 'PATIENT'
    ds.PatientID = patientIDResponse
    response = assoc.send_c_find(ds, PatientRootQueryRetrieveInformationModelFind)

    for (status, identifier) in response:
        pass

    assoc.release()

Attached is the output log file received. I simply would like to view fields such as name, sex, birthdate, etc… I would also like to view a study level response and a series level response too (separate calls, but next things to do after this). Thanks!

log.txt

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
scaramallioncommented, Jan 16, 2020

I think you just want a Find SCU, in which case the responses to your query are in the response generator as (status, identifier). You don’t need the Find SCP, this should be sufficient:

ae = AE()
ae.ae_title = pacsLocalAETitle
ae.add_requested_context(PatientRootQueryRetrieveInformationModelFind)
assoc = ae.associate(pacsServerHost, int(pacsServerPort), ae_title=pacsServerAETitle)
if assoc.is_established:
    ds = Dataset()
    ds.QueryRetrieveLevel = 'PATIENT'
    ds.PatientID = patientIDResponse
    response = assoc.send_c_find(ds, PatientRootQueryRetrieveInformationModelFind)

    for (status, identifier) in response:
        # If `Pending` status, print response
        if status and status.Status in [0xff00, 0xff01]:
            print(identifier)

    assoc.release()

The evt.EVT_C_FIND handler is only required when you’re acting as a Find SCP (i.e. people are sending you queries).

0reactions
DangerIsGocommented, Jan 29, 2020

@scaramallion Yes, sorry. Thank you for your help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Query/Retrieve (Find) Service Examples - Pydicom |
This is accomplished through the DIMSE C-FIND service. ... from pydicom.dataset import Dataset from pynetdicom import AE, debug_logger from ...
Read more >
pynetdicom2 Documentation
store_in_file – indicates if incoming datasets for these SOP Classes ... ds – dataset that is passed to the remote AE with C-FIND...
Read more >
C-FIND ERROR
I am using the same database the last 5 years. Search today studies from Radiant viewer fails. I1012 19:21:42.911968 main.cpp:353] Incoming Find request ......
Read more >
fo-dicom/fo-dicom - Gitter
Run Store SCP, which will listen for the incoming DICOM transfers. ... cFind object in method GetAllItemsFromWorklistAsync has a DicomDataset. if you want ......
Read more >
CFindSCU (Trispark Java Dicom Toolkit 2.70)
An optional response handler can be specified that is invoked per incoming C-FIND response. Parameters: identifier - DicomObject the dataset against which ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found