15.12.2012 Views

Digital Imaging and Communications in Medicine (DICOM)

Digital Imaging and Communications in Medicine (DICOM)

Digital Imaging and Communications in Medicine (DICOM)

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

222<br />

10.1<br />

<strong>DICOM</strong> File Format<br />

Chapter 10 <strong>DICOM</strong> Media: Files, Folders, <strong>and</strong> <strong>DICOM</strong>DIRs<br />

When talk<strong>in</strong>g about <strong>DICOM</strong> media, we are talk<strong>in</strong>g about <strong>DICOM</strong> files. <strong>DICOM</strong><br />

files store <strong>DICOM</strong> data objects (also referred to as Data Sets), most frequently,<br />

<strong>DICOM</strong> images. The data objects are written <strong>in</strong>to the <strong>DICOM</strong> files with the exact<br />

same encod<strong>in</strong>g rules as we used <strong>in</strong> <strong>DICOM</strong> network<strong>in</strong>g: implicit or explicit<br />

VR encod<strong>in</strong>g (see 5.5). The only difference is <strong>in</strong> the <strong>DICOM</strong> file header, which<br />

precedes the data object, as shown on Fig. 72. The <strong>DICOM</strong> header plays the<br />

role of the miss<strong>in</strong>g <strong>DICOM</strong> association establishment: it expla<strong>in</strong>s to any fileread<strong>in</strong>g<br />

application that the file stores <strong>DICOM</strong> data of certa<strong>in</strong> a SOP type, <strong>and</strong><br />

<strong>in</strong> certa<strong>in</strong> Transfer Syntax format. The <strong>DICOM</strong> header <strong>in</strong>cludes a preamble, a<br />

DICM prefix, <strong>and</strong> a p<strong>in</strong>ch of <strong>DICOM</strong> file attributes (file meta elements).<br />

10.1.1<br />

Preamble <strong>and</strong> DICM Prefix<br />

The preamble is a str<strong>in</strong>g of 128 bytes, which opens any <strong>DICOM</strong> file. The use of a<br />

preamble is common <strong>in</strong> many imag<strong>in</strong>g <strong>and</strong> data formats (consider TIFF images,<br />

for example), <strong>and</strong> <strong>DICOM</strong> adapted the same style. However, the <strong>DICOM</strong> st<strong>and</strong>ard<br />

does not def<strong>in</strong>e any particular preamble structure or content. It is up to each<br />

<strong>DICOM</strong> application to use the 128 preamble bytes to its advantage. Obviously,<br />

this makes preamble content application-dependent; different applications can<br />

use it differently. For that reason, the preamble <strong>in</strong> <strong>DICOM</strong> is generally ignored<br />

<strong>and</strong> filled with 0 bytes; <strong>in</strong> <strong>DICOM</strong> this simply means “unused preamble”.<br />

The DICM prefix (<strong>in</strong>dicat<strong>in</strong>g the <strong>DICOM</strong> file format) follows the 128-byte<br />

preamble verbatim. It simply consists of the four uppercase letters (D I C M)<br />

written <strong>in</strong>to bytes 129–132. The use of a format prefix (often called the magic<br />

number) is also very common <strong>in</strong> many file formats (imag<strong>in</strong>g <strong>in</strong>cluded) <strong>and</strong><br />

<strong>DICOM</strong> follows the same convention.<br />

Neither the preamble nor the DICM prefix use <strong>DICOM</strong> VR encod<strong>in</strong>g rules.<br />

They are simply stored <strong>in</strong> the first 128 + 4 = 132 bytes. If you are writ<strong>in</strong>g a program<br />

to identify <strong>DICOM</strong> files, make it skip the first 128 bytes, <strong>and</strong> then verify<br />

the DICM prefix.<br />

Fig. 72 <strong>DICOM</strong> file structure

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!