diff --git a/CanlabCore/@image_vector/render_on_surface.m b/CanlabCore/@image_vector/render_on_surface.m index a7c26d91..8c735d79 100644 --- a/CanlabCore/@image_vector/render_on_surface.m +++ b/CanlabCore/@image_vector/render_on_surface.m @@ -478,7 +478,7 @@ set(surface_handles(i), 'EdgeColor', 'none'); if doscaledtrans - z = c/max(abs(c)); + z = c/max(abs(datvec)); z = enhance_contrast(z); set(surface_handles(i), 'FaceVertexAlphaData',abs(z)); set(surface_handles(i), 'FaceAlpha', 'interp'); diff --git a/CanlabCore/fmridisplay_helper_functions/render_blobs.m b/CanlabCore/fmridisplay_helper_functions/render_blobs.m index 8a91154b..d8d7d3c4 100644 --- a/CanlabCore/fmridisplay_helper_functions/render_blobs.m +++ b/CanlabCore/fmridisplay_helper_functions/render_blobs.m @@ -621,13 +621,14 @@ if dotrans % Set transparency + + if dotrans + s = max(abs(Z(Z~=0 & ~isnan(Z)))); + Z(~isnan(Z)) = enhance_contrast(Z(~isnan(Z))/s)*s; + end if ~docolormap || dosplitcolor, Zscaled = abs(Z); end - Zscaled(isnan(Zscaled)) = 0; - Zscaled = enhance_contrast(Zscaled); - Zscaled = abs(Zscaled); - if ~isempty(transvalue) % constant transparency value set(h, 'AlphaDataMapping', 'scaled', 'AlphaData', transvalue .* double(abs(Z) > 0), 'FaceAlpha', 'interp') @@ -637,6 +638,7 @@ % Note: changed by Tor, 2015. Zscaled values > 1 % were messing up transparency scale for underlay. % Max should be 1. + set(h, 'AlphaDataMapping', 'scaled', 'AlphaData', Zscaled ./ max(abs(Zscaled(:))), 'FaceAlpha', 'interp'); end