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.

328<br />

Chapter 16 <strong>DICOM</strong> Software Development<br />

the same approach for IEs <strong>and</strong> IODs. Your module class should be noth<strong>in</strong>g<br />

more than a sorted array of VRs. Then, each more complex type (IE, then<br />

IOD) will become an array of its simpler predecessor (remember our build<strong>in</strong>g<br />

blocks). Do not forget XML conversion.<br />

7. Based on the implicit/explicit VR encod<strong>in</strong>g already implemented <strong>in</strong> guidel<strong>in</strong>e<br />

1, add code to write your modules <strong>and</strong> IODs <strong>in</strong>to b<strong>in</strong>ary buffers <strong>and</strong> to read<br />

them back.<br />

8. Implement the most common <strong>DICOM</strong> pixel representations (Chap. 6); this<br />

<strong>in</strong>cludes uncompressed bitmaps at the very least. Ideally, you will have to<br />

add image compression as well. It is <strong>in</strong>evitable, so consider do<strong>in</strong>g it sooner<br />

rather than later.<br />

9. Never attempt to write image compression from scratch, even if you know<br />

how it works. Underst<strong>and</strong> that this is not about know<strong>in</strong>g the pr<strong>in</strong>ciples, this<br />

is about hav<strong>in</strong>g a solid implementation of a particular ISO compression<br />

st<strong>and</strong>ard. The only exception will be <strong>DICOM</strong> RLE compression (described<br />

<strong>in</strong> the <strong>DICOM</strong> st<strong>and</strong>ard, RLE is relatively easy to implement) <strong>and</strong> several<br />

simple image pixel photometric conversions (from RGB <strong>in</strong>to YBR, which<br />

is clearly expla<strong>in</strong>ed <strong>in</strong> PS3.3, <strong>and</strong> used mostly <strong>in</strong> ultrasound images). Then<br />

you will need to add JPEG compression. Use the free <strong>and</strong> open-source Independent<br />

JPEG Group library (IJG: http://www.ijg.org/), it’s a good place<br />

to start. Unfortunately, the project has not released any updates s<strong>in</strong>ce version<br />

6b <strong>in</strong> 1998. It also has some bugs, their code style is very far from<br />

contemporary object-oriented C + + , <strong>and</strong> performance optimization <strong>in</strong> this<br />

library is virtually unknown. 55 Nevertheless, they have done a great job of<br />

implement<strong>in</strong>g a complete <strong>and</strong> transparent JPEG code, which is not as simple<br />

as it might sound. 56<br />

10. When you are done with generic IOD implementation, implement a few specific<br />

IODs (CT, CR, <strong>and</strong> MR images, for example). Only now you can try to<br />

apply your implementation to open (relatively easy) <strong>and</strong> write (more complex)<br />

<strong>DICOM</strong> files, such as CT <strong>and</strong> MR image files. This part of your development<br />

will be the most difficult <strong>and</strong> challeng<strong>in</strong>g, as you are now cross<strong>in</strong>g<br />

<strong>in</strong>to a very practical area. Try to collect sample <strong>DICOM</strong> files from different<br />

sources (different modalities, applications, onl<strong>in</strong>e databases); this will help<br />

you teach your code to deal with the natural differences <strong>and</strong> idiosyncrasies<br />

<strong>in</strong> various <strong>DICOM</strong> implementations. When you write your <strong>DICOM</strong> files,<br />

make sure the other <strong>DICOM</strong> software can open them.<br />

11. Ultrasound images would be your next step. They are color images <strong>and</strong> come<br />

with five different photometric representations (ways to encode color pixels<br />

55 Many commercial JPEG implementations will try to make performance optimization<br />

their strongest po<strong>in</strong>t, expla<strong>in</strong><strong>in</strong>g to you why you need to pay them big bucks for someth<strong>in</strong>g<br />

you can get free with IJG.<br />

56 For more compression options, search the Web; I suggest you start from www.datacompression.<strong>in</strong>fo.

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

Saved successfully!

Ooh no, something went wrong!