Skip to content

Commit fe93bfb

Browse files
committed
remove merge conflicts
2 parents aad8443 + 21cded7 commit fe93bfb

39 files changed

Lines changed: 1534 additions & 193 deletions

+nla/+gfx/+brain/BrainPlot.m

Lines changed: 511 additions & 0 deletions
Large diffs are not rendered by default.

+nla/+gfx/+chord/ChordPlot.m

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,9 @@
6363
addRequired(chord_input_parser, 'plot_matrix');
6464

6565
validColorMap = @(x) size(x, 2) == 3;
66-
addParameter(chord_input_parser, 'direction', nla.gfx.SigType.INCREASING, @isenum);
66+
addParameter(chord_input_parser, 'direction', "nla.gfx.SigType.INCREASING");
6767
addParameter(chord_input_parser, 'color_map', turbo(256), validColorMap);
68-
addParameter(chord_input_parser, 'chord_type', nla.PlotType.CHORD, @isenum);
68+
addParameter(chord_input_parser, 'chord_type', "nla.PlotType.CHORD");
6969
addParameter(chord_input_parser, 'upper_limit', 1, @isnumeric);
7070
addParameter(chord_input_parser, 'lower_limit', 0, @isnumeric);
7171
addParameter(chord_input_parser, 'random_z_order', false, @islogical);
@@ -99,7 +99,7 @@ function drawChords(obj)
9999

100100
function value = get.space_between_networks_and_labels(obj)
101101
value = 6;
102-
if obj.chord_type == nla.PlotType.CHORD
102+
if obj.chord_type == "nla.PlotType.CHORD"
103103
value = 3;
104104
end
105105
end
@@ -208,7 +208,7 @@ function createNetworkCircle(obj)
208208
import nla.TriMatrix nla.TriMatrixDiag
209209

210210
for network = 1:obj.number_of_networks
211-
if obj.chord_type == nla.PlotType.CHORD
211+
if obj.chord_type == "nla.PlotType.CHORD"
212212
network_start_radian = (network - 1) * obj.network_size_radians + (obj.space_between_networks_radians / 2);
213213
network_end_radian = (network * obj.network_size_radians) - (obj.space_between_networks_radians / 2);
214214
else
@@ -253,7 +253,7 @@ function rotateNetworkNames(obj, display_name, text_angle, text_position, networ
253253
% display_name - the display name for the network, usually some 3-4 letter abbreviation
254254
% text_angle - the angle the name should be displayed
255255
% text_position - where the name is displayed. A list or array of points
256-
if obj.chord_type == nla.PlotType.CHORD_EDGE && (obj.network_size_radians_array(network) < 0.25) &&...
256+
if obj.chord_type == "nla.PlotType.CHORD_EDGE" && (obj.network_size_radians_array(network) < 0.25) &&...
257257
(strlength(display_name) > 5)
258258

259259
if strlength(display_name) > 8
@@ -285,9 +285,9 @@ function connectNetworks(obj)
285285
% Sort the chords
286286
if obj.random_z_order
287287
plot_network_indexes = randperm(numel(obj.plot_matrix.v));
288-
elseif obj.direction == SigType.INCREASING
288+
elseif obj.direction == "nla.gfx.SigType.INCREASING"
289289
[~, plot_network_indexes] = sort(obj.plot_matrix.v);
290-
elseif obj.direction == SigType.DECREASING
290+
elseif obj.direction == "nla.gfx.SigType.DECREASING"
291291
[~, plot_network_indexes] = sort(obj.plot_matrix.v, 'descend');
292292
else
293293
[~, plot_network_indexes] = sort(abs(obj.plot_matrix.v));
@@ -296,7 +296,7 @@ function connectNetworks(obj)
296296
% boolean array used to determine if networks connected
297297
networks_connected = false(obj.number_of_networks, obj.number_of_networks + 1);
298298

299-
if obj.chord_type == nla.PlotType.CHORD
299+
if obj.chord_type == "nla.PlotType.CHORD"
300300
% These two arrays are the networks individucally numbered. Taking the same index of both
301301
% (in vector, network_array.v(idx)) gives the two networks we're testing
302302
network_array = TriMatrix(obj.number_of_networks, 'double', TriMatrixDiag.KEEP_DIAGONAL);
@@ -314,7 +314,7 @@ function connectNetworks(obj)
314314
end
315315

316316
for network = 1:obj.number_of_networks
317-
if obj.chord_type == nla.PlotType.CHORD
317+
if obj.chord_type == "nla.PlotType.CHORD"
318318
% These fill in the four networks above.
319319
for network2 = network:obj.number_of_networks
320320
network_index = find(networks_connected(network, :) == 0, 1, 'last');
@@ -343,9 +343,9 @@ function connectNetworks(obj)
343343
for index_iterator = 1:numel(obj.plot_matrix.v)
344344
index = plot_network_indexes(index_iterator);
345345
if ~isnan(obj.plot_matrix.v(index)) && (...
346-
(obj.direction == SigType.INCREASING && obj.plot_matrix.v(index) > obj.lower_limit) ||...
347-
(obj.direction == SigType.DECREASING && obj.plot_matrix.v(index) < obj.upper_limit) ||...
348-
(obj.direction == SigType.ABS_INCREASING && abs(obj.plot_matrix.v(index)) > 0))
346+
(obj.direction == "nla.gfx.SigType.INCREASING" && obj.plot_matrix.v(index) > obj.lower_limit) ||...
347+
(obj.direction == "nla.gfx.SigType.DECREASING" && obj.plot_matrix.v(index) < obj.upper_limit) ||...
348+
(obj.direction == "nla.gfx.SigType.ABS_INCREASING" && abs(obj.plot_matrix.v(index)) > 0))
349349
current_network = obj.plot_matrix.v(index);
350350
network_color = nla.gfx.valToColor(current_network, obj.lower_limit, obj.upper_limit, obj.color_map);
351351

@@ -354,7 +354,7 @@ function connectNetworks(obj)
354354
network_alpha = 0.5;
355355
end
356356

357-
if obj.chord_type == nla.PlotType.CHORD
357+
if obj.chord_type == "nla.PlotType.CHORD"
358358
network = network_array.v(index);
359359
network2 = network2_array.v(index);
360360
network_index = network_indexes.v(index);
@@ -425,7 +425,7 @@ function connectNetworks(obj)
425425
end
426426
end
427427

428-
if obj.chord_type == nla.PlotType.CHORD_EDGE
428+
if obj.chord_type == "nla.PlotType.CHORD_EDGE"
429429
% This is the inner circle of dots for the rois on the edge chord circle
430430
for roi = 1:obj.number_of_ROIs
431431
plot(obj.axes, ROI_centers(roi, 1), ROI_centers(roi, 2), '.k', 'MarkerSize', 3);

+nla/+gfx/+plots/DiagnosticPlot.m

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,23 +24,23 @@
2424
end
2525
end
2626

27-
function displayPlots(obj, ranking_algorithm)
27+
function displayPlots(obj, test_method)
2828

29-
p_value = obj.choosePlottingStatistic(ranking_algorithm);
29+
p_value = nla.net.result.NetworkTestResult().getPValueNames(test_method, obj.networkTestResult.test_name);
3030

3131
plot_parameters = nla.net.result.NetworkResultPlotParameter(...
3232
obj.networkTestResult, obj.network_atlas, obj.network_test_options...
3333
);
34-
vs_network_size_parameters = plot_parameters.plotProbabilityVsNetworkSize(ranking_algorithm, p_value);
34+
vs_network_size_parameters = plot_parameters.plotProbabilityVsNetworkSize(test_method, p_value);
3535
no_permutations_vs_network_parameters = plot_parameters.plotProbabilityVsNetworkSize(...
36-
nla.NetworkLevelMethod.NO_PERMUTATIONS, p_value...
36+
"no_permutations", p_value...
3737
);
3838

3939
non_permuted_title = sprintf("Non-permuted P-values vs.\nNetwork-Pair Size");
4040
permuted_title = sprintf("Permuted P-values vs Network-Pair Size");
4141

4242
plotter = nla.net.result.plot.PermutationTestPlotter(obj.network_atlas);
43-
if isequal(ranking_algorithm, "no_permutations")
43+
if isequal(test_method, "no_permutations")
4444
nla.gfx.createFigure(500, 500);
4545
plotter.plotProbabilityVsNetworkSize(vs_network_size_parameters, subplot(1, 1, 1), non_permuted_title);
4646
return
@@ -49,8 +49,8 @@ function displayPlots(obj, ranking_algorithm)
4949

5050
p_value_histogram = obj.networkTestResult.createHistogram(p_value);
5151
plotter.plotProbabilityHistogram(...
52-
subplot(1, 3, 1), p_value_histogram, obj.networkTestResult.full_connectome.statistic_p_value.v,...
53-
obj.networkTestResult.permutation_results.p_value_permutations.v(:, 1),...
52+
subplot(1, 3, 1), p_value_histogram, obj.networkTestResult.full_connectome.(strcat("uncorrected_", p_value)).v,...
53+
obj.networkTestResult.permutation_results.(strcat(p_value, "_permutations")).v(:, 1),...
5454
obj.networkTestResult.test_display_name, obj.network_test_options.prob_max...
5555
);
5656
plotter.plotProbabilityVsNetworkSize(no_permutations_vs_network_parameters, subplot(1, 3, 2), non_permuted_title);

+nla/+gfx/+plots/MatrixPlot.m

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
figure_size % Size to display. Either nla.gfx.FigSize.SMALL or nla.gfx.FigSize.LARGE
2222
draw_legend % Legend on/off
2323
draw_colorbar % Colorbar on/off
24-
color_map % Colormap to use (enter 'turbo(256)' for default)
24+
color_map % Colormap to use (enter 'jet(1000)' for default)
2525
marked_networks % networks to mark with a symbol
2626
discrete_colorbar % colorbar as discrete. TRUE == discrete, FALSE == continuous
2727
network_clicked_callback % Button function to add to each network. Used for clickable networks
@@ -55,7 +55,7 @@
5555
end
5656

5757
properties (Constant)
58-
colormap_choices = {"Parula", "Turbo", "HSV", "Hot", "Cool", "Spring", "Summer", "Autumn", "Winter", "Gray",...
58+
colormap_choices = {"Jet", "Parula", "Turbo", "HSV", "Hot", "Cool", "Spring", "Summer", "Autumn", "Winter", "Gray",...
5959
"Bone", "Copper", "Pink"}; % Colorbar choices
6060
end
6161

@@ -82,7 +82,7 @@
8282
% figure_margins = nla.gfx.FigMargins.WHITESPACE
8383
% draw_legend = true
8484
% draw_colorbar = true
85-
% color_map = turbo(256)
85+
% color_map = jet(1000)
8686
% lower_limit = -0.3
8787
% upper_limit = 0.3
8888
% x_position = 0
@@ -104,13 +104,13 @@
104104
addParameter(matrix_input_parser, 'figure_margins', nla.gfx.FigMargins.WHITESPACE, @isenum);
105105
addParameter(matrix_input_parser, 'draw_legend', true, @islogical);
106106
addParameter(matrix_input_parser, 'draw_colorbar', true, @islogical);
107-
addParameter(matrix_input_parser, 'color_map', turbo(256));
107+
addParameter(matrix_input_parser, 'color_map', jet(1000)); %reverted to jet(1000) by request
108108
addParameter(matrix_input_parser, 'lower_limit', -0.3, validNumberInput);
109109
addParameter(matrix_input_parser, 'upper_limit', 0.3, validNumberInput);
110110
addParameter(matrix_input_parser, 'x_position', 0, validNumberInput);
111111
addParameter(matrix_input_parser, 'y_position', 0, validNumberInput);
112112
addParameter(matrix_input_parser, 'discrete_colorbar', false, @islogical);
113-
addParameter(matrix_input_parser, 'plot_scale', nla.gfx.ProbPlotMethod.DEFAULT, @isenum);
113+
addParameter(matrix_input_parser, 'plot_scale', nla.gfx.ProbPlotMethod.DEFAULT);
114114

115115
parse(matrix_input_parser, figure, name, matrix, networks, figure_size, varargin{:});
116116
properties = {'figure', 'name', 'matrix', 'networks', 'figure_size', 'network_clicked_callback',...
@@ -185,6 +185,8 @@ function applyScale(obj, ~, ~, upper_limit_box, lower_limit_box, scale, color_ma
185185

186186
import nla.net.result.NetworkResultPlotParameter nla.gfx.ProbPlotMethod
187187

188+
obj.color_bar.Ticks = [];
189+
188190
color_map = color_map_select;
189191
if ~isstring(color_map_select) && ~ischar(color_map_select)
190192
color_map = get(color_map_select, "Value");
@@ -206,31 +208,34 @@ function applyScale(obj, ~, ~, upper_limit_box, lower_limit_box, scale, color_ma
206208
lower_limit = get(lower_limit_box, "String");
207209
end
208210

211+
if ~isstring(obj.plot_scale)
212+
obj.plot_scale = char(obj.plot_scale);
213+
end
214+
209215
obj.matrix = obj.original_matrix;
210-
211-
if ismember(obj.plot_scale, [ProbPlotMethod.NEGATIVE_LOG_10, ProbPlotMethod.NEGATIVE_LOG_STATISTIC]) &&...
212-
ismember(scale, [ProbPlotMethod.DEFAULT, ProbPlotMethod.LOG])
216+
if ismember(obj.plot_scale, ["nla.ProbPlotMethod.NEGATIVE_LOG_10", "nla.ProbPlotMethod.NEGATIVE_LOG_STATISTIC"]) &&...
217+
ismember(scale, ["nla.ProbPlotMethod.DEFAULT", "nla.ProbPlotMethod.LOG"])
213218
obj.matrix.v = 10.^(-obj.matrix.v);
214219

215-
elseif ~ismember(obj.plot_scale, [ProbPlotMethod.NEGATIVE_LOG_10, ProbPlotMethod.NEGATIVE_LOG_STATISTIC]) &&...
216-
~ismember(scale, [ProbPlotMethod.DEFAULT, ProbPlotMethod.LOG])
220+
elseif ~ismember(obj.plot_scale, ["nla.ProbPlotMethod.NEGATIVE_LOG_10", "nla.ProbPlotMethod.NEGATIVE_LOG_STATISTIC"]) &&...
221+
~ismember(scale, ["nla.ProbPlotMethod.DEFAULT", "nla.ProbPlotMethod.LOG"])
217222
obj.matrix.v = -log10(obj.matrix.v);
218223
lower_limit = 0;
219224
upper_limit = 2;
220225
end
221226

222227
discrete_colors = NetworkResultPlotParameter().default_discrete_colors;
223228

224-
if scale == ProbPlotMethod.DEFAULT
229+
if scale == "nla.ProbPlotMethod.DEFAULT"
225230
new_color_map = NetworkResultPlotParameter.getColormap(discrete_colors, upper_limit, color_map);
226231
obj.plot_scale = scale;
227-
elseif scale == ProbPlotMethod.LOG
232+
elseif scale == "nla.ProbPlotMethod.LOG"
228233
new_color_map = NetworkResultPlotParameter.getLogColormap(discrete_colors, obj.matrix, upper_limit, color_map);
229234
obj.plot_scale = scale;
230235
else
231236
color_map_name = str2func(lower(color_map));
232237
new_color_map = color_map_name(discrete_colors);
233-
obj.plot_scale = ProbPlotMethod.NEGATIVE_LOG_10;
238+
obj.plot_scale = "nla.ProbPlotMethod.NEGATIVE_LOG_10";
234239
end
235240
obj.color_map = new_color_map;
236241
obj.embiggenMatrix(lower_limit, upper_limit);

+nla/+gfx/drawBrainVis.m

Lines changed: 46 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,20 @@ function drawEdges(ROI_pos, ax, net_atlas, net1, net2, color_map, color_map_p, c
157157
end
158158
end
159159

160-
function onePlot(ax, pos, color_mode, color_mat)
160+
function onePlot(varargin)
161+
if nargin >= 3
162+
ax = varargin{1};
163+
pos = varargin{2};
164+
color_mode = varargin{3};
165+
end
166+
if nargin >= 4
167+
color_mat = varargin{4};
168+
end
169+
if nargin > 4
170+
ulimit = str2double(varargin{5});
171+
llimit = str2double(varargin{6});
172+
end
173+
161174
if color_mode == nla.gfx.BrainColorMode.NONE
162175
ROI_final_pos = nla.gfx.drawROIsOnCortex(ax, net_atlas, ctx, mesh_alpha, ROI_radius, pos, surface_parcels,...
163176
nla.gfx.BrainColorMode.NONE);
@@ -213,6 +226,37 @@ function onePlot(ax, pos, color_mode, color_mat)
213226
hold(ax, 'off');
214227
nla.gfx.hideAxes(ax);
215228

229+
function openModal(source, ~)
230+
d = figure("WindowStyle", "normal", "Units", "pixels", "Position", [source.Parent.Position(1), source.Parent.Position(2), 250, 150]);
231+
upper_limit_box = uicontrol("Style", "edit", "Units", "pixels", "Position", [d.Position(3) / 2, d.Position(4) / 2 + 5, 50, 25], "String", ulimit);
232+
lower_limit_box = uicontrol("Style", "edit", "Units", "pixels", "Position", [d.Position(3) / 2, d.Position(4) / 2 - upper_limit_box.Position(4) - 5, 50, 25], "String", llimit);
233+
uicontrol("Style", "text", "String", "Upper Limit", "Units", "pixels", "Position", [upper_limit_box.Position(1) - 80, upper_limit_box.Position(2) - 5, 80, upper_limit_box.Position(4)]);
234+
uicontrol("Style", "text", "String", "Lower Limit", "Units", "pixels", "Position", [lower_limit_box.Position(1) - 80, lower_limit_box.Position(2) - 5, 80, lower_limit_box.Position(4)]);
235+
236+
apply_button_position = [d.Position(3) / 2 - 85, 10, 80, 25];
237+
close_button_position = [apply_button_position(1) + 85, apply_button_position(2), apply_button_position(3), apply_button_position(4)];
238+
uicontrol("String", "Apply", "Units", "pixels", "Position", apply_button_position, "Callback", {@applyScale, upper_limit_box, lower_limit_box});
239+
uicontrol("String", "Close", "Units", "pixels", "Position", close_button_position, "Callback", @(~, ~)close(d));
240+
end
241+
242+
function applyScale(~, ~, upper_limit_box, lower_limit_box)
243+
upper_limit = get(upper_limit_box, "String");
244+
lower_limit = get(lower_limit_box, "String");
245+
figure(fig)
246+
if surface_parcels && ~islogical(net_atlas.parcels)
247+
onePlot(subplot('Position',[.45,0.505,.53,.45]), nla.gfx.ViewPos.LAT, nla.gfx.BrainColorMode.COLOR_ROIS, color_mat, upper_limit, lower_limit);
248+
onePlot(subplot('Position',[.45,0.055,.53,.45]), nla.gfx.ViewPos.MED, nla.gfx.BrainColorMode.COLOR_ROIS, color_mat, upper_limit, lower_limit);
249+
else
250+
onePlot(subplot('Position',[.45,0.505,.26,.45]), nla.gfx.ViewPos.BACK, nla.gfx.BrainColorMode.NONE, false, upper_limit, lower_limit);
251+
onePlot(subplot('Position',[.73,0.505,.26,.45]), nla.gfx.ViewPos.FRONT, nla.gfx.BrainColorMode.NONE, false, upper_limit, lower_limit);
252+
onePlot(subplot('Position',[.45,0.055,.26,.45]), nla.gfx.ViewPos.LEFT, nla.gfx.BrainColorMode.NONE, false, upper_limit, lower_limit);
253+
onePlot(subplot('Position',[.73,0.055,.26,.45]), nla.gfx.ViewPos.RIGHT, nla.gfx.BrainColorMode.NONE, false, upper_limit, lower_limit);
254+
end
255+
% ROI_final_pos = nla.gfx.drawROIsOnCortex(ax, net_atlas, ctx, mesh_alpha, ROI_radius, pos, surface_parcels,...
256+
% nla.gfx.BrainColorMode.NONE);
257+
% drawEdges(ROI_final_pos, ax, net_atlas, net1, net2, color_map, color_map_p, color_map_n, color_fx, fc_exists, lower_limit, upper_limit);
258+
end
259+
216260
%% Display colormap
217261
if color_fc
218262
% legend(ax, 'Location', 'best');
@@ -232,6 +276,7 @@ function onePlot(ax, pos, color_mode, color_mat)
232276
cb = colorbar(ax);
233277
cb.Location = 'southoutside';
234278
cb.Label.String = 'Coefficient Magnitude';
279+
cb.ButtonDownFcn = @openModal;
235280
ticks = [0:num_ticks];
236281
cb.Ticks = double(ticks) ./ num_ticks;
237282

+nla/+gfx/drawCortexHemi.m

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
% color: 3x1 vector, cortex mesh color
77
% mesh_alpha: transparency of cortex mesh
88

9-
obj = patch(ax, 'Faces',anat_hemi.elements(:,1:3),'Vertices', mesh,...
9+
obj = patch(ax, 'Faces', anat_hemi.elements(:,1:3),'Vertices', mesh,...
1010
'EdgeColor','none','FaceColor','interp','FaceVertexCData', color,...
1111
'FaceLighting','gouraud','FaceAlpha',mesh_alpha,...
1212
'AmbientStrength',0.25,'DiffuseStrength',0.75,'SpecularStrength',0.1);

0 commit comments

Comments
 (0)