@@ -9,9 +9,9 @@ function bidsConcatBetaTmaps(opt, funcFWHM, deleteIndBeta, deleteIndTmaps)
99 % :param funcFWHM: smoothing (FWHM) applied to the the normalized EPI
1010 % :type funcFWHM: (scalar)
1111 % :param deleteIndBeta: decide to delete beta-maps
12- % :type funcFWHM : (boolean)
12+ % :type deleteIndBeta : (boolean)
1313 % :param deleteIndTmaps: decide to delete t-maps
14- % :type funcFWHM : (boolean)
14+ % :type deleteIndTmaps : (boolean)
1515 %
1616 % When concatenating betamaps:
1717 %
@@ -22,12 +22,16 @@ function bidsConcatBetaTmaps(opt, funcFWHM, deleteIndBeta, deleteIndTmaps)
2222 %
2323 % (C) Copyright 2019 CPP_SPM developers
2424
25+ [~ , opt ] = setUpWorkflow(opt , ' merge beta images and t-maps' );
26+
2527 if nargin < 3
26- deleteIndBeta = 1 ;
27- deleteIndTmaps = 1 ;
28+ deleteIndBeta = true ;
29+ deleteIndTmaps = true ;
30+ end
31+ if opt .dryRun
32+ deleteIndBeta = false ;
33+ deleteIndTmaps = false ;
2834 end
29-
30- [~ , opt ] = setUpWorkflow(opt , ' merge beta images and t-maps' );
3135
3236 RT = 0 ;
3337
@@ -49,15 +53,17 @@ function bidsConcatBetaTmaps(opt, funcFWHM, deleteIndBeta, deleteIndTmaps)
4953 t_maps = cell(length(contrasts ), 1 );
5054
5155 % path to beta and t-map files.
56+ fprintf(1 , ' \n Concatenating the following contrasts:' );
5257 for iContrast = 1 : length(beta_maps )
5358
59+ fprintf(1 , ' \n\t%s ' , contrasts(iContrast ).name);
5460 betasIndices = find(contrasts(iContrast ).C);
5561
5662 if numel(betasIndices ) > 1
5763 error(' Supposed to concatenate one beta image per contrast.' );
5864 end
5965
60- % for this beta iamge we identify
66+ % for this beta image we identify
6167 % - which run it came from
6268 % - the exact condition name stored in the SPM.mat
6369 % so they can be saved in a tsv for for "label" and "fold" for MVPA
@@ -72,7 +78,6 @@ function bidsConcatBetaTmaps(opt, funcFWHM, deleteIndBeta, deleteIndTmaps)
7278 fileName = validationInputFile(ffxDir , fileName );
7379 beta_maps{iContrast , 1 } = [fileName , ' ,1' ];
7480
75- % while the contrastes (t-maps) are not from the index. They were created
7681 fileName = sprintf(' spmT_%04d .nii' , iContrast );
7782 fileName = validationInputFile(ffxDir , fileName );
7883 t_maps{iContrast , 1 } = [fileName , ' ,1' ];
@@ -93,6 +98,7 @@ function bidsConcatBetaTmaps(opt, funcFWHM, deleteIndBeta, deleteIndTmaps)
9398
9499 spm_save(fullfile(ffxDir , tsvName ), tsvContent );
95100
101+ % TODO in the dev branch make those output filenames "BIDS derivatives" compliant
96102 % beta maps
97103 outputName = [' 4D_beta_' , num2str(funcFWHM ), ' .nii' ];
98104
@@ -104,7 +110,9 @@ function bidsConcatBetaTmaps(opt, funcFWHM, deleteIndBeta, deleteIndTmaps)
104110
105111 matlabbatch = setBatch3Dto4D(matlabbatch , t_maps , RT , outputName );
106112
107- saveAndRunWorkflow(matlabbatch , ' concat_betaImg_tMaps' , opt , subLabel );
113+ if ~opt .dryRun
114+ saveAndRunWorkflow(matlabbatch , ' concat_betaImg_tMaps' , opt , subLabel );
115+ end
108116
109117 removeBetaImgTmaps(t_maps , deleteIndBeta , deleteIndTmaps , ffxDir );
110118
@@ -139,6 +147,7 @@ function removeBetaImgTmaps(t_maps, deleteIndBeta, deleteIndTmaps, ffxDir)
139147 delete(t_maps{iTmap }(1 : end - 2 ));
140148 end
141149 fprintf(' Done. \n\n\n ' );
150+
142151 end
143152
144153end
0 commit comments