Skip to content

Commit

Permalink
Bz layer number (#1673; BZ)
Browse files Browse the repository at this point in the history
Co-authored-by: Giovanni Volpe <46021832+giovannivolpe@users.noreply.github.com>
  • Loading branch information
bzufiriaki and giovannivolpe authored Oct 23, 2023
1 parent 907251e commit fc0c537
Show file tree
Hide file tree
Showing 6 changed files with 291 additions and 3 deletions.
71 changes: 71 additions & 0 deletions braph2/pipelines/connectivity multiplex/SubjectCON_MP.m
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,30 @@
prop_default = SubjectCON_MP.conditioning(prop, SubjectCON_MP.getPropDefault(prop));
end
end
methods (Access=protected) % preset
function value = preset(sub, prop, value)
%PRESET preprocesses the value of a property before setting it.
%
% VALUE = PRESET(EL, PROP, VALUE) prepropcesses the VALUE of the property
% PROP. It works only with properties with 2,
% 3, 4, 8 and 9. By
% default, this function does not do anything, so it should be implemented
% in the subclasses of Element when needed.
%
% See also conditioning, checkProp, postset, postprocessing,
% calculateValue, checkValue.

switch prop
case 11 % SubjectCON_MP.L
value = abs(round(value));

otherwise
if prop <= 9
value = preset@Subject(sub, prop, value);
end
end
end
end
methods (Static) % checkProp
function prop_check = checkProp(pointer, value)
%CHECKPROP checks whether a value has the correct format/error.
Expand Down Expand Up @@ -661,6 +685,53 @@
end
end
end
methods (Access=protected) % postset
function postset(sub, prop)
%POSTSET postprocessing after a prop has been set.
%
% POSTPROCESSING(EL, PROP) postprocessesing after PROP has been set. By
% default, this function does not do anything, so it should be implemented
% in the subclasses of Element when needed.
%
% This postprocessing occurs only when PROP is set.
%
% See also conditioning, preset, checkProp, postprocessing, calculateValue,
% checkValue.

switch prop
case 11 % SubjectCON_MP.L
if ~isa(sub.getr('CON_MP'), 'NoValue') && sub.get('L') ~= length(sub.get('CON_MP'))
sub.set('L', length(sub.get('CON_MP')))
end

case 12 % SubjectCON_MP.LAYERLABELS
if ~isa(sub.getr('L'), 'NoValue') && length(sub.get('LAYERLABELS')) == sub.get('L')
title = ['About Layer Labels'];

message = {''
['{\bf\color{orange}' 'BRAPH2' '}'] % note to use doubl slashes to avoid genesis problem
['{\color{gray}version ' '2.0.0.b2' '}']
['{\color{gray}build ' int2str(6) '}']
''
'Please, select a valid number of Layer Labels.'
''
''};
braph2msgbox(title, message)
sub.set('LAYERLABELS', cat(1, strsplit(num2str(1:1:length(sub.get('CON_MP'))))))
end

case 14 % SubjectCON_MP.CON_MP
if length(sub.get('LAYERLABELS')) ~= sub.get('L')
sub.set('LAYERLABELS', cat(1, strsplit(num2str(1:1:length(sub.get('CON_MP'))))))
end

otherwise
if prop <= 9
postset@Subject(sub, prop);
end
end
end
end
methods (Access=protected) % calculate value
function value = calculateValue(sub, prop, varargin)
%CALCULATEVALUE calculates the value of a property.
Expand Down
71 changes: 71 additions & 0 deletions braph2/pipelines/functional multiplex/SubjectFUN_MP.m
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,30 @@
prop_default = SubjectFUN_MP.conditioning(prop, SubjectFUN_MP.getPropDefault(prop));
end
end
methods (Access=protected) % preset
function value = preset(sub, prop, value)
%PRESET preprocesses the value of a property before setting it.
%
% VALUE = PRESET(EL, PROP, VALUE) prepropcesses the VALUE of the property
% PROP. It works only with properties with 2,
% 3, 4, 8 and 9. By
% default, this function does not do anything, so it should be implemented
% in the subclasses of Element when needed.
%
% See also conditioning, checkProp, postset, postprocessing,
% calculateValue, checkValue.

switch prop
case 11 % SubjectFUN_MP.L
value = abs(round(value));

otherwise
if prop <= 9
value = preset@Subject(sub, prop, value);
end
end
end
end
methods (Static) % checkProp
function prop_check = checkProp(pointer, value)
%CHECKPROP checks whether a value has the correct format/error.
Expand Down Expand Up @@ -661,6 +685,53 @@
end
end
end
methods (Access=protected) % postset
function postset(sub, prop)
%POSTSET postprocessing after a prop has been set.
%
% POSTPROCESSING(EL, PROP) postprocessesing after PROP has been set. By
% default, this function does not do anything, so it should be implemented
% in the subclasses of Element when needed.
%
% This postprocessing occurs only when PROP is set.
%
% See also conditioning, preset, checkProp, postprocessing, calculateValue,
% checkValue.

switch prop
case 11 % SubjectFUN_MP.L
if ~isa(sub.getr('FUN_MP'), 'NoValue') && sub.get('L') ~= length(sub.get('FUN_MP'))
sub.set('L', length(sub.get('FUN_MP')))
end

case 12 % SubjectFUN_MP.LAYERLABELS
if ~isa(sub.getr('L'), 'NoValue') && length(sub.get('LAYERLABELS')) ~= sub.get('L')
title = ['About Layer Labels'];

message = {''
['{\bf\color{orange}' 'BRAPH2' '}'] % note to use doubl slashes to avoid genesis problem
['{\color{gray}version ' '2.0.0.b2' '}']
['{\color{gray}build ' int2str(6) '}']
''
'Please, select a valid number of Layer Labels.'
''
''};
braph2msgbox(title, message)
sub.set('LAYERLABELS', cat(1, strsplit(num2str(1:1:length(sub.get('FUN_MP'))))))
end

case 14 % SubjectFUN_MP.FUN_MP
if length(sub.get('LAYERLABELS')) ~= sub.get('L')
sub.set('LAYERLABELS', cat(1, strsplit(num2str(1:1:length(sub.get('FUN_MP'))))))
end

otherwise
if prop <= 9
postset@Subject(sub, prop);
end
end
end
end
methods (Access=protected) % calculate value
function value = calculateValue(sub, prop, varargin)
%CALCULATEVALUE calculates the value of a property.
Expand Down
71 changes: 71 additions & 0 deletions braph2/pipelines/structural multiplex/SubjectST_MP.m
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,30 @@
prop_default = SubjectST_MP.conditioning(prop, SubjectST_MP.getPropDefault(prop));
end
end
methods (Access=protected) % preset
function value = preset(sub, prop, value)
%PRESET preprocesses the value of a property before setting it.
%
% VALUE = PRESET(EL, PROP, VALUE) prepropcesses the VALUE of the property
% PROP. It works only with properties with 2,
% 3, 4, 8 and 9. By
% default, this function does not do anything, so it should be implemented
% in the subclasses of Element when needed.
%
% See also conditioning, checkProp, postset, postprocessing,
% calculateValue, checkValue.

switch prop
case 11 % SubjectST_MP.L
value = abs(round(value));

otherwise
if prop <= 9
value = preset@Subject(sub, prop, value);
end
end
end
end
methods (Static) % checkProp
function prop_check = checkProp(pointer, value)
%CHECKPROP checks whether a value has the correct format/error.
Expand Down Expand Up @@ -661,6 +685,53 @@
end
end
end
methods (Access=protected) % postset
function postset(sub, prop)
%POSTSET postprocessing after a prop has been set.
%
% POSTPROCESSING(EL, PROP) postprocessesing after PROP has been set. By
% default, this function does not do anything, so it should be implemented
% in the subclasses of Element when needed.
%
% This postprocessing occurs only when PROP is set.
%
% See also conditioning, preset, checkProp, postprocessing, calculateValue,
% checkValue.

switch prop
case 11 % SubjectST_MP.L
if ~isa(sub.getr('ST_MP'), 'NoValue') && sub.get('L') ~= length(sub.get('ST_MP'))
sub.set('L', length(sub.get('ST_MP')))
end

case 12 % SubjectST_MP.LAYERLABELS
if ~isa(sub.getr('L'), 'NoValue') && length(sub.get('LAYERLABELS')) == sub.get('L')
title = ['About Layer Labels'];

message = {''
['{\bf\color{orange}' 'BRAPH2' '}'] % note to use doubl slashes to avoid genesis problem
['{\color{gray}version ' '2.0.0.b2' '}']
['{\color{gray}build ' int2str(6) '}']
''
'Please, select a valid number of Layer Labels.'
''
''};
braph2msgbox(title, message)
sub.set('LAYERLABELS', cat(1, strsplit(num2str(1:1:length(sub.get('ST_MP'))))))
end

case 14 % SubjectST_MP.ST_MP
if length(sub.get('LAYERLABELS')) ~= sub.get('L')
sub.set('LAYERLABELS', cat(1, strsplit(num2str(1:1:length(sub.get('ST_MP'))))))
end

otherwise
if prop <= 9
postset@Subject(sub, prop);
end
end
end
end
methods (Access=protected) % calculate value
function value = calculateValue(sub, prop, varargin)
%CALCULATEVALUE calculates the value of a property.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,30 @@ function cb_exporter_XLS(~, ~)
L (data, scalar) is the number of layers of subject data.
%%%% ¡default!
2
%%%% ¡preset!
value = abs(round(value));
%%%% ¡postset!
if ~isa(sub.getr('CON_MP'), 'NoValue') && sub.get('L') ~= length(sub.get('CON_MP'))
sub.set('L', length(sub.get('CON_MP')))
end

%%% ¡prop!
LAYERLABELS (metadata, stringlist) are the layer labels provided by the user.
%%%% ¡postset!
if ~isa(sub.getr('L'), 'NoValue') && length(sub.get('LAYERLABELS')) ~= sub.get('L')
title = ['About Layer Labels'];
message = {''
['{\\bf\\color{orange}' BRAPH2.STR '}'] % note to use doubl slashes to avoid genesis problem
['{\\color{gray}version ' BRAPH2.VERSION '}']
['{\\color{gray}build ' int2str(BRAPH2.BUILD) '}']
''
'Please, select a valid number of Layer Labels.'
''
''};
braph2msgbox(title, message)

sub.set('LAYERLABELS', cat(1, strsplit(num2str(1:1:length(sub.get('CON_MP'))))))
end

%%% ¡prop!
ALAYERLABELS (query, stringlist) returns the processed layer labels.
Expand All @@ -219,6 +240,10 @@ function cb_exporter_XLS(~, ~)
else
msg = ['CON_MP must be a cell with L square matrices with the dimensiton equal to the number of brain regions (' int2str(br_number) ').'];
end
%%%% ¡postset!
if length(sub.get('LAYERLABELS')) ~= sub.get('L')
sub.set('LAYERLABELS', cat(1, strsplit(num2str(1:1:length(sub.get('CON_MP'))))))
end
%%%% ¡gui!
pr = PanelPropCell('EL', sub, 'PROP', SubjectCON_MP.CON_MP, ...
'TABLE_HEIGHT', s(40), ...
Expand Down Expand Up @@ -260,4 +285,4 @@ function cb_exporter_XLS(~, ~)
gui.get('DRAW')
gui.get('SHOW')

gui.get('CLOSE')
gui.get('CLOSE')
Original file line number Diff line number Diff line change
Expand Up @@ -199,9 +199,30 @@ function cb_exporter_XLS(~, ~)
L (data, scalar) is the number of layers of subject data.
%%%% ¡default!
2
%%%% ¡preset!
value = abs(round(value));
%%%% ¡postset!
if ~isa(sub.getr('FUN_MP'), 'NoValue') && sub.get('L') ~= length(sub.get('FUN_MP'))
sub.set('L', length(sub.get('FUN_MP')))
end

%%% ¡prop!
LAYERLABELS (metadata, stringlist) are the layer labels provided by the user.
%%%% ¡postset!
if ~isa(sub.getr('L'), 'NoValue') && length(sub.get('LAYERLABELS')) ~= sub.get('L')
title = ['About Layer Labels'];
message = {''
['{\\bf\\color{orange}' BRAPH2.STR '}'] % note to use doubl slashes to avoid genesis problem
['{\\color{gray}version ' BRAPH2.VERSION '}']
['{\\color{gray}build ' int2str(BRAPH2.BUILD) '}']
''
'Please, select a valid number of Layer Labels.'
''
''};
braph2msgbox(title, message)

sub.set('LAYERLABELS', cat(1, strsplit(num2str(1:1:length(sub.get('FUN_MP'))))))
end

%%% ¡prop!
ALAYERLABELS (query, stringlist) returns the processed layer labels.
Expand All @@ -219,6 +240,10 @@ function cb_exporter_XLS(~, ~)
else
msg = ['FUN_MP must be a cell with L matrices with the same number of columns as the number of brain regions (' int2str(br_number) ').'];
end
%%%% ¡postset!
if length(sub.get('LAYERLABELS')) ~= sub.get('L')
sub.set('LAYERLABELS', cat(1, strsplit(num2str(1:1:length(sub.get('FUN_MP'))))))
end
%%%% ¡gui!
pr = PanelPropCell('EL', sub, 'PROP', SubjectFUN_MP.FUN_MP, ...
'TABLE_HEIGHT', s(40), ...
Expand Down Expand Up @@ -260,4 +285,4 @@ function cb_exporter_XLS(~, ~)
gui.get('DRAW')
gui.get('SHOW')

gui.get('CLOSE')
gui.get('CLOSE')
Loading

0 comments on commit fc0c537

Please sign in to comment.