@@ -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
0 commit comments