Skip to content

Commit

Permalink
colormap overflow bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bogpetre committed Aug 26, 2024
1 parent 26db44c commit 71250f2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions CanlabCore/@image_vector/render_on_surface.m
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@
if isempty(sourcespace) | isempty(targetsurface)
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);
else
else
% figure out what surface we're dealing with and grab the appropriate
% source surfaces to sample with
if contains(get(surface_handles(i),'Tag'),{'left','Left','LEFT'})
Expand Down Expand Up @@ -808,7 +808,7 @@
% softmax here keeps negative values from extending below the colormap
% range, which would otherwise make those values gray, since the lowest
% value on the colormap is a hardcoded grayscale value
range_val = max((c-x1),0)*(y2-y1)./(x2-x1);
range_val = min(max((c-x1),0),x2-x1)*(y2-y1)./(x2-x1);
end

val = y1 + range_val;
Expand Down

0 comments on commit 71250f2

Please sign in to comment.