-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdraw_locationsBrain.m
executable file
·52 lines (49 loc) · 2.08 KB
/
draw_locationsBrain.m
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
function [ax, obj] = draw_locationsBrain(ax, nodeLocations, nodeNames, data, markersize, fontsize, slice)
% draw_locationsBrain.m
%
% Draw a plot of brain nodes with their names overlayed for
% a particular view slice
%
% Inputs: ax : axis handle to plot on
% nodeLocations : 3D locations of the nodes [Nx3]
% nodeNames : anatomical names of the nodes [Nx1 string]
% data : data used to color the nodes [Nx1]
% markersize : uniform size of the nodes (float)
% fontsize : uniform size of overlayed node names (float)
% slice : view slice (string)
% 'axial', 'sagittal_left', 'sagittal_right',
% 'coronal'
% Outputs: ax : redefine initial axis handle
% obj : object handle of the scatter plot
%
% Original: James Pang, QIMR Berghofer, 2019
%%
if nargin<7
slice = 'axial';
end
if nargin<6
fontsize = 8;
end
if nargin<5
markersize = 40;
end
if strcmpi(slice, 'axial')
x = nodeLocations(:,1); y = nodeLocations(:,2); z = nodeLocations(:,3);
obj = scatter3(ax, x, y, z, markersize, data, 'filled');
text(ax, x, y, z, nodeNames, 'fontsize', fontsize, 'interpreter', 'none')
elseif strcmpi(slice, 'sagittal_left')
x = -nodeLocations(:,2); y = nodeLocations(:,3); z = -nodeLocations(:,1);
obj = scatter3(ax, x, y, z, markersize, data, 'filled');
text(ax, x, y, z, nodeNames, 'fontsize', fontsize, 'interpreter', 'none')
elseif strcmpi(slice, 'sagittal_right')
x = nodeLocations(:,2); y = nodeLocations(:,3); z = nodeLocations(:,1);
obj = scatter3(ax, x, y, z, markersize, data, 'filled');
text(ax, x, y, z, nodeNames, 'fontsize', fontsize, 'interpreter', 'none')
elseif strcmpi(slice, 'coronal')
x = nodeLocations(:,1); y = nodeLocations(:,3); z = -nodeLocations(:,2);
obj = scatter3(ax, x, y, z, markersize, data, 'filled');
text(ax, x, y, z, nodeNames, 'fontsize', fontsize, 'interpreter', 'none')
end
view(ax, 2)
axis(ax, 'equal')
set(ax, 'visible', 'off')