Skip to main content
Tweeted twitter.com/super_user/status/1207994200429617152
explain why the images look wrong
Source Link
Stéphane
  • 351
  • 3
  • 9

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:

pbm file

The .pnm looks like this, which is not quite an inverse image, but somehow looks wrong:

pnm file

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...?

png file

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

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:

pbm file

The .pnm looks like this:

pnm file

And both of the .png conversions look like this:

png file

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

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:

pbm file

The .pnm looks like this, which is not quite an inverse image, but somehow looks wrong:

pnm file

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...?

png file

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

added 113 characters in body
Source Link
Stéphane
  • 351
  • 3
  • 9

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:

pbm file

The .pnm looks like this:

pnm file

And both of the .png conversions look like this:

png file

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

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:

pbm file

The .pnm looks like this:

pnm file

And both of the .png conversions look like this:

png file

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?

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:

pbm file

The .pnm looks like this:

pnm file

And both of the .png conversions look like this:

png file

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

Source Link
Stéphane
  • 351
  • 3
  • 9

How to convert DICOM images to PNG?

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:

pbm file

The .pnm looks like this:

pnm file

And both of the .png conversions look like this:

png file

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?