After the file meta information, a DICOM file is one data set: a list of data elements in increasing tag order, each tag at most once. The encoding rules are in DICOM PS3.5; the meaning of each tag is in the data dictionary, PS3.6.
Tags
A tag is two unsigned 16-bit numbers, the group and the element, written
(gggg,eeee) in hexadecimal. In a little-endian file the group is stored
first, then the element, each least significant byte first: (0010,0010)
is 10 00 10 00.
| Group | Use |
|---|---|
Even, not 0000, 0002, 0004, 0006 | Standard elements defined in PS3.6 |
0000 | Network command elements (PS3.7); not in files |
0002 | File meta information |
0004 | Directory records of a DICOMDIR file |
0006 | Reserved |
Odd, not 0001, 0003, 0005, 0007, FFFF | Private elements (below) |
FFFE | Item and delimiter tags of sequences and encapsulated pixel data |
Element forms
The transfer syntax decides whether elements carry their VR (explicit VR) or not (implicit VR, where the reader looks the VR up in the dictionary). The two forms never mix in one data set.
| Form | Tag | VR | Reserved | Length | Used for |
|---|---|---|---|---|---|
| Explicit VR, short | 4 | 2 | – | 2 (unsigned) | AE, AS, AT, CS, DA, DS, DT, FL, FD, IS, LO, LT, PN, SH, SL, SS, ST, TM, UI, UL, US |
| Explicit VR, long | 4 | 2 | 2, 00 00 | 4 (unsigned) | OB, OD, OF, OL, OV, OW, SQ, SV, UC, UN, UR, UT, UV, and any VR added in future |
| Implicit VR | 4 | – | – | 4 (unsigned) | Every element |
- The value follows the length and always has an even number of bytes.
- A length of
FFFFFFFFmeans undefined length: the value runs until a delimiter. It is allowed for SQ and UN, and for OB pixel data when the transfer syntax encapsulates it. - An empty value has length 0.
Value representations
| VR | Name | Size | Content |
|---|---|---|---|
| AE | Application Entity | ≤ 16 bytes | Name of a DICOM application; leading and trailing spaces not significant |
| AS | Age String | 4 bytes | nnnD, nnnW, nnnM or nnnY: days, weeks, months, years (018M) |
| AT | Attribute Tag | 4 bytes | A tag as two 16-bit unsigned numbers, group first |
| CS | Code String | ≤ 16 bytes | Upper-case letters, digits, space and underscore |
| DA | Date | 8 bytes | YYYYMMDD |
| DS | Decimal String | ≤ 16 bytes | A fixed or floating point number as text |
| DT | Date Time | ≤ 26 bytes | YYYYMMDDHHMMSS.FFFFFF&ZZXX, later parts optional; &ZZXX is the offset from UTC |
| FL | Floating Point Single | 4 bytes | IEEE 754 binary32 |
| FD | Floating Point Double | 8 bytes | IEEE 754 binary64 |
| IS | Integer String | ≤ 12 bytes | A decimal integer as text, within the signed 32-bit range |
| LO | Long String | ≤ 64 characters | Text with no backslash or control characters except ESC |
| LT | Long Text | ≤ 10240 characters | Paragraphs; may contain TAB, CR, LF, FF and ESC |
| OB | Other Byte | ≤ 232−2 bytes | A string of bytes, unaffected by byte order |
| OD | Other Double | ≤ 232−8 bytes | A string of binary64 floats |
| OF | Other Float | ≤ 232−4 bytes | A string of binary32 floats |
| OL | Other Long | ≤ 232−4 bytes | A string of 32-bit words |
| OV | Other 64-bit Very Long | ≤ 232−8 bytes | A string of 64-bit words |
| OW | Other Word | ≤ 232−2 bytes | A string of 16-bit words |
| PN | Person Name | ≤ 64 characters per group | Up to five parts separated by ^ (family, given, middle, prefix, suffix), in up to three groups separated by = (alphabetic, ideographic, phonetic) |
| SH | Short String | ≤ 16 characters | Short text |
| SL | Signed Long | 4 bytes | Signed 32-bit integer |
| SQ | Sequence of Items | ≤ 232−2 bytes or undefined | Zero or more items, each a nested data set (below) |
| SS | Signed Short | 2 bytes | Signed 16-bit integer |
| ST | Short Text | ≤ 1024 characters | Paragraphs, as LT |
| SV | Signed 64-bit Very Long | 8 bytes | Signed 64-bit integer |
| TM | Time | ≤ 14 bytes | HHMMSS.FFFFFF, later parts optional |
| UC | Unlimited Characters | ≤ 232−2 bytes | Text of any length, no backslash or control characters except ESC |
| UI | Unique Identifier | ≤ 64 bytes | Digits and full stops, such as 1.2.840.10008.1.2 |
| UL | Unsigned Long | 4 bytes | Unsigned 32-bit integer |
| UN | Unknown | Any | Bytes whose VR is not known |
| UR | Universal Resource Identifier | ≤ 232−2 bytes | A URI or URL (RFC 3986); other characters percent-encoded |
| US | Unsigned Short | 2 bytes | Unsigned 16-bit integer |
| UT | Unlimited Text | ≤ 232−2 bytes | Paragraphs of any length |
| UV | Unsigned 64-bit Very Long | 8 bytes | Unsigned 64-bit integer |
- Text VRs are padded to even length with one trailing space (
20); UI is padded with one00; OB with one00byte. - Text uses the default character repertoire (ASCII) unless Specific Character Set
(0008,0005)names another.
Value multiplicity
An element can hold several values. In text VRs they are separated by a backslash
(5C), and the padding goes after the last value. Binary values of a fixed
size are simply concatenated. LT, OB, OD, OF, OL, OV, OW, SQ, ST, UN, UR and UT always
hold exactly one value.
Byte order
In little-endian transfer syntaxes, every binary number (tags, lengths, US, UL, SS, SL,
FL, FD, OW, OF and so on) is stored least significant byte first. In the retired
explicit VR big endian syntax they are stored most significant byte first, except OB
and the group 0002 elements. Text values are byte strings either way.
Sequences and items
An SQ element holds items, each a nested data set. Items and delimiters use three special tags, always written in the implicit VR form (tag and 4-byte length, no VR), even in an explicit VR data set:
| Tag | Name | Length |
|---|---|---|
(FFFE,E000) | Item | Length of the item’s data set, or FFFFFFFF for undefined |
(FFFE,E00D) | Item Delimitation Item | 00000000; ends an item of undefined length |
(FFFE,E0DD) | Sequence Delimitation Item | 00000000; ends a sequence of undefined length |
- A sequence of explicit length has a length covering all its items; an empty one has
length 0. A sequence of undefined length ends with
(FFFE,E0DD). - Items inside the same sequence may mix explicit and undefined lengths.
- The data set inside an item follows the transfer syntax as usual, and may hold more sequences. An SQ element always has a value multiplicity of 1.
- Groups
0000,0002and0006are not allowed inside items.
08 00 15 11 53 51 00 00 FF FF FF FF (0008,1115) SQ, undefined length
FE FF 00 E0 FF FF FF FF item, undefined length
…data elements of the item…
FE FF 0D E0 00 00 00 00 item delimitation
FE FF DD E0 00 00 00 00 sequence delimitation
Private elements
Makers add their own elements in odd groups. Each maker reserves a block of 256 elements with a private creator element:
(gggg,0010)to(gggg,00FF)are private creator elements, VR LO, value multiplicity 1, holding the maker’s identifying string.- The creator at
(gggg,00xx)owns the elements(gggg,xx00)to(gggg,xxFF):(gggg,0010)owns(gggg,1000-10FF),(gggg,0011)owns(gggg,1100-11FF), and so on. - A creator string appears only once in a group.
(gggg,0001-000F)and(gggg,0100-0FFF)are never used.
The meaning of private elements is up to each maker and is not part of the standard. In implicit VR files their VR is unknown to a reader without the maker’s documentation.
Common elements
The data dictionary (PS3.6) defines several thousand elements, too many to list here. These identify almost every object:
| Tag | VR | Name |
|---|---|---|
(0008,0005) | CS | Specific Character Set |
(0008,0016) | UI | SOP Class UID |
(0008,0018) | UI | SOP Instance UID |
(0008,0020) | DA | Study Date |
(0008,0060) | CS | Modality, such as CT, MR, US |
(0010,0010) | PN | Patient’s Name |
(0010,0020) | LO | Patient ID |
(0010,0030) | DA | Patient’s Birth Date |
(0020,000D) | UI | Study Instance UID |
(0020,000E) | UI | Series Instance UID |
(0020,0013) | IS | Instance Number |
The elements that describe the image itself are on the pixel data page.