Hello,
I have a series of DICOM images to be pre-processed using Imagemagick. However, the resulting images are simply too bright with physiological features totally washed out- not only in Imagemagick but also in OsiriX DICOM viewer (http://www.osirix-viewer.com).
Sample image as it would appear in both Imagemagick and OsiriX:
http://dl.dropbox.com/u/18739750/DICOM- ... phic-6.png
Same file with tweaked WW and WL values using OsiriX:
http://dl.dropbox.com/u/18739750/DICOM- ... phic-7.png
So, is there a way to adjust WW and WL values using Imagemagick to obtain similar output as in the tweaked image above? As you can imagine, tweaking each image via GUI is not acceptable.
Thank you,
MT
Too bright DICOM images
Too bright DICOM images
Last edited by labi on 2011-10-31T19:41:41-07:00, edited 2 times in total.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Too bright DICOM images
What was your exact command? What version of IM and platform are you using? Can you provide a link to your original DICOM file so others can test with it.
Re: Too bright DICOM images
Oh, of course. Sorry. Here is the .dcm file:
http://dl.dropbox.com/u/18739750/DICOM- ... 0.0002.dcm
Its corresponding slice file (do not really know what this is but it may contain useful information - it is located in the "image" directory while the dcm file is located in the "dicom" directory - both under the same directory subtree (representing different scans - each directory contains 512 slices):
http://dl.dropbox.com/u/18739750/DICOM- ... slice.0002
There is a corresponding .xxm file in the "image" directory:
http://dl.dropbox.com/u/18739750/DICOM- ... 9_2011.xxm
I used convert slice.0000.0002.dcm slice.0000.0002.jpg command to convert the dcm file into a jpg.
Version:
Version: ImageMagick 6.7.3-0 2011-10-11 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
Thank you,
MT
http://dl.dropbox.com/u/18739750/DICOM- ... 0.0002.dcm
Its corresponding slice file (do not really know what this is but it may contain useful information - it is located in the "image" directory while the dcm file is located in the "dicom" directory - both under the same directory subtree (representing different scans - each directory contains 512 slices):
http://dl.dropbox.com/u/18739750/DICOM- ... slice.0002
There is a corresponding .xxm file in the "image" directory:
http://dl.dropbox.com/u/18739750/DICOM- ... 9_2011.xxm
I used convert slice.0000.0002.dcm slice.0000.0002.jpg command to convert the dcm file into a jpg.
Version:
Version: ImageMagick 6.7.3-0 2011-10-11 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2011 ImageMagick Studio LLC
Features: OpenMP
Thank you,
MT
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Too bright DICOM images
I am no expert on DICOM files, so this will likely have to wait for the IM developers to review. But I get the same displayed image as your bad one above in IM. When I try to view it in GIMP, I get the following error message "'slice.0000.0002.dcm' has a bpp of 4096 which GIMP cannot handle.". On my Mac, using GraphicConverter, I also get the same result. Photoshop won't even open it. I am on IM 6.7.3.2 Q16 Mac OSX Tiger.
Perhaps the software that is creating these files needs to use some other option to make the file so that most DICOM readers will read it properly.
Perhaps the software that is creating these files needs to use some other option to make the file so that most DICOM readers will read it properly.
Re: Too bright DICOM images
Disable the display range and apply a custom contrast enhancement. Try contrast stretch or normalization:
- convert -define dcm:display-range=reset slice.0000.0002.dcm -normalize slice.0000.0002.png
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Too bright DICOM images
magick wrote:Disable the display range and apply a custom contrast enhancement. Try contrast stretch or normalization:
- convert -define dcm:display-range=reset slice.0000.0002.dcm -normalize slice.0000.0002.png
If that works, you can try -auto-level in place of -normalize so that you don't get any clipping. If you want clipping, then use -normalize or -contrast-stretch XX% or just -level blackpt,whitept{%}
convert -define dcm:display-range=reset slice.0000.0002.dcm -auto-level slice.0000.0002.png
This looks pretty good to me, but you may not want so much contrast, so you can use -level or -brightness-contrast to adjust as desired.
_____________________
Magick,
Thanks for the pointer to -define at http://www.imagemagick.org/script/comma ... php#define
That seems to be a useful list. Learned something new today.
Re: Too bright DICOM images
Hello all,
Thank you all for helping me solve this issue. Much appreciated. Works like a charm!
Thank you all for helping me solve this issue. Much appreciated. Works like a charm!
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Too bright DICOM images
Note that the list is incomplete. For example these are some I know that are missing from the list.fmw42 wrote:magick wrote:Magick,
Thanks for the pointer to -define at http://www.imagemagick.org/script/comma ... php#define
That seems to be a useful list. Learned something new today.
- compose:outside-overlay (see -compose copy for details)
- morphology:compose (for multi-kernel morphology, such as used for '2-pass blurs' and skeletion thinning.
- filter:blur, filter:support and many other special filter expert settings
- jpeg:preserve-settings jpeg:optimize-coding and other coder options
This is the point of the freeform defines. providing an easy method of adding many settings and options to IM without needing to continually expand the API's especially as for special or rarely used settings.
There are also defines and settings that are created by some operators as extra information, such as the final pointsize and string used when you create a label: (See the 'expert' notes in Label - Simple Text Label) and there use demonstrated in Set and Per-Image Properties.
All of these things I am looking at closely at the moment in IMv7 development, looking for ways of better handling and using them. For example I am looking for better handling of per-image settings and defines (for better layering (compose) and posibly multi-image distorts (viewport) of images). Stay tuned!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/