OFCondition DcmFindSCU::performQuery

All other questions regarding DCMTK

Moderator: Moderator Team

Message
Author
anilta
Posts: 60
Joined: Thu, 2014-04-10, 08:50

OFCondition DcmFindSCU::performQuery

#1 Post by anilta »

I am writing a program to download MWL. Confused, how to use the 15th Parameter, OFList< OFString > *overrideKeys,
in performQuery function?

Need more details please.

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: OFCondition DcmFindSCU::performQuery

#2 Post by J. Riesmeier »

First of all, I would agree that having 18 parameters in total was not a very design decision. Anyway, don't you find the documentation of the "overrideKeys" parameter (#15) sufficiently descriptive:

Code: Select all

   *  @param overrideKeys list of keys/paths that override those in the query files, if any.
   *    Either the list of query files or override keys or both should be non-empty, because the query
   *    dataset will be empty otherwise. For path syntax see DcmPath.
You have to understand that the DcmFindSCU class has been derived from an earlier version of the findscu command line tool (by putting the code into classes). I personally would prefer to write my own C-FIND SCU based on the DcmSCU class (rather than using DcmFindSCU).

anilta
Posts: 60
Joined: Thu, 2014-04-10, 08:50

Re: OFCondition DcmFindSCU::performQuery

#3 Post by anilta »

Thanks Riesmeier.

When i searched in this forum for examples, i see few code like this,

lOverrideKeys.push_back("(0008,0052)=PATIENT");
lOverrideKeys.push_back("0010,0020=PT1004");

From above, i see, "Tag = Search String". Do we have to format our string as per this format and use this as the 15th parameter?
The description is clear, but still a example would give me more helpful.

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: OFCondition DcmFindSCU::performQuery

#4 Post by J. Riesmeier »

OK, now I understand your question. If you need an example on how to use the DcmFindSCU class, the source code of the command line tool is your friend. In the documentation of this tool, there are also examples on how to use the "override keys". The syntax is "<tag>=<value>" or "<attribute-name>=<value>" or "<tag-path>=<value>", where "=<value>" can be omitted in case of universal matching (or specifying a return key for worklist management).

anilta
Posts: 60
Joined: Thu, 2014-04-10, 08:50

Re: OFCondition DcmFindSCU::performQuery

#5 Post by anilta »

Thanks Riesmeier.

Have another question for sequence items.

For example, I need to send Modality and Scheduled Station AE Title as a search key. How to send them?
In the previous version, we were using DcmDataset. We had support to add sequences using DcmElement helper class.

New interface, we need to use a variable of type, OFList<OFString> lOverrideKeys. How to add sequences in lOverrideKeys?

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: OFCondition DcmFindSCU::performQuery

#6 Post by J. Riesmeier »

For elements that are nested in sequence items, there is a special path syntax, which is described in the documentation of the findscu tool (which again refers to the documentation of the dcmodify tool). The API documentation of DcmFindSCU::performQuery() refers to the DcmPath class, which also explains more details on the syntax.
An example would be "ScheduledProcedureStepSequence[0].Modality=CT" or "(0040,0100)[0].Modality=CT".

anilta
Posts: 60
Joined: Thu, 2014-04-10, 08:50

Re: OFCondition DcmFindSCU::performQuery

#7 Post by anilta »

Hi Riesmeier, I need one clarification.

I add the following below in the list, in this way, and use it in performQuery function.
For ScheduledProcedureStepStartDate, i want to download all the studies scheduled from year 2013 till data. All others, i want universal matching. Though i created studies in JDicom server, still i do not get any records.

But, when i remove the entry, ScheduledProcedureStepSequence, then i get all the records ignoring, ScheduledProcedureStepStartDate key. That is, if i search from start date as , "201533", i get all the records from JDicom, though it doesnt have any records in JDicom matching this. What's wrong here?

OFList<OFString>& lOverrideKeys;
lOverrideKeys.push_back("(0008, 0050)"); // AccessionNumber
lOverrideKeys.push_back("(0010, 0010)"); // PatientName
lOverrideKeys.push_back("(0010, 0020)"); // PatientID
lOverrideKeys.push_back("(0010, 0030)"); // PatientBirthDate
lOverrideKeys.push_back("(0010, 0040)"); // PatientSex
lOverrideKeys.push_back("(0010, 1030)"); // PatientWeight
lOverrideKeys.push_back("(0010, 2000)"); // MedicalAlerts
lOverrideKeys.push_back("(0020, 000D)"); // StudyInstanceUID
lOverrideKeys.push_back("(0032, 1032)"); // RequestingPhysician
lOverrideKeys.push_back("(0032, 1060)"); // RequestedProcedureDescription
lOverrideKeys.push_back("(0040, 1001)"); // RequestedProcedureID
lOverrideKeys.push_back("(0040, 1003)"); // RequestedProcedurePriority
lOverrideKeys.push_back("(0038, 0300)"); // CurrentPatientLocation
lOverrideKeys.push_back("(0040, 0100)=1"); // ScheduledProcedureStepSequence
lOverrideKeys.push_back("(0040, 0100)[0].0008, 0060"); // Modality
lOverrideKeys.push_back("(0040, 0100)[0].0040, 0001"); // ScheduledStationAETitle
lOverrideKeys.push_back("(0040, 0100)[0].0040, 0002=201333-"); // ScheduledProcedureStepStartDate
lOverrideKeys.push_back("(0040, 0100)[0].0040, 0003"); // ScheduledProcedureStepStartTime
lOverrideKeys.push_back("(0040, 0100)[0].0040, 0006"); // ScheduledPerformingPhysiciansName
lOverrideKeys.push_back("(0040, 0100)[0].0040, 0007"); // ScheduledProcedureStepDescription
lOverrideKeys.push_back("(0040, 0100)[0].0040, 0009"); // ScheduledProcedureStepID
lOverrideKeys.push_back("(0040, 0100)[0].0040, 0010"); // ScheduledStationName
lOverrideKeys.push_back("(0040, 0100)[0].0040, 0011"); // ScheduledProcedureStepLocation
lOverrideKeys.push_back("(0040, 0100)[0].0040, 0012"); // PreMedication

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: OFCondition DcmFindSCU::performQuery

#8 Post by J. Riesmeier »

The line with "(0040, 0100)=1" (ScheduledProcedureStepSequence) makes no sense. The value of a sequence is its content (i.e. the list of items). Please remove this line from your code.
Then, "201333" is not a valid DICOM date value. As you can see from the definition (DICOM part 5), the format is "YYYYMMDD" (fixed length).

Finally, I would recommend that you use round brackets around all numeric tag values and that you avoid spaces after the comma. This make reading your code much easier (IMHO). Of course, you can also use the attribute names (official keywords like "ScheduledProcedureStepStartDate").

anilta
Posts: 60
Joined: Thu, 2014-04-10, 08:50

Re: OFCondition DcmFindSCU::performQuery

#9 Post by anilta »

Thanks Riesmeier.

Worked with your suggestion. The issue was a wrong date format which i was sending.
Also, for using standard tag names, like, ScheduledProcedureStepStartDate, which header, .h file need to be included?
I searched, but the definition is in, dcdictzz.cc.

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: OFCondition DcmFindSCU::performQuery

#10 Post by J. Riesmeier »

The DcmTagKey constants like DCM_ScheduledProcedureStepStartDate are defined in the header file "dcmtk/dcmdata/dcdeftag.h".
It might be a good idea to just include "dcmtk/dcmdata/dctk.h", which references the most important header files from "dcmdata".

However, in your case you do not need these header files, because the "override keys" are stored as a string. So just use the official keyword from part 6 of the DICOM standard, which is also used for generating the names of the above mentioned DcmTagKey constants. That means, just use "ScheduledProcedureStepSequence[0].ScheduledProcedureStepStartDate=20150303-" if you prefer the attribute names (as I do).

anilta
Posts: 60
Joined: Thu, 2014-04-10, 08:50

Re: OFCondition DcmFindSCU::performQuery

#11 Post by anilta »

Hi Riesmeier,

Another question related to callback method which we use in performQuery.
We are using DcmFindSCUDefaultCallback::callback.

As part of the callback, we will know only the "current response number".

Can we get the number of responses which we will get? So that i can wait until we get all the responses and send these data to the client.

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: OFCondition DcmFindSCU::performQuery

#12 Post by J. Riesmeier »

Can we get the number of responses which we will get? So that i can wait until we get all the responses and send these data to the client.
Without looking into the source code, I would say "no" because the number of responses is unknown until the final C-FIND response message. This is due to the concept of the DICOM C-FIND protocol (see standard part 4 for details).

anilta
Posts: 60
Joined: Thu, 2014-04-10, 08:50

Re: OFCondition DcmFindSCU::performQuery

#13 Post by anilta »

Hi Riesmeier,

Got it !!. We will not know during the start.

But, does the final C-Find message has any additional information which we can query and find that it is the final reply to the callback?

J. Riesmeier
DCMTK Developer
Posts: 2501
Joined: Tue, 2011-05-03, 14:38
Location: Oldenburg, Germany
Contact:

Re: OFCondition DcmFindSCU::performQuery

#14 Post by J. Riesmeier »

Please read the DICOM standard! The final C-FIND response message has a Status of SUCCESS, while all other response messages have a Status of PENDING (if no error or warning is reported).

anilta
Posts: 60
Joined: Thu, 2014-04-10, 08:50

Re: OFCondition DcmFindSCU::performQuery

#15 Post by anilta »

Thanks Riesmeier.

I plan to use this status to find the end C-Find message. So, i have code like this,

WorklistCallback is derived from DcmFindSCUCallback.

void WorklistCallback::callback(
T_DIMSE_C_FindRQ *request,
int responseCount,
T_DIMSE_C_FindRSP *rsp,
DcmDataset *responseIdentifiers)
{
/* dump response number */
printf("MWL: Response Count:: %d", responseCount);

if(rsp->DimseStatus == STATUS_Success)
printf("SUCCESS");

if(rsp->DimseStatus == STATUS_Pending)
printf("PENDING");

................
}

I will get 4 responses. But all the 4 gives me 'PENDING'. No 'SUCCESS' for the last response.
Some thing wrong in this code?

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Google [Bot] and 1 guest