pynetdicom qyuery/retrive using study date and time

2.2k Views Asked by At

I'm trying the query/retrieve example (qrscu.py) from pynetdicom but it is working good with the patient name when we search. But I need to search the study on the basis of studyDate and studyTime.

Note: here some SOP's for DICOM, are available. So I try to use StudyRootFindSOPClass

I tried to use the :

print "DICOM FindSCU ... ",
d = Dataset()
d.StudyDate = args.searchstring
d.QueryRetrieveLevel = "STUDY"
d.StudyID = "*"
study = [x[1] for x in assoc.StudyRootFindSOPClass.SCU(d, 1)][:-1]
print 'done with status "%s"' % st
print "\n\n\n Cont...", study

But it gives the error

Request association
Association response received
DICOM Echo ...  done with status "Success "
DICOM FindSCU ... 
Traceback (most recent call last):
  File "studyqrscu.py", line 104, in <module>
    study = [x[1] for x in assoc.StudyRootFindSOPClass.SCU(d, 1)][:-1]
  File "/usr/local/lib/python2.7/dist-packages/pynetdicom-0.8.1-py2.7.egg/netdicom/applicationentity.py", line 90, in __getattr__
    raise Exception("SOP Class %s not supported as SCU" % attr)
Exception: SOP Class StudyRootFindSOPClass not supported as SCU

Please help me to fetch the study using the study date and time.

1

There are 1 best solutions below

1
On

I am not very familiar with python nor with the particular DICOM toolkit you are using. I dare to answer because the exception appears to be pretty clear - the toolkit does not seem to support the Study Root Query Information model.

DICOM queries come in four flavours which are called information models:

  • Modality Worklist (that's a different story)
  • Patient Root
  • Study Root
  • Patient Study Only (not very popular in commercial products, has been retired)

Source: DICOM PS3.4

As the name tells, Patient- and Study Root differ in terms of what is the root element from which you start to search down the hierarchy (Patient -> Study -> Series -> Image) in subsequent queries. Patient Root starts on the patient level, so you first search for criteria on the patient level and have patient level results. With the patient ID obtained from the results you go down to the study level to query for studies of the particular patient.

Study Root treats the patient level attributes as secondary study attributes, i.e. you are asking for studies and you receive the attributes of the patient each study belongs to for each study (meaning that you may receive the same patient twice for different studies which makes the difference to Patient Root).

I agree that a study root is what you want to have for your use case, but unfortunately the toolkit you are using apparently only supports Patient Root. According to the error message it's a problem on the client (SCU) side, so dcm4chee is not to blame.

How to solve this?

You might find a different toolkit supporting StudyRoot. Actually to me the absence of Study Root support puts the fitness for practical usage in question to me.

You might want to go the dirty way and try to form a non DICOM conformant query in Patient Root looking like this:

 - Q/R-Level = "STUDY"
 - Patient-ID = "*" or empty
 - Study Date = <your date range>

There is a fair chance that this is going to work, however, keep in mind, it is not DICOM conformant, so it depends on the SCP implementation and may vary between different products.

For the sake of completeness: You may put a query on patient level and for each patient received put a subsequent query on study level giving the patient-ID and your study date range as matching criteria. Not worth mentioning that this is going to fail for performance issues but it would be the DICOM conformance way to solve the issue.