Skip to content

Commit

Permalink
scaledtransparency contrast enhancement support
Browse files Browse the repository at this point in the history
  • Loading branch information
bogpetre committed Sep 10, 2023
1 parent d049b93 commit af275cb
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion CanlabCore/fmridisplay_helper_functions/render_blobs.m
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@
% **'transvalue':**
% Followed by width value, e.g., 1. also 'constanttrans'
%
% **'transcontrast':**
% If scaledtransparency is used, this increases the contrast in
% alpha transparency values. Useful if you want a nonlinear
% (sigmoidal) value dependence.
%
% **OTHER OPTIONS:**
%
% **'smooth':**
Expand Down Expand Up @@ -241,7 +246,7 @@
% enter contanttrans followed by a transparency value

case 'scaledtransparency' % Transparency is a function of voxel value, lower values are more transparent
transvalue = []; % Empty invokes the scaled mapping later
dotrans= 1; transvalue = []; % Empty invokes the scaled mapping later

% contour options
case 'contour', docontour = 1;
Expand All @@ -265,6 +270,11 @@
case 'interp'
interpStyle = varargin{i+1};

case 'transcontrast'
k = varargin{i+1};
enhance_contrast = @(x1)((1./(1+exp(-k.*x1)))-0.5);


otherwise, warning(['Unknown input string option:' varargin{i}]);
end
end
Expand Down Expand Up @@ -607,7 +617,9 @@
% Set transparency

if ~docolormap || dosplitcolor, Zscaled = abs(Z); end

Zscaled(isnan(Zscaled)) = 0;
Zscaled = enhance_contrast(Zscaled);
Zscaled = abs(Zscaled);

if ~isempty(transvalue)
Expand Down

0 comments on commit af275cb

Please sign in to comment.