Skip to content

Commit

Permalink
bug fixes, addition of new addbrains args to valid surface() args, an…
Browse files Browse the repository at this point in the history
…d colorbar offset a bit in surface plots
  • Loading branch information
bogpetre committed Sep 6, 2024
1 parent 3e7dfa6 commit d0122bc
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 6 deletions.
18 changes: 15 additions & 3 deletions CanlabCore/@image_vector/render_on_surface.m
Original file line number Diff line number Diff line change
Expand Up @@ -530,8 +530,12 @@
% interpolate from mesh grid to the surface vertices intersecting
% the grid
if isempty(sourcespace) | isempty(targetsurface)
sh = surface_handles(i);
if isa(sh,'double')
sh = get(sh);
end
c = interp3(mesh_struct.X, mesh_struct.Y, mesh_struct.Z, mesh_struct.voldata, ...
surface_handles(i).Vertices(:,1), surface_handles(i).Vertices(:,2), surface_handles(i).Vertices(:,3), interp);
sh.Vertices(:,1), sh.Vertices(:,2), sh.Vertices(:,3), interp);
else
% figure out what surface we're dealing with and grab the appropriate
% source surfaces to sample with
Expand Down Expand Up @@ -721,13 +725,21 @@

if any(datvec > 0)

% check for existing colorbars
children = get(gcf,'Children');
for i = 1:length(children)
if isa(children(i),'matlab.graphics.illustration.ColorBar')
delete(children(i));
end
end

bar1axis = axes('Position', [.55 .55 .38 .4]);
if doindexmap
colormap(bar1axis, cm(2:end,:));
else
colormap(bar1axis, cm(1+(kpos-1)*nvals:kpos*nvals, :));
end
colorbar1_han = colorbar(bar1axis);
colorbar1_han = colorbar(bar1axis, 'EastOutside');
set(bar1axis, 'Visible', 'off');

if doindexmap & exist('mylabels', 'var')
Expand Down Expand Up @@ -766,7 +778,7 @@
else
colormap(bar2axis, cm(1+(kneg-1)*nvals:kneg*nvals, :));
end
colorbar2_han = colorbar(bar2axis);
colorbar2_han = colorbar(bar2axis, 'EastOutside');
set(bar2axis, 'Visible', 'off');

if doindexmap
Expand Down
15 changes: 12 additions & 3 deletions CanlabCore/@region/surface.m
Original file line number Diff line number Diff line change
Expand Up @@ -143,10 +143,18 @@
'brainbottom' 'cutaway', 'left_cutaway' 'right_cutaway' ...
'left_insula_slab' 'right_insula_slab' 'accumbens_slab' 'coronal_slabs' 'coronal_slabs_4' 'coronal_slabs_5' ...
'brainstem' 'suit brainstem' 'amygdala' 'amygdala hires' 'hippocampus', 'hipp' 'hippocampus hires' 'cerebellum','cblm' 'CIT168' ...
'bg', 'basal ganglia' 'midbrain_group' 'limbic' 'limbic hires' 'brainstem_group' 'thalamus_group'};
'bg', 'basal ganglia' 'midbrain_group' 'limbic' 'limbic hires' 'brainstem_group' 'thalamus_group',...
'inflated right','fsavg_right', 'inflated left', 'fsavg_left', 'hcp inflated left', 'hcp inflated right',...
'hcp inflated', 'hcp sphere left', 'hcp sphere right', 'freesurfer sphere left', 'freesurfer sphere right',...
'freesurfer inflated left', 'freesurfer inflated right', 'freesurfer white left', 'freesurfer white right',...
'MNI152NLin2009cAsym white left','MNI152NLin2009cAsym white right','MNI152NLin2009cAsym midthickness left',...
'MNI152NLin2009cAsym midthickness right','MNI152NLin2009cAsym pial left', 'MNI152NLin2009cAsym pial right',...
'MNI152NLin6Asym white left','MNI152NLin6Asym white right','MNI152NLin6Asym midthickness left',...
'MNI152NLin6Asym midthickness right','MNI152NLin6Asym pial left', 'MNI152NLin6Asym pial right',...
'MNI152NLin6Asym sphere left','MNI152NLin6Asym sphere right'};

render_on_surface_allowable_args = {'clim' 'cmaprange' 'color' 'colormap' 'colormapname' 'axis_handle' 'pos_colormap' 'neg_colormap' ...
'summer' 'cool' 'hot' 'bone' 'copper' 'prism' 'hsv' 'winter' 'nolegend'};
'summer' 'cool' 'hot' 'bone' 'copper' 'prism' 'hsv' 'winter' 'nolegend','sourcespace','targetspace'};

% optional inputs with default values
for i = 1:length(varargin)
Expand All @@ -162,7 +170,7 @@
% do nothing, handle later

case render_on_surface_allowable_args
% no nothing, will pass in to render_on_surface
% do nothing, will pass in to render_on_surface

otherwise, warning(['Unknown input string option:' varargin{i}]);
end
Expand All @@ -188,6 +196,7 @@

end


% END DEFAULTS AND INPUTS
% -------------------------------------------------------------------------

Expand Down

0 comments on commit d0122bc

Please sign in to comment.