Skip to content

Instantly share code, notes, and snippets.

@schluppeck
Last active March 18, 2019 11:05
Show Gist options
  • Save schluppeck/957f6246d6f6453f6f69f94a2cf5e98c to your computer and use it in GitHub Desktop.
Save schluppeck/957f6246d6f6453f6f69f94a2cf5e98c to your computer and use it in GitHub Desktop.

example of using montage()

... with rendered zstat images from fsl (cf https://schluppeck.github.io/dafni/matlab_images/)

The matlab montage command can handle different colormaps, indices, etc. Check out the documentation and also have a look at the snipptes of code in montageWithRender.m, which produces acceptable results:

render zstat in montage

doc montage()
%% dealing with weird colour maps from rendered thresholded maps (FSL)
%
% cf: https://schluppeck.github.io/dafni/matlab_images/
%
% ds 2019-04-15
% load in the file with the sepcial colormap
load('renderMap.txt')
% and a "merged" data set
data = niftiread('rendered_thresh_zstat1.nii');
% nSamples - how many slices to put into montage
nSamples = 10;
theSlices = round(linspace(1,size(data,3), nSamples)); % make an integer range of slices
%% now issue montage command
montage(data, ... % rows <-> columns
'DisplayRange', [min(data(:)), max(data(:))], ... % make sure you display the whole range of values
'Indices', theSlices );
% and now use the funky color map for display
colormap(renderMap);
% now export / print(), etc as usual.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment