With an indexed image, how do you make a specific color to be brighter by editing the colormap itself.

1 Ansicht (letzte 30 Tage)
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?

Akzeptierte Antwort

Image Analyst
Image Analyst am 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 Kommentare
Alexandar
Alexandar am 4 Jul. 2022
For example, I have regions like this on my command window that show the image of the atlas I load up:
Columns 64 through 84
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
58 2 2 2 2 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
2 2 2 2 2 2 2 12 12 12 0 0 0 0 0 0 0 0 0 0 0
2 2 2 2 2 2 12 12 12 12 12 12 0 0 0 0 0 0 0 0 0
2 2 2 2 2 12 12 12 12 12 12 12 14 14 14 14 0 0 0 0 0
2 2 2 2 2 12 12 12 12 12 12 12 14 14 14 14 14 0 0 0 0
2 2 2 2 12 12 12 12 12 12 12 14 14 14 14 14 14 14 0 0 0
2 2 2 2 12 12 12 12 12 12 12 14 14 14 14 14 14 14 14 14 0
2 2 2 12 12 12 12 12 12 12 12 14 14 14 14 14 14 14 14 14 0
2 2 2 12 12 12 12 12 12 12 14 14 14 14 14 14 14 14 14 14 8
2 2 12 12 12 12 12 12 12 12 14 14 14 14 14 14 14 14 14 14 8
0 2 2 12 12 12 12 12 12 12 14 14 14 14 14 14 14 14 14 14 8
0 2 12 12 12 12 12 12 12 14 14 14 14 14 14 14 14 14 14 14 8
0 12 12 12 12 12 12 12 14 14 14 14 14 14 14 14 14 14 14 8 8
0 12 12 12 12 12 12 12 14 14 14 14 14 14 14 14 14 14 8 8 8
0 12 12 12 12 12 12 12 14 14 14 14 14 14 14 14 14 14 8 8 8
0 0 0 0 0 0 0 12 14 14 14 14 14 14 14 14 14 8 8 8 8
0 0 0 0 0 0 0 14 14 14 14 14 14 14 14 14 14 8 8 8 8
0 0 0 0 0 0 0 14 14 14 14 14 14 14 14 14 8 8 8 8 8
0 0 0 0 0 0 0 14 14 0 0 0 0 14 14 0 8 8 8 8 8
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 8 8 8
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 8 8
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8 8
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 8
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 4
0 0 0 0 0 0 0 0 0 0 0 0 0 0 32 32 32 32 32 0 4
0 0 0 0 0 0 0 0 0 0 0 32 32 32 32 32 32 32 32 32 4
0 0 0 0 0 0 0 0 0 0 0 32 32 32 32 32 32 32 32 32 4
0 0 0 0 0 0 0 0 0 32 32 32 32 32 32 32 32 32 32 32 32
0 0 0 0 0 0 0 32 32 32 32 32 32 32 32 32 32 32 32 32 32
0 0 0 0 0 0 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
0 0 0 0 0 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32 32
0 0 0 0 32 32 32 32 32 32 32 32 32 32 32 32 31 31 31 31 31
0 0 0 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31
0 0 0 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31
0 0 0 0 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31
0 0 0 0 0 31 31 31 31 31 31 31 31 31 31 31 31 31 31 31 23
0 0 0 0 0 0 0 31 31 31 31 31 31 31 31 31 31 31 31 31 23
0 0 0 0 0 0 0 0 0 0 0 0 0 31 31 31 31 31 31 23 23
0 0 0 0 0 0 0 0 0 0 0 0 0 0 31 31 31 31 23 23 23
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 31 23 23 23 23
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 7 7
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 7 7
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 3 3 7 7
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 7 7 7 7
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 7 7 7 7
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 7 7 7 7
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 7 7 7 7 7 7
0 0 0 0 0 0 0 0 0 0 0 0 0 7 13 13 7 7 7 7 7
0 0 11 11 11 13 13 11 11 0 0 13 13 13 13 13 13 13 7 7 7
0 11 11 11 11 13 13 13 13 13 13 13 13 13 13 13 13 13 13 7 7
1 11 11 11 11 13 13 13 13 13 13 13 13 13 13 13 13 13 13 7 7
1 11 11 11 11 13 13 13 13 13 13 13 13 13 13 13 13 13 13 7 7
1 1 11 11 11 13 13 13 13 13 13 13 13 13 13 13 13 13 13 7 7
1 1 11 11 11 11 13 13 13 13 13 13 13 13 13 13 13 13 13 7 7
1 1 11 11 11 11 13 13 13 13 13 13 13 13 13 13 13 13 13 7 7
1 1 1 11 11 11 13 13 13 13 13 13 13 13 13 13 13 13 13 0 0
1 1 1 1 11 11 11 13 13 13 13 13 13 13 13 13 13 13 13 0 0
1 1 1 1 11 11 11 13 13 13 13 13 13 13 13 13 13 13 13 0 0
1 1 1 1 1 11 11 11 13 13 13 13 13 13 13 13 13 0 0 0 0
1 1 1 1 1 11 11 11 11 13 13 13 13 13 13 0 0 0 0 0 0
1 1 1 1 1 11 11 11 11 13 13 13 13 13 0 0 0 0 0 0 0
1 1 1 1 1 11 11 11 11 13 13 0 0 0 0 0 0 0 0 0 0
57 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
57 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
Each region corresponds to a location of the brain. So for that region, I want to make it brighter than the rest. But it is hard to see when I use the colorcube colormap.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Produkte


Version

R2022a

Community Treasure Hunt

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

Start Hunting!

Translated by