how to: a sequence inside a sequence, RDSR

340 views
Skip to first unread message

harald...@gmx.net

unread,
Oct 25, 2016, 1:33:40 PM10/25/16
to Fellow Oak DICOM
Hi folks,

i am pretty new to FO DICOM but unfortunately not to the DICOM subject itself. Am currently evaluating this cool framework. As a sample project for the eval, i am trying to create a RDSR. So far, i have found what i was looking for. But now i am really strugling. What i want to achive is to have a sequence inside a sequence in one item. Best seen with a dump of RDSR coming from GE, just a part of it:
(0040,a730) SQ (Sequence with explicit length #=12)     # 12228, 1 ContentSequence
  (fffe,e000) na (Item with explicit length #=5)          # 400, 1 Item
    (0040,a010) CS [HAS CONCEPT MOD]                        #  16, 1 RelationshipType
    (0040,a040) CS [CODE]                                   #   4, 1 ValueType
    (0040,a043) SQ (Sequence with explicit length #=1)      #  60, 1 ConceptNameCodeSequence
      (fffe,e000) na (Item with explicit length #=3)          #  52, 1 Item
        (0008,0100) SH [121058]                                 #   6, 1 CodeValue
        (0008,0102) SH [DCM]                                    #   4, 1 CodingSchemeDesignator
        (0008,0104) LO [Procedure reported]                     #  18, 1 CodeMeaning
      (fffe,e00d) na (ItemDelimitationItem for re-encoding)   #   0, 0 ItemDelimitationItem
    (fffe,e0dd) na (SequenceDelimitationItem for re-encod.) #   0, 0 SequenceDelimitationItem
    (0040,a168) SQ (Sequence with explicit length #=1)      #  58, 1 ConceptCodeSequence
      (fffe,e000) na (Item with explicit length #=3)          #  50, 1 Item
        (0008,0100) SH [113704]                                 #   6, 1 CodeValue
        (0008,0102) SH [DCM]                                    #   4, 1 CodingSchemeDesignator
        (0008,0104) LO [Projection X-Ray]                       #  16, 1 CodeMeaning
      (fffe,e00d) na (ItemDelimitationItem for re-encoding)   #   0, 0 ItemDelimitationItem
    (fffe,e0dd) na (SequenceDelimitationItem for re-encod.) #   0, 0 SequenceDelimitationItem

    (0040,a730) SQ (Sequence with explicit length #=1)      # 210, 1 ContentSequence
      (fffe,e000) na (Item with explicit length #=4)          # 202, 1 Item
        (0040,a010) CS [HAS CONCEPT MOD]                        #  16, 1 RelationshipType
        (0040,a040) CS [CODE]                                   #   4, 1 ValueType
        (0040,a043) SQ (Sequence with explicit length #=1)      #  52, 1 ConceptNameCodeSequence
          (fffe,e000) na (Item with explicit length #=3)          #  44, 1 Item
            (0008,0100) SH [G-C0E8]                                 #   6, 1 CodeValue
            (0008,0102) SH [SRT]                                    #   4, 1 CodingSchemeDesignator
            (0008,0104) LO [Has Intent]                             #  10, 1 CodeMeaning
          (fffe,e00d) na (ItemDelimitationItem for re-encoding)   #   0, 0 ItemDelimitationItem
        (fffe,e0dd) na (SequenceDelimitationItem for re-encod.) #   0, 0 SequenceDelimitationItem
        (0040,a168) SQ (Sequence with explicit length #=1)      #  90, 1 ConceptCodeSequence
          (fffe,e000) na (Item with explicit length #=3)          #  82, 1 Item
            (0008,0100) SH [R-002E9]                                #   8, 1 CodeValue
            (0008,0102) SH [SRT]                                    #   4, 1 CodingSchemeDesignator
            (0008,0104) LO [Combined Diagnostic and Therapeutic Procedure] #  46, 1 CodeMeaning
          (fffe,e00d) na (ItemDelimitationItem for re-encoding)   #   0, 0 ItemDelimitationItem
        (fffe,e0dd) na (SequenceDelimitationItem for re-encod.) #   0, 0 SequenceDelimitationItem
      (fffe,e00d) na (ItemDelimitationItem for re-encoding)   #   0, 0 ItemDelimitationItem
    (fffe,e0dd) na (SequenceDelimitationItem for re-encod.) #   0, 0 SequenceDelimitationItem
  (fffe,e00d) na (ItemDelimitationItem for re-encoding)   #   0, 0 ItemDelimitationItem

  (fffe,e000) na (Item with explicit length #=4)          # 164, 1 Item
    (0040,a010) CS [HAS OBS CONTEXT]                        #  16, 1 RelationshipType
.............


At the very top you can see the main "node" which is a "ContentSequence".
Then coming the "ConceptNameCodeSequence"
and finally another "ContentSequence". All within the "Red" outlined ITEM.

What i was doing is this as well as some other constructions. Non of them create what i am searching for:
            DicomSequence contentSequence = new DicomSequence(DicomTag.ContentSequence);

            DicomContentItem dci1 = new DicomContentItem(new DicomCodeItem("121058", "DCM", "Procedure reported"),
                                                         DicomRelationship.HasConceptModifier,
                                                         new DicomCodeItem("113704", "DCM", "Projection X-Ray"));
            contentSequence.Items.Add(dci1.Dataset);

            // Intent AS Sequence in the main contentSequence
            DicomSequence intentSequence = new DicomSequence(DicomTag.ContentSequence);
            DicomContentItem dci2 = new DicomContentItem(new DicomCodeItem("G-C0E8", "SRT", "Has Intent"),
                                                         DicomRelationship.HasConceptModifier,
                                                         new DicomCodeItem("R-002E9", "SRT", "Combined Diagnos...."));
            intentSequence.Items.Add(dci2.Dataset);
            contentSequence.Items.Add(intentSequence.Items[0]);

Either the second sequence has it's own Item (fffe,e000) or other results, which i currently do not remember. I am writing this from home not being able to access my workplace and have tried so many things today.

There must be someone out there having created a structured report with the help of DicomContentItem and DicomCodeItem. Don't wanna fiddle around by low-level adding dicom tags.

Thanks for your help in advance,

Harry

harald...@gmx.net

unread,
Oct 26, 2016, 3:43:20 AM10/26/16
to Fellow Oak DICOM
Ok, if found the solution by myself after studying the source-code of fo-dicom a bit deeper. This is what produces the correct result:

  // This sequence is the holy grail. It contains all our dose stuff.

  DicomSequence contentSequence = new DicomSequence(DicomTag.ContentSequence);
  DicomContentItem dci1 = new DicomContentItem(new DicomCodeItem("121058", "DCM", "Procedure reported"),
                                               DicomRelationship.HasConceptModifier,
                                               new DicomCodeItem("113704", "DCM", "Projection X-Ray"));
  DicomContentItem dci2 = new DicomContentItem(new DicomCodeItem("G-C0E8", "SRT", "Has Intent"),
                                               DicomRelationship.HasConceptModifier,
                                               new DicomCodeItem("R-002E9", "SRT", "Combined Diagn..."));
  dci1.Add(dci2);
  contentSequence.Items.Add(dci1.Dataset);

The secret is in adding the second DicomContentItem to the first one as a child. So the above code, apart from the Content, produces the exact structure as in my Initial question above.

Thanks for reading,

Harry

Reply all
Reply to author
Forward
0 new messages