Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slover: Controling the alpha (transparency) of a "split" type image #7

Open
seralouk opened this issue Jul 22, 2021 · 0 comments
Open

Comments

@seralouk
Copy link

seralouk commented Jul 22, 2021

I have a brain map with both positive and negative values and I would like to use slover to display it on a structural image.

My idea is to build a 3-layers slover object (layer 1: background, layer 2 & 3 will be the same file).
Layer 2 will be displayed with "hot" colors and layer 3 with "winter".

How can I control the transparency of layer 2 and 3? Both are of type "split" because "truecolour" type will display them too transparent...

My code looks like this:

obj.img(1).vol=spm_vol(structFile); 
obj.img(2).vol=spm_vol(NiftiFile);
obj.img(3).vol=spm_vol(NiftiFile);

[mx1 mn1] = slover('volmaxmin', obj.img(1).vol);
[mx mn] = slover('volmaxmin', obj.img(2).vol);

% thresholds for layer 2 and 3
lowerthreshold = 0.05; 
upperthreshold = max(abs(mx) , abs(mn)) / 2;  % custom max value for nice visualizations

% define color map range
obj.img(1).range = [0 mx1]; % do not display negatives (if any)
obj.img(2).range=[lowerthreshold, upperthreshold];    % make symmetric
obj.img(3).range=[-lowerthreshold, -upperthreshold];  % make symmetric

% define color maps
obj.img(2).cmap='hot';
obj.img(3).cmap='winter'; 

% transparency and type
obj.img(1).type = 'truecolour';
obj.img(2).type = 'split';
obj.img(3).type = 'split';

paint(obj);

Results using the above code:

image

Results after setting obj.img(2).type = 'truecolour'; obj.img(3).type = 'truecolour'; obj.img(2).prop = 1; obj.img(3).prop = 1;:
Screenshot 2021-07-22 at 15 14 13

Desired output (like this):
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant