Sunday, January 29, 2012

Converting Dicom (aka Medical) images

Today, I will explain how to convert a Dicom image (.dcm), which is a standard in medical imaging, to other formats (pgm/ppm, png, etc...). Usually MRI and such images are saved in this format.

There is a CLI tool to read&convert this kind of files, you can get it by running this in the Terminal (Ubuntu users):
sudo apt-get install dcmtk

You can then use these tools:
dcm2pnm
dcmj2pnm
I had to use dcmj2pnm, as dcm2pnm gave me errors (really depends on what kind of images you have).

Note* (in case of permission issues first copy the .dcm files to your disk, if they are on a CD issued by the doctor, and change permissions. A chmod 775 *.dcm run in the images dir will do the trick).

Run this command and it will convert the picture in a different format:
dcmj2pnm --all-frames input_image.dcm output_image

Enjoy!

10 comments:

  1. Didn't know those kind of images had a format by their own. Great guide!

    ReplyDelete
  2. I feel kinda stupid, that's just well over my head there lol :/

    ReplyDelete
  3. ^Yeah, Ubuntu is not for the non-techy.

    Seems easy enough. Good post!

    ReplyDelete
  4. Same here, I had no idea MRIs had their own format, but it makes sense. I wonder how many medical techs use Ubuntu tho.

    ReplyDelete
  5. Useful information.

    ReplyDelete
  6. I don't think I've ever come across such image types

    ReplyDelete
  7. I hope i get into the position to benefit from this one ;D

    ReplyDelete
  8. Never seen that type but i'll come here if i do!

    ReplyDelete
  9. Thanks for sharing this! You're very knowledgeable so I'm going to follow you. I look forward to see more in future.

    If you could take some time to check out my blog, it would be much appreciated. I'm just starting out. Thanks :)

    ReplyDelete
  10. saving the info, might be useful

    ReplyDelete