I have some DICOM medical imaging files downloaded from Cancer Imaging Archive. I can convert them from DICOM to several other formats, but as you'll see the conversion isn't working as expected in most cases.
These are the various conversions I've figured out so far:
- DICOM to netpbm format:
dctopgm8 000005.dcm 000005.pbm
- DICOM to pnm format:
dctopnm -byteorder little 000005.dcm 000005.pnm
- DICOM to png format:
dcm2pnm +on 000005.dcm 000005.png
- DICOM to png format (via ImageMagick):
convert 000005.dcm 000005.png
Of those, the .pbm is the only one that seems to give great results. It looks like this:
The .pnm looks like this, which is not quite an inverse image, but somehow looks wrong:
And both of the .png conversions look like this, which is a very washed out image, perhaps due to problems with an alpha channel, gamma, or...?
The problem is I need these to be in PNG, not PBM. And while I could add an additional conversion from PBM to PNG, I'd rather call convert
only once and do the full conversion in a single command.
Anyone know what parameters I might be missing in the calls to dcm2pnm
or ImageMagick's convert
to get the images looking as expected?
Edit: including a sample .dcm image: 000005.dcm
dctopgm8 000005.dcm 000005.pbm
andconvert 000005.pbm 000005.png
?dcmj2pnm
seems to provide what you're asking for?