Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions +nla/+edge/+result/Base.m
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ function output(obj, net_atlas, flags, prob_label)
matrix_plot.displayImage();
w = matrix_plot.image_dimensions("image_width");
h = matrix_plot.image_dimensions("image_height");

if ~isfield(flags, 'display_sig')
flags.display_sig = true;
end
%
if flags.display_sig
if ~exist('prob_label', 'var')
prob_label = [sprintf('Edge-level Significance (P < %g)', obj.prob_max), prob_label_appended];
Expand Down
2 changes: 1 addition & 1 deletion +nla/+edge/+test/Precalculated.m
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
inputs = {...
NumberWithoutDefault('coeff_min', 'Coeff minimum', -Inf, Inf),...
NumberWithoutDefault('coeff_max', 'Coeff maximum', -Inf, Inf),...
nla.inputField.NetworkAtlas(),...
inputField.NetworkAtlas(),...
EdgeLevelMatrix('precalc_obs_p', 'Precalculated observed significance (thresholded p-value)', npairs_x_1),...
EdgeLevelMatrix('precalc_obs_coeff', 'Precalculated observed coeff', npairs_x_1),...
EdgeLevelMatrix('precalc_perm_p', 'Precalculated permuted significance (thresholded p-value)', npairs_x_nperms),...
Expand Down
2 changes: 1 addition & 1 deletion +nla/+edge/+test/WelchT.m
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
x1 = input_struct.func_conn.v(:, group1);
x2 = input_struct.func_conn.v(:, group2);

[p_vec, t_vec, dof_vec] = nla.welchT(x1, x2);
[p_vec, t_vec, dof_vec] = welchT(x1, x2);

% Non-permuted
group_names = {input_struct.group1_name, input_struct.group2_name};
Expand Down
30 changes: 10 additions & 20 deletions +nla/+gfx/+plots/MatrixPlot.m
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,6 @@
"Bone", "Copper", "Pink"}; % Colorbar choices
end

properties (SetAccess = immutable)
original_matrix % The original matrix for scaling purposes
end

methods
function obj = MatrixPlot(figure, name, matrix, networks, figure_size, varargin)
% MatrixPlot constructor
Expand Down Expand Up @@ -116,7 +112,7 @@
end
end
end
obj.original_matrix = matrix;

end

function displayImage(obj)
Expand Down Expand Up @@ -559,7 +555,7 @@ function createColorbar(obj, varargin)
function openModal(obj, source, ~)
% Callback for clicking on the colorbar.
% This opens a modal with the upper and lower bounds along with a radio selector between linear and
% log.
% log. This only works for a "regular" log scale, not the -log10 scale. Still working on that one
import nla.gfx.ProbPlotMethod

% source is the colorbar, not the figure
Expand Down Expand Up @@ -600,22 +596,20 @@ function openModal(obj, source, ~)
uicontrol("Style", "text", "string", "Colormaps", "Units", "pixels",...
"Position", [10, scaleBaseButtons.Position(2) - 45, 80, 25]);
color_map_select = uicontrol('Style', 'popupmenu',...
'Position', [100, scaleBaseButtons.Position(2) - 45, 242, 30]);
'Position', [100, scaleBaseButtons.Position(2) - 45, 250, 30]);
initial_colors = 16;
colormap_html = [];
for colors = 1:numel(obj.colormap_choices)
colormap_function = str2func(strcat(strcat("@(x) ",lower(obj.colormap_choices{colors}), "(x)")));
CData = colormap_function(initial_colors);
new_html_start = '<HTML>';
new_html = '';
for color_iterator = initial_colors:-1:1
new_html = '<HTML>';
for color_iterator = 1:initial_colors
hex_code = nla.gfx.rgb2hex([CData(color_iterator, 1), CData(color_iterator, 2),...
CData(color_iterator, 3)]);
new_html = [new_html '<FONT bgcolor="' hex_code ' "color="' hex_code '">__</FONT>'];
end
%new_html = new_html(1:end-2);
new_html_end = [new_html '</HTML>'];
new_html = [new_html_start new_html new_html_end]
new_html = [new_html '</HTML>'];
colormap_html = [colormap_html; {new_html}];
end
set(color_map_select, "Value", 1, "String", colormap_html);
Expand All @@ -632,13 +626,12 @@ function openModal(obj, source, ~)
end

function applyScale(obj, ~, ~, upper_limit_box, lower_limit_box, button_group, color_map_select)

% This callback gets the colormap/scale and then applies the new bounds to the data.
% Only works with APPLY button, will not work with only CLOSE

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

obj.matrix = obj.original_matrix;

button_group_value = get(get(button_group, "SelectedObject"), "String");

if ismember(obj.plot_scale, [ProbPlotMethod.NEG_LOG_10, ProbPlotMethod.NEG_LOG_STATISTIC]) &&...
Expand All @@ -652,32 +645,29 @@ function applyScale(obj, ~, ~, upper_limit_box, lower_limit_box, button_group, c
discrete_colors = NetworkResultPlotParameter().default_discrete_colors;
color_map = get(color_map_select, "Value");
if button_group_value == "Linear"
new_color_map = NetworkResultPlotParameter.getColormap(discrete_colors, get(upper_limit_box, "String"),...
obj.color_map = NetworkResultPlotParameter.getColormap(discrete_colors, get(upper_limit_box, "String"),...
obj.colormap_choices{color_map});
obj.plot_scale = ProbPlotMethod.DEFAULT;
elseif button_group_value == "Log"
new_color_map = NetworkResultPlotParameter.getLogColormap(discrete_colors, obj.matrix, get(upper_limit_box, "String"), obj.colormap_choices{color_map});
obj.color_map = NetworkResultPlotParameter.getLogColormap(discrete_colors, obj.matrix, get(upper_limit_box, "String"), obj.colormap_choices{color_map});
obj.plot_scale = ProbPlotMethod.LOG;
else
color_map_name = str2func(lower(obj.colormap_choices{color_map}));
new_color_map = color_map_name(discrete_colors);
obj.color_map = color_map_name(discrete_colors);
obj.plot_scale = ProbPlotMethod.NEG_LOG_10;
end
obj.color_map = new_color_map;
obj.embiggenMatrix(get(lower_limit_box, "String"), get(upper_limit_box, "String"));
obj.createColorbar(get(lower_limit_box, "String"), get(upper_limit_box, "String"));
end

function chunk_color = getChunkColor(obj, chunk_raw, upper_value, lower_value)
% Get color for the chunk (square)

chunk_color = nla.gfx.valToColor(chunk_raw, lower_value, upper_value, obj.color_map);
chunk_color(isnan(chunk_raw)) = NaN; % puts all NaNs back removed with valToColor
end

function applyColorToData(obj, position_x, position_y, chunk_height, chunk_width, chunk_color)
% Fill in the chunks (squares) with color

obj.image_display.CData(position_y:position_y + chunk_height - 1, position_x:position_x + chunk_width - 1, :) =...
repelem(chunk_color, obj.elementSize(), obj.elementSize());
obj.image_display.CData(position_y + chunk_height, position_x:position_x + chunk_width - 1, :) =...
Expand Down
2 changes: 1 addition & 1 deletion +nla/+gfx/ProbPlotMethod.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
classdef ProbPlotMethod
enumeration
DEFAULT, LOG, NEG_LOG_10, STATISTIC, LOG_STATISTIC, NEG_LOG_STATISTIC
DEFAULT, LOG, NEG_LOG_10, STATISITC, LOG_STATISTIC, NEG_LOG_STATISTIC
end
end
2 changes: 1 addition & 1 deletion +nla/+gfx/anatToMesh.m
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
% rotate right hemi around and move to position for visualization
cmL = mean(mesh_l, 1);
cmR = mean(mesh_r, 1);
rm = nla.helpers.rotationMatrix(nla.Dir.Z, pi);
rm = nla.helpers.rotationMatrix(Dir.Z, pi);

% Rotate
switch view_pos
Expand Down
3 changes: 1 addition & 2 deletions +nla/+gfx/drawBrainVis.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ function drawBrainVis(edge_input_struct, input_struct, net_atlas, ctx, mesh_alph

fc_exists = isfield(edge_input_struct, 'func_conn');

color_fc = false; % short term fix for NET-167
% color_fc = fc_exists;
color_fc = fc_exists;

show_ROI_centroids = true;
if isfield(input_struct, 'show_ROI_centroids')
Expand Down
2 changes: 0 additions & 2 deletions +nla/+helpers/rotationMatrix.m
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
function mat = rotationMatrix(dir, theta)
% Generate a rotation matrix for the direction given
% an angle (in radians).
import nla.Dir

mat = zeros(3);

switch dir
Expand Down
2 changes: 1 addition & 1 deletion +nla/+inputField/NetworkAtlas.m
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
end

function [w, h] = draw(obj, x, y, parent, fig)
import nla.inputField.LABEL_GAP nla.inputField.LABEL_H nla.inputField.widthOfString
import nla.inputField.LABEL_GAP nla.inputField.LABEL_H nla.inputFieldwidthOfString
import nla.gfx.MeshType

obj.fig = fig;
Expand Down
6 changes: 3 additions & 3 deletions +nla/+net/+result/+chord/ChordPlotter.m
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

function generateChordFigure(obj, parameters, chord_type)
% generateChordFigure plots chords for a network test
import nla.gfx.SigType nla.net.result.plot.PermutationTestPlotter nla.gfx.EdgeChordPlotMethod
import nla.gfx.SigType nla.net.result.plot.NoPermutationPlotter nla.gfx.EdgeChordPlotMethod

coefficient_bounds = [0, parameters.p_value_plot_max];
if parameters.significance_type == SigType.INCREASING && parameters.p_value_plot_max < 1
Expand Down Expand Up @@ -79,7 +79,7 @@ function generateChordFigure(obj, parameters, chord_type)
end

% Plot Trimatrix with the chord plots
plotter = PermutationTestPlotter(obj.network_atlas);
plotter = NoPermutationPlotter(obj.network_atlas);
plotter.plotProbability(plot_figure, parameters, 25, obj.bottom_text_height);

obj.generatePlotText(plot_figure, chord_type);
Expand Down Expand Up @@ -185,7 +185,7 @@ function generateEdgeChordFigure(obj, plot_figure, parameters, chord_type)
end

chord_plotter = nla.gfx.chord.ChordPlot(obj.network_atlas, plot_axis, 450, clipped_values, 'chord_type', chord_type,...
'direction', significance_type, 'color_map', color_map, 'lower_limit', coefficient_min, 'upper_limit', coefficient_max);
'direction', significance_type, 'color_map', color_map, 'lower_limit', coefficient_min, 'upper_limit', coefficient_min);
chord_plotter.drawChords();
setTitle(plot_axis, main_title);

Expand Down
85 changes: 0 additions & 85 deletions +nla/+net/+result/+plot/PermutationTestPlotter.m

This file was deleted.

19 changes: 8 additions & 11 deletions +nla/+net/+result/NetworkResultPlotParameter.m
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

properties (Dependent)
test_methods
noncorrelation_input_tests
noncorrelation_input_test_names
number_of_networks
end

Expand All @@ -29,9 +29,9 @@
function result = plotProbabilityParameters(obj, edge_test_options, edge_test_result, test_method, plot_statistic,...
plot_title, fdr_correction, significance_filter)
% plot_title - this will be a string
% plot_statistic - this is the stat that will be plotted
% plot_statistic - this is the stat that will be plotted, string
% significance filter - this will be a boolean or some sort of object (like Cohen's D > D-value)
% fdr_correction - a struct of fdr_correction (found in nla.net.mcc)
% fdr_correction - a struct of fdr_correction (found in nla.net.mcc) or None
% test_method - 'no permutations', 'within network pair', 'full connectome'

import nla.TriMatrix nla.TriMatrixDiag
Expand Down Expand Up @@ -73,8 +73,7 @@
% determine colormap and operate on values if it's -log10
switch obj.updated_test_options.prob_plot_method
case nla.gfx.ProbPlotMethod.LOG
color_map = nla.net.result.NetworkResultPlotParameter.getLogColormap(obj.default_discrete_colors,...
statistic_input, p_value_max);
color_map = nla.net.result.NetworkResultPlotParameter.getLogColormap(obj.default_discrete_colors, statistic_input, p_value_max);
% Here we take a -log10 and change the maximum value to show on the plot
case nla.gfx.ProbPlotMethod.NEG_LOG_10
color_map = parula(obj.default_discrete_colors);
Expand All @@ -89,8 +88,7 @@
end
significance_type = nla.gfx.SigType.INCREASING;
otherwise
color_map = nla.net.result.NetworkResultPlotParameter.getColormap(obj.default_discrete_colors,...
p_value_max);
color_map = nla.net.result.NetworkResultPlotParameter.getColormap(obj.default_discrete_colors, p_value_max);
end

% callback function for brain image.
Expand All @@ -102,7 +100,7 @@ function brainFigureButtonCallback(network1, network2)
wait_popup = waitbar(0.05, wait_text);
nla.gfx.drawBrainVis(edge_test_options, obj.updated_test_options, obj.network_atlas,...
nla.gfx.MeshType.STD, 0.25, 3, true, edge_test_result, network1, network2,...
any(strcmp(obj.noncorrelation_input_tests, obj.network_test_results.test_name)));
any(strcmp(obj.noncorrelation_input_test_names, obj.network_test_results.test_name)));
waitbar(0.95);
close(wait_popup);
end
Expand Down Expand Up @@ -142,8 +140,8 @@ function brainFigureButtonCallback(network1, network2)
value = obj.network_test_results.test_methods;
end

function value = get.noncorrelation_input_tests(obj)
value = obj.network_test_results.noncorrelation_input_tests;
function value = get.noncorrelation_input_test_names(obj)
value = obj.network_test_results.noncorrelation_input_test_names;
end

function value = get.number_of_networks(obj)
Expand Down Expand Up @@ -201,7 +199,6 @@ function brainFigureButtonCallback(network1, network2)
color_map_name = str2func(lower(color_map));
color_map_base = color_map_name(default_discrete_colors);
end

default_color_map = [1 1 1];
if p_value_max == 0
color_map = default_color_map;
Expand Down
Loading