-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexample02_MNIchannels.m
More file actions
33 lines (23 loc) · 1.17 KB
/
Copy pathexample02_MNIchannels.m
File metadata and controls
33 lines (23 loc) · 1.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
% EXAMPLE02_MNICHANNELS - Plot MNI channel coordinates from two subjects.
% Loads channel coordinates from CSV files, displays them on a brain
% template with different colors per subject, and adds a legend.
clear;
% add the src folder to the MATLAB path
srcPath = fullfile(fileparts(mfilename('fullpath')), '..', 'src');
addpath(srcPath);
% -- paths
dataDir = fullfile(fileparts(mfilename('fullpath')), '..', 'data');
volumePath = fullfile(dataDir, 'YeoAtlas', 'Yeo2011_7Networks_MNI152_FreeSurferConformed1mm.nii');
% -- load atlas
[volumeMNI, ~] = brainatlas.importAtlasVolume(volumePath);
% -- load subject channel MNI coordinates
chTable1 = readtable(fullfile(fileparts(mfilename('fullpath')), 'channels_sub01.csv'));
chTable2 = readtable(fullfile(fileparts(mfilename('fullpath')), 'channels_sub02.csv'));
channels1 = [chTable1.MNI_X, chTable1.MNI_Y, chTable1.MNI_Z];
channels2 = [chTable2.MNI_X, chTable2.MNI_Y, chTable2.MNI_Z];
% -- plot
hfig = figure;
hfig.Position(3:end) = [720, 320];
brainvis.MNIplot(hfig, volumeMNI, {channels1, channels2}, {'r', 'b'}, ...
figTitle="Channels MNI coordinates", markerSize=6);
brainvis.addLegend({'subject 1', 'subject 2'}, {'r', 'b'});