With an indexed image, how do you make a specific color to be brighter by editing the colormap itself.
1 view (last 30 days)
Show older comments
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 Comments
Accepted Answer
Image Analyst
on 4 Jul 2022
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 Comments
Stephen23
on 5 Jul 2022
Edited: Image Analyst
on 5 Jul 2022
@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
More Answers (0)
See Also
Categories
Find more on Red in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!