DICOM incorrectly converts background color
DICOM incorrectly converts background color
I have a number of DICOM files (see this one for an example) that I am converting to PNG format. These files have an alpha channel and a white background. The converted PNG files, on the other hand, have black backgrounds.
Using ImageMagick 6.6.9-6 2011-04-14 Q16, I simply ran "convert 4026778101315.DIC 4026778101315.PNG".
Then I did "identify.exe -verbose " on both files. The DICOM file was reported as having "Background color: white", and the PNG file "Background color: black".
Here is what the above DICOM file looks like. Notice the "TR" in the bottom right, along with the extra bright white tooth surfaces.
And this is what the corresponding PNG file looks like:
Please help. I've tried setting the background colour explicitly, but it has no effect on the resulting PNG image.
Using ImageMagick 6.6.9-6 2011-04-14 Q16, I simply ran "convert 4026778101315.DIC 4026778101315.PNG".
Then I did "identify.exe -verbose " on both files. The DICOM file was reported as having "Background color: white", and the PNG file "Background color: black".
Here is what the above DICOM file looks like. Notice the "TR" in the bottom right, along with the extra bright white tooth surfaces.
And this is what the corresponding PNG file looks like:
Please help. I've tried setting the background colour explicitly, but it has no effect on the resulting PNG image.
Re: DICOM incorrectly converts background color
The alpha channel seems to be gone before it gets to the
PNG encoder. Converting to TXT or MIFF format also yields an
opaque grayscale image. "identify -verbose *.DIC" says the input
file is opaque grayscale.
The reported background color indeed does change from
white to black, but that seems to be irrelevant. I'll look into
why that happened.
PNG encoder. Converting to TXT or MIFF format also yields an
opaque grayscale image. "identify -verbose *.DIC" says the input
file is opaque grayscale.
The reported background color indeed does change from
white to black, but that seems to be irrelevant. I'll look into
why that happened.
Re: DICOM incorrectly converts background color
Try this command:
- convert -define dcm:display-range=reset 4026778101315.DIC 4026778101315.doc
Re: DICOM incorrectly converts background color
The background color issue with PNG grayscale output is fixed in SVN revision 4344 (IM-6.6.9-7).
Re: DICOM incorrectly converts background color
Damn, you guys are quick!
I'll download and test it out.
Thanks muchly again.
I'll download and test it out.
Thanks muchly again.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: DICOM incorrectly converts background color
If you already have downloaded the SVN version, I suggest you get it again now.
I had a re-organisation of the CLI, as part of some steps for a new type of "convert"-like 'scripting' command (for the furture of IM v7 - name undecided) and it left the SVN beta version in a bad start (draw settings were failling). I learned from this made some backups (for future work) and backed out my change. Basically the change is too radical for IMv6 and it was a mistake to check in work toward that change at this time.
As such I suggest you 'update' or 'checkout' the SVN again now. --- Sorry
ASIDE...
AT this point in time I will be concentrating more on simle improvements and bug fixes, as I study 'shells' for programming methodology that may improve CLI and scripting capabilities of IM. IM really could use some more programmers. People who are willing to get go it and give it a try. It is amazing what you can do when you try.
FYI.. there is a new 'Inverse' sparse-color addition. See
http://www.imagemagick.org/Usage/canvas/#inverse
I had a re-organisation of the CLI, as part of some steps for a new type of "convert"-like 'scripting' command (for the furture of IM v7 - name undecided) and it left the SVN beta version in a bad start (draw settings were failling). I learned from this made some backups (for future work) and backed out my change. Basically the change is too radical for IMv6 and it was a mistake to check in work toward that change at this time.
As such I suggest you 'update' or 'checkout' the SVN again now. --- Sorry
ASIDE...
AT this point in time I will be concentrating more on simle improvements and bug fixes, as I study 'shells' for programming methodology that may improve CLI and scripting capabilities of IM. IM really could use some more programmers. People who are willing to get go it and give it a try. It is amazing what you can do when you try.
FYI.. there is a new 'Inverse' sparse-color addition. See
http://www.imagemagick.org/Usage/canvas/#inverse
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: DICOM incorrectly converts background color
Unfortunately, build 6.6.9-7 still produces the same incorrect result on the sample DICOM image (see the original post) :(
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: DICOM incorrectly converts background color
I just downloaded your original image and displayed it in IM 6.6.9.7 Q16 Mac OSX Tiger.
display 4026778101315.DIC
and it has the same dark pattern as your converted image. No other application that I have will even open it.
display 4026778101315.DIC
and it has the same dark pattern as your converted image. No other application that I have will even open it.
Re: DICOM incorrectly converts background color
ImageMagick's own display tool obviously has the same behaviour as the convert tool, since they use the same codec.
Try (X)MedCon instead. Sante DICOM Viewer and mDicom also display it correctly.
Try (X)MedCon instead. Sante DICOM Viewer and mDicom also display it correctly.
Re: DICOM incorrectly converts background color
ImageMagick can display / convert the image correctly. Simply add -define dcm:display-range=reset to you command line. Its required to reset the window width encoded within the image.
Re: DICOM incorrectly converts background color
Thanks. That did the trick.