SR INCLUDE statement

All other questions regarding DCMTK

Moderator: Moderator Team

Post Reply
Message
Author
ilariari
Posts: 16
Joined: Fri, 2018-01-12, 12:21

SR INCLUDE statement

#1 Post by ilariari »

Hello,
dealing with CT Radiation Dose SR (http://dicom.nema.org/medical/dicom/cur ... lates.html), I see the INCLUDE statement is required by the standard for example to include "Language of Content Item and Descendants" TID1204.

In fact I cannot obtain the requested structure by using the DSRDocument's APIs; below a snippet of my code (it's pretty the only code combination that get something correct even if not compatible with the standard):

Code: Select all

    DSRDocument *doc = new DSRDocument();
    doc->createNewDocument(DSRTypes::DT_XRayRadiationDoseSR);
    
   // Many calls to ...set methods

    // Report Title
    size_t rootContainerID = doc->getTree().addContentItem(DSRTypes::RT_isRoot, DSRTypes::VT_Container);
    doc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("113701", "DCM", "X-Ray Radiation Dose Report"));
    doc->getTree().getCurrentContentItem().setTemplateIdentification("10011","DCMR");

    // Language
    doc->getTree().addContentItem(DSRTypes::RT_hasConceptMod, DSRTypes::VT_Code, DSRTypes::AM_belowCurrent);
    doc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("121049", "DCM", "Language of Content Item and Descendants"));
    doc->getTree().getCurrentContentItem().setCodeValue(DSRCodedEntryValue("eng","ISO639_2","English"));

    doc->getTree().addContentItem(DSRTypes::RT_hasConceptMod, DSRTypes::VT_Code, DSRTypes::AM_afterCurrent);
    doc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("121046", "DCM", "Country of Language"));
    doc->getTree().getCurrentContentItem().setCodeValue(DSRCodedEntryValue("US","ISO3166_1","UNITED STATES"));
    
    // Other stuff 
    
    doc->completeDocument();

    DcmFileFormat *fileformat = new DcmFileFormat();
    DcmDataset *dataset = nullptr;
    if (fileformat != nullptr)
        dataset = fileformat->getDataset();
    if (dataset != nullptr)
    {
        OFFilename fileName(path.toLatin1().data());
        OFCondition condRes = doc->write(*dataset);
        if (condRes.good())
            fileformat->saveFile(fileName, EXS_LittleEndianExplicit);
    }
    delete fileformat;
    
    
The dsrdump output is shown in the attached picture
[img] file:///Users/ilaria/Pictures/dsrdump.jpg [/img]

I only realized nodes with code as VT and "HAS CONCEPT MOD" as relationship with parent :(
Please, do you have some hint?

Best regards
Ilaria

ilariari
Posts: 16
Joined: Fri, 2018-01-12, 12:21

Re: SR INCLUDE statement

#2 Post by ilariari »

As foreseen the image hasn't been uploaded, here the textual output:

<CONTAINER:(,,"X-Ray Radiation Dose Report")=SEPARATE>
<has concept mod CODE:(,,"Language of Content Item and Descendants")=(eng,ISO639_2,"English")>
<has concept mod CODE:(,,"Country of Language")=(US,ISO3166_1,"UNITED STATES")>

......

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

Re: SR INCLUDE statement

#3 Post by J. Riesmeier »

What exactly is your question? What does not work (as expected)?

By the way, you should always check the return value when calling a method (in this case, all methods return an OFCondition).
And, for many coded entries (e.g. all codes from the "DCM" coding scheme), there are definitions in the "dcmtk/dcmsr/codes" include directory (e.g. CODE_DCM_LanguageOfContentItemAndDescendants in "dcm.h").

Addendum:
I see the INCLUDE statement is required by the standard
Where did you see this? There is a "U" in Row 1b, i.e. the included sub-template is optional.

Code: Select all

    doc->getTree().addContentItem(DSRTypes::RT_hasConceptMod, DSRTypes::VT_Code, DSRTypes::AM_afterCurrent);
    doc->getTree().getCurrentContentItem().setConceptName(DSRCodedEntryValue("121046", "DCM", "Country of Language"));
    doc->getTree().getCurrentContentItem().setCodeValue(DSRCodedEntryValue("US","ISO3166_1","UNITED STATES"));
This content item should be added below the previous content item (i.e. as a child node), not after (as a sibling).

ilariari
Posts: 16
Joined: Fri, 2018-01-12, 12:21

Re: SR INCLUDE statement

#4 Post by ilariari »

Hello,
thank you very much for your reply and the hint to check return values; i'll keep it in mind.

Yes, row 1b it's optional, but it simply wants to be an example: there are many other cases in TID 10011 where it's mandatory to include sub templates.
My question in short is: how can I include a sub template in my SR document tree? I would expect from dump, either textual or visual, to get the evidence of templates nesting.
I'm pretty sure that the SR i produced is not well structured, even if it contains all informations.

I can see there's a "VT_includedTemplate" among E_ValueType, can you suggest me how to use it? All my tries got errors.

ilariari
Posts: 16
Joined: Fri, 2018-01-12, 12:21

Re: SR INCLUDE statement

#5 Post by ilariari »

A clarification: this is my first approach to SR. It's possible that some of my convictions/expectations are false.

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

Re: SR INCLUDE statement

#6 Post by J. Riesmeier »

My question in short is: how can I include a sub template in my SR document tree? I would expect from dump, either textual or visual, to get the evidence of templates nesting.
If you have an implementation of the SR template to be included (e.g. TID1204_LanguageOfContentItemAndDescendants), you could include an instance of this class by calling DSRDocumentSubTree::includeTemplate(). If you don't have the SR template class (and don't want to implement it), you have to expand the content of the associated SR template table as defined in DICOM PS3.16.
I can see there's a "VT_includedTemplate" among E_ValueType, can you suggest me how to use it? All my tries got errors.
This value type is used for internal purposes only (as the documentation says).
A clarification: this is my first approach to SR. It's possible that some of my convictions/expectations are false.
So, welcome to the beautiful world of "DICOM Structured Reporting"! You might want to read this very good book (even though it is a 20 years old): https://www.pixelmed.com/srbook.html

ilariari
Posts: 16
Joined: Fri, 2018-01-12, 12:21

Re: SR INCLUDE statement

#7 Post by ilariari »

So, welcome to the beautiful world of "DICOM Structured Reporting"! You might want to read this very good book (even though it is a 20 years old): https://www.pixelmed.com/srbook.html
Thank you, I've read a lot from Clunie but I missed that book !
...you have to expand the content of the associated SR template table as defined in DICOM PS3.16.
I'm sorry, but this is not clear for me. What kind of expansion shall I realize in order, for example, to build TID 10012 CT Accumulated Dose Data subtree?

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

Re: SR INCLUDE statement

#8 Post by J. Riesmeier »


ilariari
Posts: 16
Joined: Fri, 2018-01-12, 12:21

Re: SR INCLUDE statement

#9 Post by ilariari »

Ok, I got it!
The word INCLUDE in the DICOM standard doesn't correspond to a value type, it's simply a kind of placeholder.
In correspondence of the row marked with INCLUDE I have to nest the content of the TID I want to include by "indenting" it.

Thank you very much for precious help!

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

Re: SR INCLUDE statement

#10 Post by J. Riesmeier »

The word INCLUDE in the DICOM standard doesn't correspond to a value type, it's simply a kind of placeholder.
In correspondence of the row marked with INCLUDE I have to nest the content of the TID I want to include by "indenting" it.
This is almost correct: the nesting of the template's content is defined by the nesting level ("NL" column) given in the "INCLUDE" row, i.e. where the template is included.

ilariari
Posts: 16
Joined: Fri, 2018-01-12, 12:21

Re: SR INCLUDE statement

#11 Post by ilariari »

Thank you for your support!

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest