Query/retrieve study root information model

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
w.bahadoer
Posts: 27
Joined: Mon, 2020-01-20, 11:36

Query/retrieve study root information model

#1 Post by w.bahadoer »

Hi,

I have a C++/ dcmtk application that uploads a DICOM data to an Orthanc server and another application that tries to retrieve that data and visualizes it. So far the upload part works because I can see my data uploaded in Orthanc via any browser, I can also view the png that is uploaded in the Orthanc/Osimis Web viewer. The other application can retrieve the data from the Orthanc but I don't understand why I have to do a "putAndInsertString" in the query object in order to get the value of for example DCM_Laterality. Why can't I just use "findAndGetOFString" for the values that I want'? Below is a MRE code that works but I don't exactly understand why the "putAndInsertString" for DCM_Laterality is needed.

Edit: Is there an easy way to get all the attributes that are in the study ? and how do I get a uint16_t or uint8_t* pixel data value?

Code: Select all

bool DICOM::getLastExam( DcmSCU* DicomSCU )
{
    T_ASC_PresentationContextID cxID = DicomSCU->findPresentationContextID(UID_FINDStudyRootQueryRetrieveInformationModel, "");


    DcmDataset findParams;
    findParams.putAndInsertString( DCM_QueryRetrieveLevel, "STUDY");
    findParams.putAndInsertString( DCM_PatientName, "DOE^JOHN" );
    findParams.putAndInsertString( DCM_PatientID, "XYZ123" );
    findParams.putAndInsertString( DCM_PatientBirthDate, "19990101" );
    findParams.putAndInsertString( DCM_StudyDate, "" );
    findParams.putAndInsertString( DCM_StudyTime, "" );

    findParams.putAndInsertString( DCM_Laterality, "" );

    OFList<QRResponse*> responses;

    if( !DicomSCU->sendFINDRequest(cxID, &findParams, &responses).good())
        return false;

    DicomSCU->closeAssociation(DCMSCU_RELEASE_ASSOCIATION);

    if( responses.size() < 2 )
        return true;

    OFCondition cond;
    std::string lastDate("");
    std::shared_ptr< DcmDataset > lastDataSet;

    for( QRResponse* rsp : responses )
    {
        DcmDataset* dset = rsp->m_dataset;

        if (dset != NULL)
        {
            OFString studyDate("");
            OFString studyTime("");

            cond = dset->findAndGetOFString( DCM_StudyDate, studyDate );
            cond = dset->findAndGetOFString( DCM_StudyTime, studyTime );

            std::string date1( studyDate + studyTime );

            if( date1 >= lastDate )
            {
                lastDate = date1;
                lastDataSet.reset( rsp->m_dataset );
            }
        }
    }

    if( !lastDataSet->loadAllDataIntoMemory().good())
        return false;

    OFString eye;

    cond = lastDataSet->findAndGetOFString( DCM_Laterality, eye );

    return cond.good();
}

Michael Onken
DCMTK Developer
Posts: 2048
Joined: Fri, 2004-11-05, 13:47
Location: Oldenburg, Germany
Contact:

Re: Query/retrieve study root information model

#2 Post by Michael Onken »

Hi,

the query is send to the server, who then evaluates it and returns the responses that match your query. In order to tell the server what kind of information you actually search for, you have to fill the query with the DICOM attributes you are interested in (e.g. DCM_Laterality). The server will only provide information on those attributes that are in the query, nothing more.

Also, there are only a few attributes that are required to be supported by the server by the standard. Pixel data is not required, and I suspect that Orthanc supports it as an optional key.

The Query service is only for finding patients, studies, series and images that live on the PACS. If you want to download full objects (including pixel data) the Retrieve service is what you are looking for (which uses C-MOVE or C-GET as well as C-STORE, instead of the query's C-FIND). Retrieve is usually executed after you found what you are looking for using the Query service.

In terms of DCMTK tools, findscu can do the Query part (i.e. what you also do with your code), and movescu and getscu perform the Retrieve part.

The DCMTK documentation also has a code example showing query and retrieve (here: C-MOVE).

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest