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 code showing how ot add sequence items using DicomObjects.

.NET version

DicomDataSetCollection ReferencedImageSequence = new DicomDataSetCollection();
DicomDataSet ReferencedImageA = new DicomDataSet();
DicomDataSet ReferencedImageB = new DicomDataSet();
DicomDataSet DataSet = new DicomDataSet();

// Add attributes to ReferencedImageA  
ReferencedImageA.Add(Keyword.ReferencedSOPClassUID, "Referenced SOP Class UID A");
ReferencedImageA.Add(Keyword.ReferencedSOPInstanceUID, "Referenced SOP Instance UID A");
ReferencedImageA.Add(Keyword.RetrieveAETitle, "Retrieve AE A");
ReferencedImageA.Add(Keyword.StorageMediaFileSetID, "Storage Media File-Set ID A");
ReferencedImageA.Add(Keyword.StorageMediaFileSetUID, "Storage Media File-Set UID A");

// Add attributes to ReferencedImageB  
ReferencedImageB.Add(Keyword.ReferencedSOPClassUID, "Referenced SOP Class UID B");
ReferencedImageB.Add(Keyword.ReferencedSOPInstanceUID, "Referenced SOP Instance UID B");
ReferencedImageB.Add(Keyword.RetrieveAETitle, "Retrieve AE B");
ReferencedImageB.Add(Keyword.StorageMediaFileSetID, "Storage Media File-Set ID B");
ReferencedImageB.Add(Keyword.StorageMediaFileSetUID, "Storage Media File-Set UID B");

// ...
// Add Sequence Items to Sequences
ReferencedImageSequence.Add(ReferencedImageA);
ReferencedImageSequence.Add(ReferencedImageB);

// ...      
// Add Referenced Image Sequence to DataSet
DataSet.Add(Keyword.ReferencedImageSequence, ReferencedImageSequence);

.COM version

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 &H0088, &H0130, "Storage Media File-Set ID A"
ReferencedImageA.Attributes.Add &H0088, &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 &H0088, &H0130, "Storage Media File-Set ID B"
ReferencedImageB.Attributes.Add &H0088, &H0140, "Storage Media File-Set UID B"

' ...
' Add Sequence Items to Sequences
ReferencedImageSequence.Add ReferencedImageA 
ReferencedImageSequence.Add ReferencedImageB 

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

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.


We use cookies to give you the best possible experience on our website. By continuing to use this website, you agree with our use of cookies. for more information please click HERE