Obtaining the maxvalue on a dicom colormap programatically

3 views (last 30 days)
while using
[dicom_data,color_map] = dicomread('dicomfile.dcm');
I get this as color_map:
[]
and running max(color_map) return the same.
If I examine the the image via the colormap editor I can find that the ColorDataMax is 3627 on one dicom image and 2627 on another.
new_colormap = gray(3627)
works fine on one image and
new_colormap = gray(2627)
on the other, but I want to expand the colormap programmatically without losing info, so I need to know what's the top gray value on each colormap.
How can I do this?

Accepted Answer

Image Analyst
Image Analyst on 3 Feb 2013
The max gray levels are 3627 and 2627. But I don't know what your plans are for new_colormap. You can't have more than 256 gray levels if you want to display the image and use a gray scale colormap.
  2 Comments
Antonio
Antonio on 4 Feb 2013
Edited: Antonio on 4 Feb 2013
Sorry, I may have phrased this ambiguously,I know the top levels are those, but I got them via the colormap editor. I want to know how to get them via the program, that means, without using the colormap editor.
Also, I don't understand what you say about the 256 gray levels. Using gray(256) as a colormap damages my image, but using gray(3627) does not (in the case of the image with that top intensity).
Image Analyst
Image Analyst on 4 Feb 2013
You can get the max and min this way:
minValue = min(dicom_data(:));
maxValue = max(dicom_data(:));
Depends on how you're displaying the image (like if you're using [] or not in imshow) -- but use whatever colormap works for you.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!