With an indexed image, how do you make a specific color to be brighter by editing the colormap itself.
1 次查看(过去 30 天)
显示 更早的评论
With this line of code
% Load Atlas
% Relies on https://www.fieldtriptoolbox.org/template/atlas/ and
% https://github.com/fieldtrip/fieldtrip/tree/master/template/atlas and
% https://www.gin.cnrs.fr/en/tools/aal/
aalAtlas = ft_read_atlas('ROI_MNI_V4.nii');
BrainImage = ones(91, 109,'int8')
%help Image;
BrainImage(:,:) = aalAtlas.tissue(:, :, 50) %the tissue is part of the 3D BrainImage of the Atlas that looks at tissue
%BrainImage
%put it in a for loop to display each sect ion
for slice = 1:91
BrainImage(:,:) = aalAtlas.tissue(:, :, slice);
regions = ismember(BrainImage, [50,46,64]);
ColorBrainImage = ind2rgb(BrainImage, colorcube);
% Make those 3 regions a value brighter.
ColorBrainImage(regions) = uint8(5 * double(ColorBrainImage(regions))); %double allows to multipy with decimals and uint brings it back to whole number
BBrainImage = imresize(ColorBrainImage,10);
imshow(BBrainImage)
end
I am able to load a brain atlas that goes through the slices of the brain with the labelled respective regions. I have been able to highlight portions of the brain that I want, such as 50, 46, and 64. I can see these regions highlighted when I use different colormaps such as "copper," which is very easy to see the difference because it is in red compared to the rest of the image being shades of green. My issue is that I want to use the colorcube colormap because it is very easy to tell the portions of the brain labelled on the brain atlas I have apart, but since all the colors are already so bright, I can never tell which region is highlighted. Is there a way where I can possilbe make the colorcube colormap dimmer itself and then be able to see the highlighted regions I choose to be brighter?
0 个评论
采纳的回答
Image Analyst
2022-7-4
To replace your colors for 50, 46, and 64 with the colors from the copper colormap, do this, where cmap is your main colormap
% Create a copper colormap with same size as main existing colormap.
copperMap = copper(size(cmap, 1));
% Replace color for gray level 50, which happens at row 51 of the colormap, with the color from copper.
cmap(51, :) = copperMap(51, :);
% Replace color for gray level 46, which happens at row 47 of the colormap, with the color from copper.
cmap(47, :) = copperMap(47, :);
% Replace color for gray level 64, which happens at row 65 of the colormap, with the color from copper.
cmap(65, :) = copperMap(65, :);
I think this should also work
rows = [51, 47, 65];
cmap(rows, :) = copperMap(rows, :);
4 个评论
Stephen23
2022-7-5
编辑:Image Analyst
2022-7-5
@Alexandar: then change those rows of the colormap, just as Image Analyst showed you.
You might also like to try this: https://www.mathworks.com/help/matlab/ref/colormapeditor.html
or label2rgb
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Red 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!