@@ -19,16 +19,55 @@ function test_bidsConcatBetaTmapsBasic()
1919 opt.model.file = spm_file(opt .model .file , ' filename' , ' model-vismotionMVPA_smdl.json' );
2020 opt.model.bm = BidsModel(' file' , opt .model .file );
2121
22+ tmpDir = tempname ;
23+ copyfile(opt .dir .stats , tmpDir );
24+
25+ opt.dir.stats = tmpDir ;
26+
27+ % update content of FFX dir to mock 2 sessions
28+ targetDir = fullfile(opt .dir .stats , ...
29+ [' sub-' subLabel ], ...
30+ ' task-vismotion_space-IXI549Space_FWHM-6' );
31+
32+ prefixes = {' beta' , ' spmT' };
33+ for iPrefix = 1 : numel(prefixes )
34+ files = spm_select(' FPList' , targetDir , [' ^' prefixes{iPrefix } ' .*nii' ]);
35+ for i = 1 : size(files , 1 )
36+ number = sprintf(' %04.0f ' , i + size(files , 1 ));
37+ newFile = spm_file(files(i , : ), ...
38+ ' filename' , ...
39+ [' beta_' number ' .nii' ]);
40+ copyfile(files(i , : ), newFile );
41+ end
42+ end
43+
44+ load(fullfile(targetDir , ' SPM.mat' ), ' SPM' );
45+
46+ names = SPM .xX .name ; % #ok<*NODEF>
47+ for i = 1 : numel(SPM .xX .name )
48+ new_name = strrep(names{i }, ' Sn(1)' , ' Sn(2)' );
49+ names{end + 1 } = new_name ; % #ok<AGROW>
50+ end
51+ SPM.xX.name = names ;
52+
53+ SPM .Sess(2 ).col = SPM .Sess(1 ).col + numel(SPM .Sess(1 ).col);
54+
55+ save(fullfile(targetDir , ' SPM.mat' ), ' SPM' );
56+
57+ %% act
2258 bidsConcatBetaTmaps(opt );
2359
60+ %% assert
2461 ffxDir = getFFXdir(subLabel , opt );
2562 content = bids .util .tsvread(fullfile(ffxDir , ...
2663 ' sub-01_task-vismotion_space-IXI549Space_labelfold.tsv' ));
2764
28- expectedContent = struct(' labels' , {{' VisMot*bf(1)' ; ' VisStat*bf(1)' }}, ' folds' , [1 ; 1 ]);
65+ expectedContent = struct(' labels' , {{' VisMot*bf(1)' ; ...
66+ ' VisMot*bf(1)' ; ...
67+ ' VisStat*bf(1)' ; ...
68+ ' VisStat*bf(1)' }}, ...
69+ ' folds' , [1 ; 2 ; 1 ; 2 ]);
2970
3071 assertEqual(content , expectedContent );
3172
32- delete(fullfile(ffxDir , ' sub-01_task-vismotion_space-IXI549Space_labelfold.tsv' ));
33-
3473end
0 commit comments