DICOM PS3.5 2020c - Data Structures and Encoding

D Examples of Various Pixel Data and Overlay Encoding Schemes (Informative) (Current)
Prev |  | Next

# D Examples of Various Pixel Data and Overlay Encoding Schemes (Informative)

## D.1 Detailed Example of Pixel Data Encoding

As specified in PS3.3, Image Pixel Data is stored within the Value of the Pixel Data Element (7FE0,0010). The order in which Pixel Data for an image plane is encoded is from left to right and top to bottom, a row at a time (see Figure D-1).

Figure D-1. An Image Pixel Plane

An individual pixel may consist of one or more Pixel Sample Values (e.g., color or multi-planar images). Each Pixel Sample Value can be expressed as either a binary 2's complement integer or a binary unsigned integer, as specified by the Pixel Representation Data Element (0028, 0103). The number of bits in each Pixel Sample Value is specified by Bits Stored (0028,0101). For 2's complement integer Pixel Samples the sign bit is the most significant bit of the Pixel Sample Value.

A Pixel Cell is the container for a Pixel Sample Value and optionally additional bits. These additional bits are used to place Pixels on certain boundaries (byte, word, etc.). A Pixel Cell exists for every individual Pixel Sample Value in the Pixel Data. The size of the Pixel Cells is specified by Bits Allocated (0028,0100) and is greater than or equal to the Bits Stored (0028,0101). The placement of the Pixel Sample Values within the Pixel Cells is specified by High Bit (0028,0102).

Any restrictions on the characteristics of a Pixel Cell and the Pixel Sample Value contained therein are specific to the Information Object Definition (e.g., Image Object) containing the Pixel Data Element (see PS3.3).

The Pixel Data Element, as specified by the DICOM Default Transfer Syntax in Section 10.1, has a Value Representation of OW (Other Word). The Pixel Data in DICOM, as it was in ACR-NEMA 2.0, is packed, except that Bits Allocated is always either 1, or a multiple of 8 (see Figure D-2). One way to visualize this packed encoding is to imagine encoding the Pixel Cells as a concatenated stream of bits from the least significant bit of the first Pixel Cell up through the most significant bit of the last Pixel Cell. Within this stream, the most significant bit of any Pixel Cell is followed by the least significant bit of the next Pixel Cell. The Pixel Data can then be broken up into a stream of physical 16-bit words, each of which is subject to the byte ordering constraints of the Transfer Syntax.

All other (non-default) DICOM Transfer Syntaxes make use of explicit VR encoding. For these Transfer Syntaxes, all Pixel Data where Bits Allocated is less than or equal to 8 may be encoded with an explicit VR of OB (see Annex A). As in the OW case, Pixel Cells are packed together, but in this case the Pixel Data is broken up into a stream of physical 8-bit words.

### Note

For Pixel Data encoded with an explicit VR of OB, the encoding of the Pixel Data is unaffected by byte ordering.

Figure D-2. Encoding (Packing) of Arbitrary Pixel Data with a VR of OW

With the exception of single bit images, Pixel Cells begin and end on byte or word boundaries and such that the Pixel Sample Value contained within also fits 'neatly' within a cell.

Figure D-3 is an example of Pixel Data encoding using the Value representation of OW for the purposes of clarification. The Example is a valid example for a CT Image Information Object.

Figure D-3. Example Pixel Cells

Figure D-4 shows Pixel Data constructed of these example Pixel Cells as they are packed into a stream of 16-bit words.

Figure D-4. Example Pixel Cells Packed into 16-bit Words (VR = OW)

Byte ordering becomes a consideration when we represent the Pixel Data physically, in memory, a file, or on a network.

In the memory of a byte-addressable Big Endian machine, the highest order byte (bits 8 - 15) in each 16-bit word has a binary address of x...x0. While in a byte-addressable Little Endian machine, the lowest order byte (bits 0 - 7) in each 16-bit word has a binary address of x...x0. Figure D-5 pictures our example Pixel Data streams as they would be addressed in the memory of both a Big Endian and a Little Endian machine.

Figure D-5. Example Pixel Cells Byte Ordered in Memory (VR = OW)

Byte ordering is also specified as part of the negotiated Transfer Syntax used in the exchange of a DICOM message. Sixteen bit words are transmitted across the network (a byte at a time) least significant byte first in the case of a Little Endian Transfer Syntax (see Figure D-6).

Figure D-6. Sample Pixel Data Byte Streams (VR = OW)

As a last pair of examples, for Pixel Data having the Value Representation OW and the following attributes: 8 bits allocated, 8 bits stored, and a high bit of 7; the resulting byte streams pictured in Figure D-7 are as they would be transmitted across a network and/or stored on media. For Pixel Data having the same attributes, but having the explicit Value Representation OB; the resulting byte streams are unaffected by byte ordering and are pictured in Figure D-8.

Figure D-7. Sample Pixel Data Byte Streams for 8-bits Allocated and 8-bits Stored (VR = OW)

Figure D-8. Sample Pixel Data Byte Streams for 8-bits Allocated and 8-bits Stored (Explicit VR = OB)

Prev |  | Next
C DICOM Unique Identifier Registration Process (Informative) | Home | D.2 Various Additional Examples of Pixel and Overlay Data Cells

DICOM PS3.5 2020c - Data Structures and Encoding