2020
2121opt.pipeline.type = ' stats' ;
2222
23- opt.dir.raw = fullfile(this_dir , ' inputs' , ' raw' );
2423opt.dir.derivatives = fullfile(this_dir , ' outputs' , ' derivatives' );
2524opt.dir.preproc = fullfile(opt .dir.derivatives, ' bidspm-preproc' );
2625
27- opt.dir.roi = fullfile(opt .dir.derivatives, ' bidspm-roi' );
28- opt.dir.stats = fullfile(opt .dir.derivatives, ' bidspm-stats' );
29-
3026opt.model.file = fullfile(this_dir , ' models' , ' model-MoAE_smdl.json' );
3127
3228opt.subjects = {' 01' };
3329
3430% read the model
3531opt = checkOptions(opt );
3632
37- % TODO loop over noce and subjects
38-
39- overwrite = true ;
40-
41- color_map_folder = fullfile(returnRootDir(), ' lib' , ' brain_colours' , ' mat_maps' );
42-
43- node = opt.model.bm.Nodes{1 };
44-
45- if any(strcmp(node .Level, {' Run' , ' Subject' }))
46-
47- for iSub = 1 : numel(opt .subjects)
48-
49- subLabel = opt.subjects{iSub };
50-
51- ffxDir = getFFXdir(subLabel , opt );
52- load(fullfile(ffxDir , ' SPM.mat' ))
53-
54- for iRes = 1 : numel(node .Model.Software.bidspm.Results)
55-
56- opt.results = node.Model.Software.bidspm.Results{iRes };
57-
58- if ~isfield(opt .results, ' montage' ) || ~opt .results.montage.do
59- continue
60- end
61-
62- % set defaults
63- [opt , ~ ] = checkMontage(opt , iRes , node , struct([]), subLabel );
64- opt = checkOptions(opt );
65- opt .results(iRes ).montage = setMontage(opt .results(iRes ));
66-
67- for i_name = 1 : numel(opt .results.name)
68-
69- if opt .results(iRes ).binary
70- layers = sd_config_layers(' init' , {' truecolor' , ' dual' , ' contour' });
71- else
72- layers = sd_config_layers(' init' , {' truecolor' , ' dual' });
73- end
74-
75- %% Layer 1: Anatomical map
76- layers(1 ) = setFields(layers(1 ), opt .results(iRes ).sdConfig.layers{1 }, overwrite );
77-
78- layers(1 ).color.file = opt .results(iRes ).montage.background{1 };
79-
80- hdr = spm_vol(layers(1 ).color.file);
81- [max_val , min_val ] = slover(' volmaxmin' , hdr );
82- layers(1 ).color.range = [0 max_val ];
83-
84- %% Layer 2: Dual-coded layer
85-
86- % - contrast estimates color-coded;
87- layers(2 ) = setFields(layers(2 ), opt .results(iRes ).sdConfig.layers{2 }, overwrite );
88-
89- name = opt.results.name{i_name };
90- tmp = struct(' name' , name );
91- contrastNb = getContrastNb(tmp , opt , SPM );
92-
93- % keep track if this is a t test or F test
94- stat = SPM .xCon(contrastNb ).STAT;
95-
96- contrastNb = sprintf(' %04.0f ' , contrastNb );
97-
98- if strcmp(stat , ' T' )
99- colorFile = spm_select(' FPList' , ffxDir , [' ^con_' contrastNb ' .nii$' ]);
100- else
101- colorFile = spm_select(' FPList' , ffxDir , [' ^ess_' contrastNb ' .nii$' ]);
102- end
103- layers(2 ).color.file = colorFile ;
104-
105- title = strrep(name , ' _' , ' ' );
106- layers(2 ).color.label = [title ' (a.u.)' ];
107-
108- % - statistics opacity-coded
109- if strcmp(stat , ' T' )
110- opacityFile = spm_select(' FPList' , ffxDir , [' ^spmT_' contrastNb ' .nii$' ]);
111-
112- layers(2 ).opacity.label = ' | t |' ;
113-
114- load(fullfile(color_map_folder , ' diverging_bwr_iso.mat' ));
115- layers(2 ).color.map = diverging_bwr ;
116- else
117- opacityFile = spm_select(' FPList' , ffxDir , [' ^spmF_' contrastNb ' .nii$' ]);
118-
119- layers(2 ).opacity.label = ' F' ;
120-
121- load(fullfile(color_map_folder , ' 1hot_iso.mat' ));
122- layers(2 ).color.map = hot ;
123-
124- hdr = spm_vol(opacityFile );
125- [max_val , min_val ] = slover(' volmaxmin' , hdr );
126- layers(2 ).color.range = [0 max_val ];
127-
128- layers(2 ).opacity.range = [0 5 ];
129- end
130- layers(2 ).opacity.file = opacityFile ;
131-
132- %% Contour
133- if opt .results(iRes ).binary
134- layers(3 ) = setFields(layers(3 ), opt .results(iRes ).sdConfig.layers{3 }, overwrite );
135- contour = spm_select(' FPList' , ffxDir , [' ^sub.*' contrastNb ' .*_mask.nii' ]);
136- layers(3 ).color.file = contour ;
137- end
138-
139- %% Settings
140- settings = opt .results(iRes ).sdConfig.settings;
141-
142- % we reuse the details for the SPM montage
143- settings.slice.disp_slices = opt .results(1 ).montage.slices;
144- settings.slice.orientation = opt .results(1 ).montage.orientation;
145-
146- settings.fig_specs.title = title ;
147-
148- %% Display the layers
149- [settings , p ] = sd_display(layers , settings );
150-
151- end
152-
153- end
154-
155- end
156- end
33+ transparentMontage(opt )
0 commit comments