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

4 vues (au cours des 30 derniers jours)
bazinga
bazinga le 19 Jan 2014
Commenté : bazinga le 30 Jan 2014
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

Réponses (1)

Image Analyst
Image Analyst le 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 commentaires
Walter Roberson
Walter Roberson le 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 le 30 Jan 2014
Oh, thank you for the shortcut :)
Yet I still get the white screen. Do you have any solution to this?

Connectez-vous pour commenter.

Catégories

En savoir plus sur Modify Image Colors dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by