-
Notifications
You must be signed in to change notification settings - Fork 2
/
draw_dbs_modules.m
65 lines (50 loc) · 2.06 KB
/
draw_dbs_modules.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
53
54
55
56
57
58
59
60
61
62
63
64
65
function draw_dbs_modules( modules, XYZ )
%DRAW_DBS_MODULES Plots axial view of nodes proportional to hub status
%
% Based on moduleViewer.m
%
% moduleViewer(modules, XYZ);
%
% Inputs: modules, integers corresponding to modules (column vector)
% XYZ, Euclidean co-ordinates
%
% Michael Hart, University of Cambridge, May 2017
%% Define & initialise
nNodes = size(modules, 1);
nModules = length(unique(modules)); %take out 0
%% Draw nodes
figure1 = figure('Name','modules', 'Units', 'Normalized', 'Position', [0.2 0.2 0.7 0.5]); %whole page
nodeSizes = ones(nNodes, 1)*3;
for iModule = 1:nModules %for each module, make a subplot
subplot_{iModule} = subplot(2, nModules, iModule, 'Parent', figure1);
hold(subplot_{iModule},'on');
Colours = zeros(nNodes, 1);
Colours(:,:) = 'b'; %everything else in blue
Colours(modules==iModule) = 'r'; %tumour in red
for iNode = 1:nNodes
plot(XYZ(iNode,1), XYZ(iNode,2),'or','MarkerSize', nodeSizes(iNode)*2, 'MarkerEdgeColor','k','MarkerFaceColor', char(Colours(iNode)));
end %end individual module loop
set(gca,'xaxislocation','top');
title({iModule});
xlabel({'anterior'});
ylabel({'lateral'});
set(gca,'visible','off');
set(findall(gca, 'type', 'text'), 'visible', 'on');
end %end plotting of all hubs
for iModule = 1:nModules %for each module, make a subplot
subplot_{iModule+nModules} = subplot(2, nModules, iModule+nModules, 'Parent', figure1);
hold(subplot_{iModule+nModules},'on');
Colours = zeros(nNodes, 1);
Colours(:) = 'b'; %everything else in blue
Colours(modules==iModule) = 'r'; %tumour in red
for iNode = 1:nNodes
plot(XYZ(iNode,2), XYZ(iNode,3),'or','MarkerSize', nodeSizes(iNode)*2, 'MarkerEdgeColor','k','MarkerFaceColor', char(Colours(iNode)));
end %end individual module loop
set(gca,'xaxislocation','top');
title({iModule});
xlabel({'superior'});
ylabel({'posterior'});
set(gca,'visible','off');
set(findall(gca, 'type', 'text'), 'visible', 'on');
end %end plotting of all hubs
end