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();
}