I am trying to write a C++ test application which takes a Dicom image file as input and outputs a sample Dicom CAD SR file (with given coordinates of my choice for the points and/or polylines).
I am using mainly Linux OS for building and testing purposes, but the application should ultimately be architecture independent, so portability does count.
My first choice is to use dcmtk libraries (dcmsr) within the code, not to generate the CAD SR from an intermediate xml file (via xml2dsr). Is this choice rational? (in terms of portability, flexibility and power of use) Is there any other clever way to create Dicom CAD SR files under dcmtk I am not aware of?
I tried to find pieces of C++ code matching my purpose, but I found only codes corresponding to generic Dicom SR templates. The attempts of adapting these codes to my intentions have failed, since inserting supplementary lines in the code makes invalid the resulting Dicom SR file (the error I get is "dsr2xml: error (Invalid Document Tree) parsing file: SRF" - I'm using dsr2xml for visualizing contents of the resulting file, SRF). The essential part of the code (obviously inspired from dcmtk mkreport source code) is:
Code: Select all
doc->createNewDocument(DSRTypes::DT_MammographyCadSR);
doc->getStudyInstanceUID(studyUID_01);
doc->setStudyID(studyID);
doc->setStudyDescription("Test Mammography CAD Reporting Template");
doc->setSeriesDescription("My Dicom SR test");
doc->setSeriesNumber(seriesNumber);
doc->setSpecificCharacterSetType(DSRTypes::CS_Latin1);
doc->setPatientID(patientID);
doc->setPatientsName(patientsName);
doc->setPatientsBirthDate(patientsBirthDate);
doc->setPatientsSex(patientsSex);
/////
doc->getTree().addContentItem(DSRTypes::RT_isRoot, DSRTypes::VT_Container);
doc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("111036", "DCM", "Mammography CAD Report"));
doc->getTree().addContentItem(DSRTypes::RT_hasObsContext, DSRTypes::VT_PName, DSRTypes::AM_belowCurrent);
doc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("IHE.04", OFFIS_CODING_SCHEME_DESIGNATOR, "Observer Name"));
doc->getTree().getCurrentContentItem().setStringValue("Test_CAD");
doc->getTree().addContentItem(DSRTypes::RT_hasObsContext, DSRTypes::VT_Text);
doc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("IHE.05", OFFIS_CODING_SCHEME_DESIGNATOR, "Observer Organization Name"));
doc->getTree().getCurrentContentItem().setStringValue("Noname");
doc->getTree().addContentItem(DSRTypes::RT_contains, DSRTypes::VT_Image);
doc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("CODE_27", OFFIS_CODING_SCHEME_DESIGNATOR, "Blabla"));
doc->getTree().getCurrentContentItem().setImageReference(DSRImageReferenceValue(UID_DigitalMammographyXRayImageStorageForProcessing, seriesInstanceUID));
doc->getCurrentRequestedProcedureEvidence().addItem(seriesInstanceUID, seriesInstanceUID, UID_DigitalMammographyXRayImageStorageForProcessing, seriesInstanceUID);
Thank you for your answers.
Z.B.