The dcmcjpeg
tool from the dcmtk package (sudo apt-get install dcmtk
) is supposed to convert DICOM image files to JPEG.
But I suspect it still wraps the image in a DICOM container, because when I try, I get this:
> file 000010.*
000010.dcm: DICOM medical imaging data
> md5sum 000010.*
a64dee7fa9c9fb383c9aec833006f161 000010.dcm
> dcmcjpeg --verbose --encode-extended --quality 75 --huffman-optimize --bits-force-8 --monochrome 000010.dcm 000010.jpg
I: reading input file 000010.dcm
I: Convert DICOM file to compressed transfer syntax
I: Output transfer syntax JPEG Extended, Process 2+4 can be written
I: creating output file 000010.jpg
I: conversion successful
> file 000010.*
000010.dcm: DICOM medical imaging data
000010.jpg: DICOM medical imaging data
> md5sum 000010.*
a64dee7fa9c9fb383c9aec833006f161 000010.dcm
c3019b54640179805ab3912414b97936 000010.jpg
How can I fully extract the image from a DICOM file and convert it to a common format such as JPEG or PNG?