How to overlay two colormaps using imagesc command?

73 ビュー (過去 30 日間)
Taoooooooooooo
Taoooooooooooo 2019 年 8 月 8 日
回答済み: Abhilash Padma 2019 年 8 月 12 日
I want to overlay two colormaps in a single figure. The background image A is an anatomical image and B is the ROI I would like to place on the anatomical image A. Color A was using gray and Color B was using hot. However, when I used the code I attachec below, image A and B became the same size and completely overlayed themselves. I am not sure why this is happening. Please help.
Attached is my code:
ax1 = axes;
colormap(ax1,'gray');
A = imagesc([0,1600],[-130005,10000],fliplr(Image));
%create a mask B with spectral peak values;
ax2 = axes;
colormap(ax2,'hot');
B = imagesc([437.5,962.5],[-73500,-45000],mask); %define the minimal/maximal range of the mask;
set(ax2,'color','none','visible','off');

採用された回答

Abhilash Padma
Abhilash Padma 2019 年 8 月 12 日
The ROI is overlaid completely in your case because the limits of the 2-D axes are not synchronized properly. You can use linkaxes method to synchronize limits of 2-D axes which may solve your problem. Here is the example below:
I=imread('mri.jpg');
mask=rgb2gray(imread('roi.jpg'));
ax1 = axes;
A = imagesc([0,1600],[-130005,10000],I);
ax2 = axes;
B = imagesc([437.5,962.5],[-73500,-45000],mask);
linkaxes([ax1,ax2]);
ax2.Visible = 'off';
ax2.XTick = [];
ax2.YTick = [];
colormap(ax1,'gray');
colormap(ax2,'hot');
set(ax2,'color','none','visible','off');

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeBlue についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by