仅着色特定像素 [英] Coloring only specific pixels
问题描述
我有一个表示大脑图像的矩阵,每个(i,j)位置的值介于0和1之间。我正在应用颜色贴图,因此值为1的像素为红色,0为黄色,在中间获取中间价值。现在,我想要的是那些值大于0.8的像素根据色彩图获得颜色,其余变得透明(即它们没有得到任何颜色),这样我就可以用另一个大脑图像覆盖这个图像并识别高活动区域。我怎么做?
I have a matrix representing an image of brain with each (i,j) position having a value between 0 and 1. I am applying a color map, so that those pixels with value 1 are red and 0 are yellow, those in between get intermediary values. Now, what i want is that those pixels having values above 0.8 get color according to colormap and rest become trasparent(that is they dont get any color), so that i can overlay this image with the another image of brain and identify high activity region. How do i do this ?
我有这样的图像
i have images like this
我只想要亮黄色的部分,这样我就可以将它与其他图像叠加在一起并得到类似的东西。
I want only the bright yellow part, so that i can overlay it with other image and get something like this.
编辑:
我按照Jigg建议的方法,但最近观察到最终图像被旋转和反转,任何想法为什么?
I followed the method suggested by Jigg, but recently observed that the final image was rotated and inverted , any idea why ?
推荐答案
这是另一种选择,创建一个复制灰度脑图像的3层阵列( imagesc
将按比例缩放每一层,得到相等的r,g和b值 - >灰度级。)
Here is another option, create a 3-layers array replicating your grayscale brain image (imagesc
will scale each layer similarly resulting in equal r, g, and b values -> levels of gray).
GrayBckgnd = repmat(brain, [1, 1, 3]);
data = …
然后用活动数据覆盖它:
Then overlay it with the activity data:
imagesc(GrayBcknd);
hold on;
DataImg = imagesc(data);
set(DataImg, 'AlphaData', im2double(data>0.8));
colormap jet; % or any other colormap.
这篇关于仅着色特定像素的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!