Creating MammographyCADSR file

All other questions regarding DCMTK

Moderator: Moderator Team

Message
Author
Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#31 Post by Jörg Riesmeier »

The exact definition of the different Graphic Types (like CIRCLE, ELLIPSE, etc.) can be found in part 3 of the DICOM standard (see section C.18.6.1.2).

zappy1
Posts: 28
Joined: Fri, 2008-06-27, 11:27

#32 Post by zappy1 »

Hello again to all! I hope you enjoyed nice summer holidays, now back to work...
Jörg Riesmeier wrote:The exact definition of the different Graphic Types (like CIRCLE, ELLIPSE, etc.) can be found in part 3 of the DICOM standard (see section C.18.6.1.2).
This is the implicit answer to my first (and essentialy easy) question, "is my guess (about the meaning of inserted coordinates) right?!" Since the guess was "[...] the first integer couple gives the center, while the second is a point pertaining to the circle" and the DICOM standard reads "a circle defined by two (column,row) pairs. The first point is the central pixel. The second point is a pixel on the perimeter of the circle.", I think the answer was affirmative.

Unfortunately, this doesn't answer the second question: "is this rendering a GUI related issue or I am still wrong with something in the SR?". Since my guess was correct, my file should have been still fully DICOM SR compliant.

Anyway, this is a secondary issue at this moment. Right now, I am testing another DICOM visualization software (Alma3D) and the CAD SR test files are not displayed at all. There is also an error message saying something about "Invalid Study Date/Time" (very comprehensible since I didn't wrote in the CAD SR file that information). While geting these two parameters from the DICOM image file is a piece of cake (see the previously provided code:

Code: Select all

fform[dix].getDataset()->findAndGetOFString(DCM_PatientsSex,patientsSex); 
       fform[dix].getDataset()->findAndGetOFString(DCM_StudyDate,studyDate); /// not used! 
       fform[dix].getDataset()->findAndGetOFString(DCM_StudyTime,studyTime); /// not used! 
      
), their set in the generated DSR file is far from being obvious. If the DSRDocument method setStudyID() [corresponding to getStudyInstanceUID ()] works fine, there is no method corresponding to getStudyDate() or getStudyTime(). So, my top-level question is: how to set correctly Study Date & Time in a DSR file? I tried

Code: Select all

   doc->setContentDate(studyDate);
    doc->setContentTime(studyTime);
just after setting the StudyID, but these lines put the informations in a different node of the tree.

Thank you for your help.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#33 Post by Jörg Riesmeier »

StudyDate and StudyTime are type 2 elements, i. e. they have to be present in the dataset but their value might be empty. Therefore, the API only provides "get" but no "set" methods. Please keep in mind that the module "dcmsr" was originally developed to add SR support to DICOMscope and that there was no need for these attributes for this purpose.

Solution: You could either add the missing "set" methods to the class or you could add these two data elements directly to the dataset that is written by the DSRDocument::write() method.

zappy1
Posts: 28
Joined: Fri, 2008-06-27, 11:27

#34 Post by zappy1 »

Jörg Riesmeier wrote:StudyDate and StudyTime are type 2 elements, i. e. they have to be present in the dataset but their value might be empty. Therefore, the API only provides "get" but no "set" methods. Please keep in mind that the module "dcmsr" was originally developed to add SR support to DICOMscope and that there was no need for these attributes for this purpose.
After various tests, it turned out that StudyDate and StudyTime are not the relevant missing tags, but the StudyInstanceUID which is of course obtainable with getStudyInstanceUID(). The same question remains: how to set it in the DSR file (since there is no setStudyInstanceID()). I have a nasty feeling that there is a same...
Solution: You could either add the missing "set" methods to the class or you could add these two data elements directly to the dataset that is written by the DSRDocument::write() method.
... for this issue. I would prefer not to touch any part of dcmtk package by adding methods to the class, but to insert the StudyInstanceUID with a DSRDocument::write(...). Inspired from tried to insert a code line

Code: Select all

doc->write(*fform[0].getDataset());
but this doesn't change too much to the final result; should I create a stack of DcmObjects to be written in the DSR file as second argument of the write() method? Is there any sample code for this procedure? Or there is another simpler way to do it?

zappy1
Posts: 28
Joined: Fri, 2008-06-27, 11:27

#35 Post by zappy1 »

zappy1 wrote: [ I would prefer not to touch any part of dcmtk package by adding methods to the class, but to insert the StudyInstanceUID with a DSRDocument::write(...). [...] Or there is another simpler way to do it?
Actually, there is a simpler way: it's enough to add a single line in the code, after the creation of the document...

Code: Select all

doc->createNewDocument(DSRTypes::DT_MammographyCadSR);
doc->createNewSeriesInStudy(studyInstanceUID);
I hope this will be useful also for other interested people.

Jörg Riesmeier
ICSMED DICOM Services
ICSMED DICOM Services
Posts: 2217
Joined: Fri, 2004-10-29, 21:38
Location: Oldenburg, Germany

#36 Post by Jörg Riesmeier »

If you want to create a new series for your SR document which is part of an existing study, why don't you use DSRDocument::createNewSeriesInStudy()? See mkreport.cc for details on how to use it.

Ok, I saw your posting only after I pressed the "submit" button :-)

zappy1
Posts: 28
Joined: Fri, 2008-06-27, 11:27

#37 Post by zappy1 »

zappy1 wrote:
Jörg Riesmeier wrote:StudyDate and StudyTime are type 2 elements, i. e. they have to be present in the dataset but their value might be empty. Therefore, the API only provides "get" but no "set" methods.
After various tests, it turned out that StudyDate and StudyTime are not the relevant missing tags, but the StudyInstanceUID which is of course obtainable with getStudyInstanceUID(). The same question remains: how to set it in the DSR file (since there is no setStudyInstanceID()). I have a nasty feeling that there is a same...
Solution: You could either add the missing "set" methods to the class or you could add these two data elements directly to the dataset that is written by the DSRDocument::write() method.
[...] should I create a stack of DcmObjects to be written in the DSR file as second argument of the write() method? Is there any sample code for this procedure? Or there is another simpler way to do it?
For what's worth: the StudyDate and StudyTime can be inserted through the following code lines:

Code: Select all

// the output SR file definition
DcmFileFormat *newfileformat = new DcmFileFormat(); 
OFCondition status = doc->write(*newfileformat->getDataset());
// inserting studyDate & studyTime previously defined
DSRTypes::putStringValueToDataset(*newfileformat->getDataset(),DCM_StudyDate,studyDate,OFFalse);
DSRTypes::putStringValueToDataset(*newfileformat->getDataset(),DCM_StudyTime,studyTime,OFFalse);
// followed by saving the whole
newfileformat->saveFile(outfile, EXS_LittleEndianExplicit);
It might interest someone.

Regards,
Z.B.

Post Reply

Who is online

Users browsing this forum: Baidu [Spider], Majestic-12 [Bot] and 1 guest