Skip to content

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

@seralouk

Description

@seralouk

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions