The DICOM File Format is described by the American College of Radiology (ACR) and National Electrical Manufacturers Association (NEMA) in PS 3.10 specification "Media Storage and File Format for Media Interchange", of the DICOM Standard. An illustration of the basic file structure can be seen below.
The header consists of a 128 byte File Preamble, followed by a 4 byte DICOM prefix. The header may or may not be included in the file (although one should be included in order to comply with the DICOM Standard).
128 bytes = ??? ???
4 bytes = 'D', 'I', 'C', 'M'
The DICOM Standard does not require any structure for the fixed size Preamble. It is not required to be structured as a DICOM Data Element with a Tag and a Length. It is intended to facilitate access to the images and other data in the DICOM file by providing compatibility with a number of commonly used computer image file formats.
a) If the File Preamble is not used by an Application Profile or a specific implementation, all 128 bytes shall be set to 00H. This is intended to facilitate the recognition that the Preamble is used when all 128 bytes are not set as specified above.
b) The File Preamble may for example contain information enabling a multi-media application to randomly access images stored in a DICOM Data Set. The same file can be accessed in two ways: by a multi-media application using the Preamble and by a DICOM Application which ignores the Preamble.
The four byte DICOM Prefix shall contain the character string "DICM" encoded as uppercase characters of the ISO 8859 G0 Character Repertoire. This four byte prefix is not structured as a DICOM Data Element with a Tag and a Length.
Each File shall contain a single Data Set representing a single SOP Instance related to a single SOP Class (and corresponding IOD).
Note: A file may contain more than a single 2D image frame as specific IODs may be defined to include multiple frames.
The Transfer Syntax used to encode the Data Set shall be the one identified by the Transfer Syntax UID of the DICOM File Meta Information.
Note: A DICOM Data Set does not include its total length. The end of the file indication provided by the DICOM File Service (see Section 8.4 in PS 3.10 of the DICOM Standard) is the only indication of the end of the Data Set.
The last Data Element of a Data Set may be Data Element (FFFC,FFFC) if padding of a Data Set is desired when a file is written. The Value of this Data Set Trailing Padding Data Element (FFFC,FFFC) has no significance and shall be ignored by all DICOM implementations reading this Data Set. File-set Readers or Updaters shall be able to process this Data Set Trailing Padding (FFFC,FFFC) either in the Data Set following the Meta Information or in Data Sets nested in a Sequence (see PS 3.5 of the DICOM Standard).
A Data Set represents an instance of a real world Information Object. A Data Set is constructed of Data Elements. Data Elements contain the encoded Values of Attributes of that object. The specific content and semantics of these Attributes are specified in Information Object Definitions (see PS 3.3 of the DICOM Standard). The construction, characteristics, and encoding of a Data Set and its Data Elements are discussed in PS 3.5 of the DICOM Standard. Pixel Data, Overlays, and Curves are Data Elements whose interpretation depends on other related elements.
A Data Element is uniquely identified by a Data Element Tag. The Data Elements in a Data Set shall be ordered by increasing Data Element Tag Number and shall occur at most once in a Data Set.
Note: A Data Element Tag may occur again within Nested Data Sets (see Section 7.5 in PS 3.5 of the DICOM Standard).
Two types of Data Elements are defined:
a) Standard Data Elements have an even Group Number that is not (0000,eeee), (0002,eeee), (0004,eeee), or (0006,eeee).
Note: Usage of these groups is reserved for DIMSE Commands (see PS 3.7 of the DICOM Standard) and DICOM File Formats.
b) Private Data Elements have an odd Group Number that is not (0001,eeee), (0003,eeee), (0005,eeee), (0007,eeee), or (FFFF,eeee). Private Data Elements are discussed further in Section 7.8 in PS 3.5 of the DICOM Standard.
Note: Although similar or related Data Elements often have the same Group Number, a Data Group does not convey any semantic meaning beginning with DICOM Version 3.0.
A Data Element shall have one of three structures. Two of these structures contain the VR of the Data Element (Explicit VR) but differ in the way their lengths are expressed, while the other structure does not contain the VR (Implicit VR). All three structures contain the Data Element Tag, Value Length and Value for the Data Element. For more information, refer to Data Element Structure.
Implicit and Explicit VR Data Elements shall not coexist in a Data Set and Data Sets nested within it (see Section 7.5 in PS 3.5 of the DICOM Standard). Whether a Data Set uses Explicit or Implicit VR, among other characteristics, is determined by the negotiated Transfer Syntax (see Section 10 and Annex A in PS 3.5). Note: VRs are not contained in Data Elements when using DICOM Default Transfer Syntax (DICOM Implicit VR Little Endian Transfer Syntax).
Medical Web Viewer .NET