DICOM PS3.5 2016a - Data Structures and Encoding

7.5.2 Delimitation of The Sequence of Items
Prev | 7.5 Nesting of Data Sets | Next

### 7.5.2 Delimitation of The Sequence of Items

Delimitation of the last Item of a Sequence of Items, encapsulated in a Data Element of Value Representation SQ, shall be in one of the two following ways:

1. Explicit Length: The number of bytes (even) contained in the Data Element Value (following but not including the Data Element Length Field) is encoded as a 32-bit unsigned integer value (see Section 7.1). This length shall include the total length resulting from the sequence of zero or more items conveyed by this Data Element. This Data Element Length shall be equal to 00000000H if the sequence of Items contains zero Items.

2. Undefined Length: The Data Element Length Field shall contain a Value FFFFFFFFH to indicate an Undefined Sequence length. It shall be used in conjunction with a Sequence Delimitation Item. A Sequence Delimitation Item shall be included after the last Item in the sequence. Its Item Tag shall be (FFFE,E0DD) with an Item Length of 00000000H. No Value shall be present. A Sequence containing zero Items is encoded by a Sequence Delimitation Item only.

The encoder of a Sequence of Items may choose either one of the two ways of encoding. Both ways of encoding shall be supported by decoders of the Sequence of Items.

### Note

The Sequence Delimitation Item Tag (FFFE,E0DD) is different from the Item Delimitation Tag (FFFE,E00D) introduced above in that it indicates the end of a Sequence of Items whose Length was left undefined. If an undefined length Item is the last Item of a Sequence of Items of undefined length, then an Item Delimitation Tag will be followed by a Sequence Delimitation Tag.

For an example of an SQ Data Element of Explicit Length encapsulating Items of Explicit Length see Table 7.5-1.

For an example of an SQ Data Element of Undefined Length encapsulating Items of Explicit Length see Table 7.5-2.

For an example of an SQ Data Element of Undefined Length encapsulating Items of both Explicit and Undefined Length see Table 7.5-3.

Table 7.5-1. Example of a Data Element with Implicit VR Defined as a Sequence of Items (VR = SQ) with Three Items of Explicit Length

Data Element Tag | Data Element Length | Data Element Value
--- | --- | ---
(gggg, eeee) with VR of SQ | 0000 0F00H | First Item | Second Item | Third Item
Item Tag (FFFE, E000) | Item Length 0000 04F8H | Item Value Data Set | Item Tag (FFFE, E000) | Item Length 0000 04F8H | Item Value Data Set | Item Tag (FFFE, E000) | Item Length 0000 04F8H | Item Value Data Set
4 bytes | 4 bytes | 4 bytes | 4 bytes | 04F8H bytes | 4 bytes | 4 bytes | 04F8H bytes | 4 bytes | 4 bytes | 04F8H bytes

Table 7.5-2. Example of a Data Element with Explicit VR Defined as a Sequence of Items (VR = SQ) of Undefined Length, Containing Two Items of Explicit Length

Data Element Tag | Value Representation | Data Element Length | Data Element Value
(gggg, eeee) with VR of SQ | SQ | 0000H Reserved | FFFF FFFFH undefined length | First Item | Second Item | Sequence Delimitation Item
Item Tag (FFFE, E000) | Item Length 98A5 2C68H | Item Value Data Set | Item Tag (FFFE, E000) | Item Length B321 762CH | Item Value Data Set | Seq. Delim. Tag (FFFE, E0DD) | Item Length 0000 0000H
4 bytes | 2 bytes | 2 bytes | 4 bytes | 4 bytes | 4 bytes | 98A5 2C68H bytes | 4 bytes | 4 bytes | B321 762CH bytes | 4 bytes | 4 bytes

### Note

The Data Set within the Item Values in Table 7.5-2 have VRs Explicitly defined.

Table 7.5-3. Example of a Data Element with Implicit VR Defined as a Sequence of Items (VR = SQ) of Undefined Length, Containing Two Items Where One Item is of Explicit Length and the Other Item is of Undefined Length

Data Element Tag | Data Element Length | Data Element Value
(gggg, eeee) with VR of SQ | FFFF FFFFH undefined length | First Item | Second Item | Sequence Delimitation Item
Item Tag (FFFE, E000) | Item Length 0000 17B6H | Item Value Data Set | Item Tag (FFFE, E000) | Item Length FFFF FFFFH undefined length | Item Value Data Set | Item Delim. Tag (FFFE, E00D) | Length 0000 0000H | Seq. Delim. Tag (FFFE, E0DD) | Item Length 0000 0000H
4 bytes | 4 bytes | 4 bytes | 4 bytes | 17B6H bytes | 4 bytes | 4 bytes | undefined length | 4 bytes | 4 bytes | 4 bytes | 4 bytes

Prev | Up | Next
7.5 Nesting of Data Sets | Home | 7.5.3 Sequence Inheritance

DICOM PS3.5 2016a - Data Structures and Encoding