Creating a user interface that lets you choose which areas of atlas to be bright

4 views (last 30 days)
Alexandar
Alexandar on 4 Jul 2022
Commented: Kevin Holly on 5 Jul 2022
I want to make a user interface that lets you choose which areas of the atlas brain regions to be bright. I want to be able to choose more than one area. I am unsure on what to do on the app designer portion of my code to create this. If my question is not clear enough then please let me know if further elaboration is needed. I am having trouble trying to start this off and have been playing with the design of my app too.
% Button pushed function: BrainAtlasButton
function LoadAtlas(app, event)
% 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, copper);
% 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
This is a portion of the command window when I click the buttons that loads the "Brain Atlas" button.
BrainImage =
91×109 int8 matrix
Columns 1 through 21
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
0 0 0 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0 0 0 0 0 50 50 50 50 50
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 50 50 50 50
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 50 50 50 50
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 50 50 50 50 50
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 50 50 50 50 50
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 50 50 50 50 46
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 50 50 46 46 46
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 50 46 46 46 46 46
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 46 46 46 46 46
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 46 46 46 46 46
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 46 46 46 46
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 46 46 46 46
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45 45 45
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45 45 45 45 45
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45 45 45 45 45 45
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 45 45 45 45 45 45
0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 45 45 45 45 45 45
0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 45 45 45 45 45 45
0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 45 45 45 45 45 45
0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 45 45 45 45 45 45
0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 45 45 45 45 45 45
0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 49 49 49 49 49 49
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 49 49 49 49 49
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 49 49 49 49 49
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 49 49 49 49 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0 0 0 0 0 0 66 66 64 64 64 64
0 0 0 0 0 0 0 0 0 0 0 0 0 66 66 66 66 64 64 64 64
0 0 0 0 0 0 0 0 0 0 0 0 66 66 66 66 66 64 64 64 64
0 0 0 0 0 0 0 0 0 0 66 66 66 66 66 66 66 64 64 64 64
0 0 0 0 0 0 0 0 52 66 66 66 66 66 66 66 66 66 64 64 64
0 0 0 0 0 0 52 52 52 66 66 66 66 66 66 66 66 66 64 64 64
0 0 0 0 52 52 52 52 52 66 66 66 66 66 66 66 66 66 64 64 64
0 0 0 0 52 52 52 52 52 66 66 66 66 66 66 66 66 66 66 64 64
0 0 0 52 52 52 52 52 52 52 66 66 66 66 66 66 66 66 66 66 64
0 52 52 52 52 52 52 52 52 52 52 66 66 66 66 66 66 66 66 66 0
52 52 52 52 52 52 52 52 52 52 52 66 66 66 66 66 66 66 66 66 0
52 52 52 52 52 52 52 52 52 52 52 0 66 66 66 66 66 66 66 0 0
52 52 52 52 52 52 52 52 52 52 0 0 0 66 66 66 66 66 0 0 0
52 52 52 52 52 52 52 52 52 52 0 0 0 0 0 66 66 0 0 0 0
52 52 52 52 52 52 52 52 52 0 0 0 0 0 0 0 0 0 0 0 0
52 52 52 52 52 52 52 52 52 0 0 0 0 0 0 0 0 0 0 0 0
52 52 52 52 52 52 52 52 52 52 0 0 0 0 0 0 0 0 0 0 0
50 52 52 52 52 52 52 52 52 52 0 0 0 0 0 0 0 0 0 0 0
50 50 52 52 52 52 50 50 50 50 50 0 0 0 0 0 0 0 0 0 0
50 50 50 50 50 50 50 50 50 50 50 46 68 68 68 0 0 0 0 0 0
50 50 50 50 50 50 50 50 46 46 46 68 68 68 68 0 0 0 0 0 0
50 50 50 50 50 46 46 46 46 46 68 68 68 68 68 0 0 0 0 0 0
50 50 46 46 46 46 46 46 46 46 68 68 68 68 68 0 0 0 0 0 0
46 46 46 46 46 46 46 46 46 68 68 68 68 68 68 0 0 0 0 0 0
46 46 46 46 46 46 46 46 68 68 68 68 68 68 68 0 0 0 0 0 0
46 46 46 46 46 46 46 46 68 68 68 68 68 68 68 68 0 0 36 0 0
46 46 46 46 46 46 46 46 46 68 68 68 68 68 68 68 68 68 36 36 36
46 46 46 46 46 46 46 46 46 68 68 68 68 68 68 68 68 68 36 36 36
46 46 46 46 46 46 46 46 46 68 68 68 68 68 68 68 68 68 36 36 36
46 46 46 46 46 46 46 46 68 68 68 68 68 68 68 68 68 68 36 36 36
45 45 46 46 46 46 46 68 68 68 68 68 68 68 68 68 68 36 36 36 36
45 45 45 45 45 45 45 45 45 67 67 67 67 67 68 68 68 36 36 36 36
45 45 45 45 45 45 45 45 45 67 67 67 67 67 67 35 35 35 35 35 35
45 45 45 45 45 45 45 45 45 67 67 67 67 67 67 35 35 35 35 35 35
45 45 45 45 45 45 45 45 45 45 67 67 67 67 67 67 35 35 35 35 35
45 45 45 45 45 45 45 45 45 45 45 67 67 67 67 67 35 35 35 35 35
45 45 45 45 45 45 45 45 45 45 45 45 67 67 67 67 67 35 35 35 35
45 45 45 45 45 45 45 45 45 45 45 45 45 67 67 67 67 35 35 35 35
45 45 45 45 45 45 45 45 45 45 45 45 45 45 67 67 67 67 0 0 0
49 49 49 49 45 45 45 45 45 45 45 45 45 45 67 67 0 0 0 0 0
49 49 49 49 49 49 49 49 49 49 45 45 45 45 45 67 0 0 0 0 0
49 49 49 49 49 49 49 49 49 49 49 45 45 45 45 0 0 0 0 0 0
49 49 49 49 49 49 49 49 49 49 49 49 45 45 45 0 0 0 0 0 0
49 49 49 49 49 49 49 49 49 49 49 49 0 0 0 0 0 0 0 0 0
51 49 49 49 49 51 51 49 49 49 0 0 0 0 0 0 0 0 0 0 0
51 51 51 51 51 51 51 51 0 0 0 0 0 0 0 0 0 0 0 0 0
51 51 51 51 51 51 51 51 0 0 0 0 0 0 0 0 0 0 0 0 0
51 51 51 51 51 51 51 51 0 0 0 0 0 0 0 0 0 0 0 0 0
51 51 51 51 51 51 51 51 0 0 0 0 0 0 0 0 0 0 0 0 0
51 51 51 51 51 51 51 51 51 0 0 0 0 0 0 0 0 0 0 0 0
51 51 51 51 51 51 51 51 51 0 0 0 0 0 0 0 0 0 0 0 0
51 51 51 51 51 51 51 51 51 51 65 65 0 65 65 65 0 0 0 0 0
51 51 51 51 51 51 51 51 65 65 65 65 65 65 65 65 65 0 0 0 0
51 51 51 51 51 51 51 65 65 65 65 65 65 65 65 65 65 0 0 0 0
51 51 51 51 51 51 65 65 65 65 65 65 65 65 65 65 65 65 63 63 63
0 0 51 51 65 65 65 65 65 65 65 65 65 65 65 65 65 65 63 63 63
0 0 0 0 65 65 65 65 65 65 65 65 65 65 65 65 65 63 63 63 63
0 0 0 0 0 0 65 65 65 65 65 65 65 65 65 65 65 63 63 63 63
0 0 0 0 0 0 0 65 65 65 65 65 65 65 65 65 63 63 63 63 63
0 0 0 0 0 0 0 0 65 65 65 65 65 65 65 63 63 63 63 63 63
0 0 0 0 0 0 0 0 0 65 65 65 65 65 65 63 63 63 63 63 63
0 0 0 0 0 0 0 0 0 0 0 65 65 65 63 63 63 63 63 63 63
0 0 0 0 0 0 0 0 0 0 0 0 0 65 63 63 63 63 63 63 63
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 63 63 63 63 63 63
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 63 63 63 63
  2 Comments

Sign in to comment.

Accepted Answer

Kevin Holly
Kevin Holly on 5 Jul 2022
Alexandar,
I had a little fun and made you an app to help you get started. Please see the app attached. Load the ROI_MNI_V4.nii and label text file with the respective putton buttons. Examine the code and let me know if you have any questions. I had the list box select the 3D ROI. You could do the same thing with the 2D slice view if you wanted to.
  2 Comments
Kevin Holly
Kevin Holly on 5 Jul 2022
Note, after placing the listbox component, I checked the box in the component browser under Interactivity making it multiselect.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!

Translated by