technovelty

weblog of Ian Wienand

RSS  |  technovelty home  |  page of ian  |  ian@wienand.org

Converting DICOM images

If you go for an ultrasound or some other imaging procedure, they may give you a CD with the images that requires some overly complicated and under-featured Windows viewer. Chances are these images are in DICOM format, which is like the AVI of the medical world.

Your first clue will be that file might report the file as an unoptimised QuickTime movie, e.g.

$ file ./QMAG0001
./QMAG0001: Apple QuickTime movie (unoptimized)

After figuring out the file type wasn't actually anything to do with QuickTime, I tried some of the many different tools and methods to convert this to something viewable. Unfortunatley, the DICOM viewer in GIMP and ImageMagick (probably the same thing?) didn't like the files at all, and neither did a range of other tools. I finally managed to do it with the dcm2pnm tool from the Debian dcmtk package -- just point it at the file and it spits out a PNM which is easily converted by all graphics tools.

You can also encapsulate a series of images in a DICOM file, like a little movie. dcm2pnm extracts these easily, but requires the --all-frames options. An ffmpeg recipe to turn these extracted files into a more easily viewable movie is:

$ ffmpeg -qscale 5 -r 20 -b 9600 -i foo.%d.ppm movie.mp4

I certainly can't guarantee this will actually work for you, as DICOM appears to be an extremely complicated format with many possible vendor extensions. But hopefully it's a starting point!

posted at: Sun, 08 Feb 2009 14:11 | in /linux/tips | permalink | add comment (2 others)

Posted by Robbie at Tue Feb 10 07:56:13 2009

Depending on the vendor, I often find the windows viewer quite good. These viewers are intended for GPs and other referrers.

The DICOM format is a nightmare. The vendors have a great deal of power and will often push for features specific to their products. The community process (or lack there of) is clearly to blame.

It's a great pity that there is no universal format for 3d ultrasound. We can only extract slices at the moment, which is pointless if we want to conjugate US with other modalities.

Posted by Koen at Tue Feb 10 09:23:22 2009

I got a CD with DICOM images and I was able to open it with xmedcon, my posting is at
http://www.vanimpe.eu/blog/2008/03/11/viewing-dicom-images-with-linux/

Images ;-) are at http://www.vanimpe.eu/blog/2008/03/11/dicom-fotos-linkerknie/

Add a comment
*Name
*Email (not shown)
Website
*Comment:
Anti-spam:
* denotes required field

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.