Filter löschen
Filter löschen

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

4 Ansichten (letzte 30 Tage)
bazinga
bazinga am 19 Jan. 2014
Kommentiert: bazinga am 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

Antworten (1)

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

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Modify Image Colors finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by