Query patient images

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
Mrio
Posts: 5
Joined: Wed, 2006-01-11, 17:16

Query patient images

#1 Post by Mrio »

Hi everyone,

I have been building a website lately in PHP. In the site i use a page where you can get images of a certaint patient. Well i have been playing around with findscu and its working. The only problem i am still stuck at is making a query.

The query needs to be like:

Send patient id (ex. 12345)
then i need to get his images/series, etc.

I have made a query like:
# query patient names and IDs
(0008,0052) CS [PATIENT] # QueryRetrieveLevel
(0010,0010) PN [] # PatientsName
(0010,0020) LO [12345] # PatientID
(0008,0060) CS [] #modality
(0008,1030) LO [] #study description
(0008,103e) LO [] #series description
(0008,0020) DA [] # study date

I am getting an answer, but only 1, while this patient has 3 series and around 400 images each.

Thank you in advance.

ps...YAY!!!! My first post :)

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1493
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#2 Post by Marco Eichelberg »

If you have a patient ID and want to know a list of series or images, you have to use more than one query (unless the archive supports "relational query" which is an option that not all archives support). You first have to query a list of studies for the patient and then, for each study, query for a list of series within that study, and then, for each series, query for a list of images within that series within a study. This is how the hierarchical query model works.

Mrio
Posts: 5
Joined: Wed, 2006-01-11, 17:16

#3 Post by Mrio »

ah yes,

like a while loop.

I was searching the the forum for this problem and i stumpled upon Thomas Wilkens post wich can be found at viewtopic.php?p=339#339

My quess is that it has to be in that same model. Unfortunatly i have been trying anything i could posibly imagine to get the results for the past 2 weeks, without succes.

Its actually a simpe query i need to send: patientID and then get Series and ImagesID.

Please help.

ps. Thanks for replying Mr. Eichelberg

Marco Eichelberg
OFFIS DICOM Team
OFFIS DICOM Team
Posts: 1493
Joined: Tue, 2004-11-02, 17:22
Location: Oldenburg, Germany
Contact:

#4 Post by Marco Eichelberg »

The first query could simply look like this:

Code: Select all

(0008,0052) CS [STUDY]       # QueryRetrieveLevel
(0010,0020) LO [12345]       # PatientID
(0020,000D) UI []            # StudyInstanceUID
Let's assume that one of the results is a study with the StudyInstanceUID 1.2.3.4.5.6 - the next query, asking for the series within the study, would look like this:

Code: Select all

(0008,0052) CS [SERIES]      # QueryRetrieveLevel
(0010,0020) LO [12345]       # PatientID 
(0020,000D) UI [1.2.3.4.5.6] # StudyInstanceUID
(0020,000e) UI []            # SeriesInstanceUID
Again, let's assume that one of the results is a series with the SeriesInstanceUID 8.7.6.5.4 - the next query, asking for the images within that series would looke like this:

Code: Select all

(0008,0052) CS [IMAGE]       # QueryRetrieveLevel
(0010,0020) LO [12345]       # PatientID 
(0020,000D) UI [1.2.3.4.5.6] # StudyInstanceUID
(0020,000e) UI [8.7.6.5.4]   # SeriesInstanceUID
(0008,0018) UI []            # SOPInstanceUID
(0020,000D) UI []            # StudyInstanceUID
Of course you might add further query keys for the information you are interested in, and in order to automate the whole process, you would need some kind of script or program that evaluates the query responses, extracts the UIDs and creates the next query based on the response. But the principle should be clear and you can do the whole thing manually once to try it out.

Mrio
Posts: 5
Joined: Wed, 2006-01-11, 17:16

#5 Post by Mrio »

Ahh yes, I get it.

But I thought you could do all this in 1 query. So my guess is that dicom doesn't support this kind of query that gets the images from the series of a certaint patient all in once.

Anyway, thanks for explaining it to me. I'm going to try and make a script for it.

Mrio
Posts: 5
Joined: Wed, 2006-01-11, 17:16

#6 Post by Mrio »

Hi, i have run into a problem on the second query.
(0008,0052) CS [SERIES] # QueryRetrieveLevel
(0010,0020) LO [12345] # PatientID
(0020,000D) UI [1.2.3.4.5.6] # StudyInstanceUID
(0020,000e) UI [] # SeriesInstanceUID
The problem is that i don't get any SeriesInstanceUID. I found out the when i run the QueryRetrieveLevel in PATIENT or STUDY, i get a response (1 at the moment). Both SeriesInstanceUID from PATIENT and STUDY QueryRetrieveLevel are the same.

My error:
C-Find RSP: MsgID: 1 [Status=Failed: UnableToProcess]
AffectedSOPClassUID: =FINDPatientStudyOnlyQueryRetrieveInformationModel
Data Set: Not Present
Releasing Association


Uhm :roll: ..help? :?:

Markus Sabin
Posts: 99
Joined: Tue, 2005-07-12, 13:50
Location: Erlangen, Germany

#7 Post by Markus Sabin »

Referring to DICOM, Part 4
C.3.3 Patient/Study Only Query/Retrieve Information Model
The Patient/Study Only Query/Retrieve Information Model is identical to the Patient Root except
the series and composite object instance levels are not supported.

Note: Even though this model does not include the composite object instance level, composite object
instances may be retrieved at the patient and study level (i.e., retrieve all composite object
instances for a Patient or Study).
In other words: The "FINDPatientStudyOnlyQueryRetrieveInformationModel" does not support Series- or Instance-Level attributes in the query. I suggest you try to send the query in PatientRoot or StudyRoot information model.

HTH

Markus

Mrio
Posts: 5
Joined: Wed, 2006-01-11, 17:16

#8 Post by Mrio »

HI,

Can you post me an example? Actually much better would be the complete query. Sorry i am completely new to DICOM. I have been working here at the hospital for a month now (for school, called business experience) and i was assigned to do a project. My project was building a website where patients can ask their images. The website is done with PHP and MySQL and it is completely functional (getting image from patient is done with MySQL as a replacement for DICOM, for testing).

So now i need the real deal 8).

I already made a dicom class. But i need the query that retrieves all series and images by just sending the patiendID.

Such a simple question, but so hard to find the answer.

Thanks in advance

Markus Sabin
Posts: 99
Joined: Tue, 2005-07-12, 13:50
Location: Erlangen, Germany

#9 Post by Markus Sabin »

Hi,

as Marco stated above, you have to query down from the patient to the instance (image-) level. However, there is a good chance that your DICOM archive will accept and answer a query correctly that contains all the attributes in one dataset, e.g.

(0008,0052) CS [IMAGE] # QueryRetrieveLevel
(0010,0020) LO [12345] # PatientID
(0020,000D) UI [] # StudyInstanceUID
(0020,000e) UI [] # SeriesInstanceUID
(0008,0018) UI [] # SOPInstanceUID

Mind, that this does not conform to the DICOM standard!

But you have to pass the parameter "-P" or "-S" to the findscu or at least omit "-O"

HTH

Markus

Post Reply

Who is online

Users browsing this forum: Google [Bot] and 0 guests