Adding Sequence Items

A sequence in DICOM is represented by DicomDataSets Object in DicomObjects and a sequence item is represented by a DicomDataSet Object.
Following is sample VB6 code showing how to add sequence items using DicomObjects.

Dim ReferencedImageSequence As New DicomDataSets
Dim ReferencedImageA As New DicomDataSet
Dim ReferencedImageB As New DicomDataSet
Dim DataSet As New DicomDataSet

' Add attributes to ReferencedImageA  
ReferencedImageA.Attributes.Add &H0008, &H1150, "Referenced SOP Class UID A"
ReferencedImageA.Attributes.Add &H0008, &H1155, "Referenced SOP Instance UID A"
ReferencedImageA.Attributes.Add &H0008, &H0054, "Retrieve AE A"
ReferencedImageA.Attributes.Add &H0008, &H0130, "Storage Media File-Set ID A"
ReferencedImageA.Attributes.Add &H0008, &H0140, "Storage Media File-Set UID A"

' Add attributes to ReferencedImageB  
ReferencedImageB.Attributes.Add &H0008, &H1150, "Referenced SOP Class UID B"
ReferencedImageB.Attributes.Add &H0008, &H1155, "Referenced SOP Instance UID B"
ReferencedImageB.Attributes.Add &H0008, &H0054, "Retrieve AE B"
ReferencedImageB.Attributes.Add &H0008, &H0130, "Storage Media File-Set ID B"
ReferencedImageB.Attributes.Add &H0008, &H0140, "Storage Media File-Set UID B"

' ...

ReferencedImageSequence.Add ReferencedImageA  ' Add Sequence Item to Sequence 
ReferencedImageSequence.Add ReferencedImageB  ' Add Sequence Item to Sequence 

' ...      

DataSet.Attributes.Add &H8, &H1140, Sequence  ' Add Referenced Image Sequence to DataSet 

Note: NOT all Sequences can have multiple items in DICOM, for example the "Scheduled Procedure Step Sequence" (0040, 0100) can have only 1 sequence item. Check the DICOM Standard Part 3 (for stored items) or Part 4 (for services such as Modality_Worklist) for the rules for particular sequences. The "value multiplicity" found in part 6 does not apply to sequences.

Relevance: