how to display an image's colormap onto its grayscale map?

5 views (last 30 days)
Hi everyone,
I have biomedical images (.dcm) and I need to display the colormap of each image onto its grayscale map. I.e:
Let's say my image is named as X, and Y is a processed version of X 1) imshow(X); //grayscale 2) image(Y); //colormap
These two resulting figures on top of each other.
Any suggestion would help. Thanks

Answers (1)

Image Analyst
Image Analyst on 20 Jan 2014
Applying a colormap to one grayscale image will apply it to all grayscale images in all axes in the figure. Since that is usually not what you want, you can call freezecolors but it's probably easiest just to convert the grayscale image that you want to apply a colormap to, into a color image with ind2rgb():
imshow(X); % Show first gray scale image.
rgbImage = ind2rgb(Y, yourColorMap); % Convert second gray scale image into a color image.
imshow(rgbImage); % Display the color image.
  11 Comments
Walter Roberson
Walter Roberson on 30 Jan 2014
tempImage = zeros(size(original), 'like', original);
Note: you could also use this code with no loop
tempImage = original;
tempImage(original <= threshold2 | original >= threshold) = 0;
bazinga
bazinga on 30 Jan 2014
Oh, thank you for the shortcut :)
Yet I still get the white screen. Do you have any solution to this?

Sign in to comment.

Categories

Find more on Modify Image Colors in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!