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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5.5 <strong>DICOM</strong> Objects 57<br />

change the pr<strong>in</strong>ciple. A s<strong>in</strong>gle rule determ<strong>in</strong>es the element order: all data elements<br />

<strong>in</strong>side <strong>DICOM</strong> objects must be ordered by their tag “(group, element)”<br />

number. This order<strong>in</strong>g serves at least two practical purposes:<br />

1. Helps verify data <strong>in</strong>tegrity (similar to what even data length does). If, when<br />

read<strong>in</strong>g a <strong>DICOM</strong> object element after element, you run <strong>in</strong>to an element<br />

with a smaller tag number than the one you read before, the object is<br />

corrupted.<br />

2. Helps put data <strong>in</strong> the order <strong>in</strong> which it should really be <strong>in</strong>terpreted. For example,<br />

image width <strong>and</strong> height have lower tag numbers than the actual image<br />

pixel buffer. This means that image width <strong>and</strong> height are read first, <strong>and</strong> only<br />

after will you read the pixels, already know<strong>in</strong>g how to group them <strong>in</strong>to the<br />

width-by-height pixel matrix.<br />

5.5.5<br />

SQ: Encod<strong>in</strong>g <strong>DICOM</strong> Object Sequences<br />

As we have already seen, one VR type, SQ (sequence), plays a very special role<br />

<strong>in</strong> <strong>DICOM</strong> data encod<strong>in</strong>g. It allows us to store entire sequences of <strong>DICOM</strong><br />

objects <strong>in</strong> a s<strong>in</strong>gle SQ VR (see Sect. 5.3.10). With the <strong>in</strong>troduction of the SQ<br />

type, <strong>DICOM</strong> object layout changes dramatically. The SQ element has no data<br />

of its own. Instead, it conta<strong>in</strong>s a sequence of <strong>DICOM</strong> objects. These objects become<br />

nested <strong>in</strong> the parent <strong>DICOM</strong> object (the object conta<strong>in</strong><strong>in</strong>g the SQ element).<br />

Moreover, because the <strong>DICOM</strong> objects <strong>in</strong> the SQ sequence obey the same<br />

<strong>DICOM</strong> object format, they can also conta<strong>in</strong> SQ elements. As a result, we could<br />

have multiple nest<strong>in</strong>g levels as shown on Fig. 12. The nest<strong>in</strong>g stops at the level<br />

where nested <strong>DICOM</strong> objects have no more SQ elements. Thus, the entire concept<br />

of object sequenc<strong>in</strong>g comes quite naturally. If it looks thorny to you, th<strong>in</strong>k<br />

about the structure of this book. The book has chapters (data elements), but<br />

some of these first-level chapters have second-level chapters (subsections) <strong>in</strong>side<br />

them, <strong>and</strong> some second-level chapters have their own subchapters as well<br />

(third level), <strong>and</strong> so on. So, if we consider this book as a large <strong>DICOM</strong> object,<br />

chapters with subchapters would be our SQ elements. In fact, many current<br />

data-representation languages (XML, for example) make full use of data nest<strong>in</strong>g<br />

just like <strong>DICOM</strong> does.<br />

How do we encode SQ elements though? Without SQ everyth<strong>in</strong>g is easy.<br />

A <strong>DICOM</strong> object is a list of its data elements, so we encode it as a list as well.<br />

For SQ elements, <strong>DICOM</strong> provides a special SQ encod<strong>in</strong>g scheme that encapsulates<br />

the <strong>DICOM</strong> object sequence with<strong>in</strong> a s<strong>in</strong>gle VR. This is similar to what<br />

was learned <strong>in</strong> Sect. 5.5.1 <strong>and</strong> depends on the VR encod<strong>in</strong>g method (explicit<br />

or implicit) <strong>and</strong> our choice of data SQ item delimiters (known or unknown<br />

length). The follow<strong>in</strong>g three examples <strong>in</strong> Table 11 cover all possible SQ encod<strong>in</strong>g<br />

methods (nested <strong>DICOM</strong> objects are <strong>in</strong> gray cells). If you compare the<br />

three examples, you might discover the SQ encod<strong>in</strong>g rules on your own. The<br />

rules <strong>in</strong>clude:

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

Saved successfully!

Ooh no, something went wrong!