diff --git a/.gitignore b/.gitignore index c8ee36cd..c1e90af9 100644 --- a/.gitignore +++ b/.gitignore @@ -19,16 +19,20 @@ demos/MoAE/output/* demos/spm*/raw demos/spm*/source -# test folder +# test folder and dummy data tests/sub-01/* tests/group/* tests/models/*.json +tests/dummyData/derivatives/cpp_spm/sub-*/*/*/*.nii +tests/dummyData/derivatives/cpp_spm/sub-*/*/*/*.tsv +tests/dummyData/derivatives/cpp_spm/sub-*/*/*/*.txt +tests/dummyData/derivatives/cpp_spm/sub-*/*/*/*.json +tests/dummyData/derivatives/cpp_spm/sub-*/stats/*/*/*.nii # ignore content of the build folder of the doc docs/build/* # ignore virtual env -cpp_bids_spm/* cpp_spm/* # visual studio code stuff diff --git a/.travis.yml b/.travis.yml index 6c8261b7..51d6f19f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -69,7 +69,12 @@ jobs: - mkdir $output_folder - curl http://www.fil.ion.ucl.ac.uk/spm/download/data/MoAEpilot/MoAEpilot.bids.zip --output $output_folder'MoAEpilot.zip' - unzip $output_folder'MoAEpilot.zip' -d $output_folder - + + # generate dummy data + - cd tests + - sh createDummyDataSet.sh + - cd .. + script: - octave $OCTFLAGS --eval "runTests" - cat test_report.log | grep 0 diff --git a/docs/source/conf.py b/docs/source/conf.py index 20cb5e99..6a74fafa 100644 --- a/docs/source/conf.py +++ b/docs/source/conf.py @@ -17,9 +17,9 @@ # -- Project information ----------------------------------------------------- -project = 'CPP BIDS SPM' -copyright = '2020, the CPP BIDS SPM pipeline dev team' -author = 'the CPP BIDS SPM pipeline dev team' +project = 'CPP SPM' +copyright = '2020, the CPP SPM pipeline dev team' +author = 'the CPP SPM pipeline dev team' # The full version, including alpha/beta/rc tags release = 'v0.1.0' diff --git a/manualTests/test_setBatchCoregistrationFmap.m b/manualTests/test_setBatchCoregistrationFmap.m new file mode 100644 index 00000000..c9a0c5f2 --- /dev/null +++ b/manualTests/test_setBatchCoregistrationFmap.m @@ -0,0 +1,63 @@ +function test_suite = test_setBatchCoregistrationFmap %#ok<*STOUT> + try % assignment of 'localfunctions' is necessary in Matlab >= 2016 + test_functions = localfunctions(); %#ok<*NASGU> + catch % no problem; early Matlab versions can use initTestSuite fine + end + initTestSuite; +end + +function test_setBatchCoregistrationFmapBasic() + + subID = '01'; + + opt.taskName = 'vismotion'; + opt.derivativesDir = fullfile(fileparts(mfilename('fullpath')), 'dummyData'); + + opt = checkOptions(opt); + + [~, opt, BIDS] = getData(opt); + + matlabbatch = []; + matlabbatch = setBatchCoregistrationFmap(matlabbatch, BIDS, opt, subID); + + directory = fullfile(opt.derivativesDir, ... + 'sub-01', ... + 'ses-01'); + ref = fullfile(directory, ... + 'func', ... + 'mean_sub-01_ses-01_task-vismotion_run-1_bold.nii'); + + expectedbatch = []; + + src = fullfile(directory, ... + 'fmap', ... + 'sub-01_ses-01_run-2_magnitude1.nii'); + other = {fullfile(directory, ... + 'fmap', ... + 'sub-01_ses-01_run-2_magnitude2.nii'); ... + fullfile(directory, ... + 'fmap', ... + 'sub-01_ses-01_run-2_phasediff.nii')}; + expectedbatch{end + 1}.spm.spatial.coreg.estimate.ref = { ref }; + expectedbatch{end}.spm.spatial.coreg.estimate.source = { src }; + expectedbatch{end}.spm.spatial.coreg.estimate.other = other; + + directory = fullfile(opt.derivativesDir, ... + 'sub-01', ... + 'ses-02'); + src = fullfile(directory, ... + 'fmap', ... + 'sub-01_ses-02_run-2_magnitude1.nii'); + other = {fullfile(directory, ... + 'fmap', ... + 'sub-01_ses-02_run-2_magnitude2.nii'); ... + fullfile(directory, ... + 'fmap', ... + 'sub-01_ses-02_run-2_phasediff.nii')}; + expectedbatch{end + 1}.spm.spatial.coreg.estimate.ref = { ref }; + expectedbatch{end}.spm.spatial.coreg.estimate.source = { src }; + expectedbatch{end}.spm.spatial.coreg.estimate.other = other; + + assertEqual(matlabbatch, expectedbatch); + +end diff --git a/manualTests/test_setBatchCreateVDMs.m b/manualTests/test_setBatchCreateVDMs.m new file mode 100644 index 00000000..3ebd8de5 --- /dev/null +++ b/manualTests/test_setBatchCreateVDMs.m @@ -0,0 +1,30 @@ +function test_suite = test_setBatchCreateVDMs %#ok<*STOUT> + try % assignment of 'localfunctions' is necessary in Matlab >= 2016 + test_functions = localfunctions(); %#ok<*NASGU> + catch % no problem; early Matlab versions can use initTestSuite fine + end + initTestSuite; +end + +function test_setBatchCreateVDMsBasic() + + subID = '01'; + + opt.taskName = 'vismotion'; + opt.derivativesDir = fullfile(fileparts(mfilename('fullpath')), 'dummyData'); + opt.taskName = 'vismotion'; + + opt = checkOptions(opt); + + [~, opt, BIDS] = getData(opt); + + matlabbatch = []; + matlabbatch = setBatchCreateVDMs(matlabbatch, BIDS, opt, subID); + + % matlabbatch{1}.spm.tools.fieldmap.calculatevdm.subj + + % expectedBatch = returnExpectedBatch(refImage); + % + % assertEqual(matlabbatch, expectedBatch); + +end diff --git a/src/batches/setBatch3Dto4D.m b/src/batches/setBatch3Dto4D.m index 524e5fa4..90e761bb 100644 --- a/src/batches/setBatch3Dto4D.m +++ b/src/batches/setBatch3Dto4D.m @@ -1,30 +1,52 @@ % (C) Copyright 2020 CPP BIDS SPM-pipeline developers -function matlabbatch = setBatch3Dto4D(volumesList, outputName, dataType, RT) +function matlabbatch = setBatch3Dto4D(matlabbatch, volumesList, RT, outputName, dataType) % % Set the batch for 3D to 4D conversion % % USAGE:: % - % matlabbatch = setBatch3Dto4D(volumesList, outputName, dataType, RT) + % matlabbatch = setBatch3Dto4D(matlabbatch, volumesList, RT, [outputName], [dataType]) % + % :param matlabbatch: + % :type matlabbatch: structure % :param volumesList: List of volumes to be converted in a single 4D brain % :type volumesList: array - % :param outputName: Obligatory argument. The string that will be used to save the 4D brain + % :param outputName: The string that will be used to save the 4D brain % :type outputName: string - % :param dataType: Obligatory argument. It identifies the data format conversion + % :param dataType: It identifies the data format conversion % :type dataType: integer - % :param RT: Obligatory argument. It identifies the TR in secof the volumes to be written in the - % 4D file header + % :param RT: It identifies the TR in seconds of the volumes + % to be written in the 4D file header % :type RT: float % % :returns: - :matlabbatch: (structure) The matlabbatch ready to run the spm job + % + % ``dataType``: + % + % - 0: SAME + % - 2: UINT8 - unsigned char + % - 4: INT16 - signed short + % - 8: INT32 - signed int + % - 16: FLOAT32 - single prec. float + % - 64: FLOAT64 - double prec. float + % + + if nargin < 5 || isempty(dataType) + dataType = 0; + end + + if nargin < 4 || isempty(outputName) + outputName = deblank(volumesList(1, :)); + [pth, filename, ext] = spm_fileparts(outputName); + outputName = fullfile(pth, [filename, '_4D', ext]); + end - fprintf(1, 'PREPARING: 3D to 4D conversion\n'); + printBatchName('3D to 4D conversion'); - matlabbatch{1}.spm.util.cat.vols = volumesList; - matlabbatch{1}.spm.util.cat.name = outputName; - matlabbatch{1}.spm.util.cat.dtype = dataType; - matlabbatch{1}.spm.util.cat.RT = RT; + matlabbatch{end + 1}.spm.util.cat.vols = volumesList; + matlabbatch{end}.spm.util.cat.name = outputName; + matlabbatch{end}.spm.util.cat.dtype = dataType; + matlabbatch{end}.spm.util.cat.RT = RT; end diff --git a/src/batches/setBatchComputeVDM.m b/src/batches/setBatchComputeVDM.m index 3a368e9a..00321ae4 100644 --- a/src/batches/setBatchComputeVDM.m +++ b/src/batches/setBatchComputeVDM.m @@ -6,7 +6,7 @@ % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % matlabbatch = setBatchComputeVDM(matlabbatch, fmapType, refImage) % % :param matlabbatch: list of SPM batches % :type matlabbatch: structure @@ -28,7 +28,7 @@ matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj(1).data.presubphasemag.magnitude = ''; case 'phase&mag' - matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj(1).data.phasemag.shortphase = ''; + matlabbatch{end + 1}.spm.tools.fieldmap.calculatevdm.subj(1).data.phasemag.shortphase = ''; matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj(1).data.phasemag.shortmag = ''; matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj(1).data.phasemag.longphase = ''; matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj(1).data.phasemag.longmag = ''; diff --git a/src/batches/setBatchContrasts.m b/src/batches/setBatchContrasts.m new file mode 100644 index 00000000..ea047235 --- /dev/null +++ b/src/batches/setBatchContrasts.m @@ -0,0 +1,27 @@ +% (C) Copyright 2019 CPP BIDS SPM-pipeline developers + +function matlabbatch = setBatchContrasts(matlabbatch, spmMatFile, consess) + % + % Short description of what the function does goes here. + % + % USAGE:: + % + % matlabbatch = setBatchContrasts(matlabbatch, spmMatFile, consess) + % + % :param matlabbatch: + % :type matlabbatch: structure + % :param spmMatFile: + % :type spmMatFile: string + % :param consess: + % :type consess: cell + % + % :returns: - :matlabbatch: (structure) + % + + printBatchName('contrasts specification'); + + matlabbatch{end + 1}.spm.stats.con.spmmat = spmMatFile; + matlabbatch{end}.spm.stats.con.consess = consess; + matlabbatch{end}.spm.stats.con.delete = 1; + +end diff --git a/src/batches/setBatchCoregistrationFmap.m b/src/batches/setBatchCoregistrationFmap.m index a9538cd5..5ca129c7 100644 --- a/src/batches/setBatchCoregistrationFmap.m +++ b/src/batches/setBatchCoregistrationFmap.m @@ -1,70 +1,71 @@ % (C) Copyright 2020 CPP BIDS SPM-pipeline developers -function matlabbatch = setBatchCoregistrationFmap(BIDS, opt, subID) - % - % Set the batch for the coregistration of field maps - % - % USAGE:: - % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) - % - % :param BIDS: BIDS layout returned by ``getData``. - % :type BIDS: structure - % :param opt: structure or json filename containing the options. See - % ``checkOptions()`` and ``loadAndCheckOptions()``. - % :type opt: structure - % :param subID: subject ID - % :type subID: string - % - % :returns: - :matlabbatch: (structure) The matlabbatch ready to run the spm job - % - - % TODO - % assumes all the fieldmap relate to the current task - % - use the "for" metadata field - % - implement for 'phase12', 'fieldmap', 'epi' - - printBatchName('coregister fieldmaps data to functional'); - - % Create rough mean of the 1rst run to improve SNR for coregistration - % TODO use the slice timed EPI if STC was used ? - [sessions, nbSessions] = getInfo(BIDS, subID, opt, 'Sessions'); - runs = getInfo(BIDS, subID, opt, 'Runs', sessions{1}); - [fileName, subFuncDataDir] = getBoldFilename(BIDS, subID, sessions{1}, runs{1}, opt); - - spmup_basics(fullfile(subFuncDataDir, fileName), 'mean'); - - refImage = fullfile(subFuncDataDir, ['mean_', fileName]); - - matlabbatch = []; - - for iSes = 1:nbSessions - - runs = bids.query(BIDS, 'runs', ... - 'modality', 'fmap', ... - 'sub', subID, ... - 'ses', sessions{iSes}); - - for iRun = 1:numel(runs) - - % TODO - % - Move to getInfo - fmapFiles = bids.query(BIDS, 'data', ... - 'modality', 'fmap', ... - 'sub', subID, ... - 'ses', sessions{iSes}, ... - 'run', runs{iRun}); - - srcImage = strrep(fmapFiles{1}, 'phasediff', 'magnitude1'); - - otherImages = cell(2, 1); - otherImages{1} = strrep(fmapFiles{1}, 'phasediff', 'magnitude2'); - otherImages{2} = fmapFiles{1}; - - matlabbatch = setBatchCoregistration(matlabbatch, refImage, srcImage, otherImages); - +function matlabbatch = setBatchCoregistrationFmap(matlabbatch, BIDS, opt, subID) + % + % Set the batch for the coregistration of field maps + % + % USAGE:: + % + % matlabbatch = setBatchCoregistrationFmap(matlabbatch, BIDS, opt, subID) + % + % :param BIDS: BIDS layout returned by ``getData``. + % :type BIDS: structure + % :param opt: structure or json filename containing the options. See + % ``checkOptions()`` and ``loadAndCheckOptions()``. + % :type opt: structure + % :param subID: subject ID + % :type subID: string + % + % :returns: - :matlabbatch: (structure) The matlabbatch ready to run the spm job + % + + % TODO + % - implement for 'phase12', 'fieldmap', 'epi' + + printBatchName('coregister fieldmaps data to functional'); + + % Use a rough mean of the 1rst run to improve SNR for coregistration + % created by spmup + [sessions, nbSessions] = getInfo(BIDS, subID, opt, 'Sessions'); + runs = getInfo(BIDS, subID, opt, 'Runs', sessions{1}); + [fileName, subFuncDataDir] = getBoldFilename(BIDS, subID, sessions{1}, runs{1}, opt); + refImage = validationInputFile(subFuncDataDir, fileName, 'mean_'); + + for iSes = 1:nbSessions + + runs = bids.query(BIDS, 'runs', ... + 'modality', 'fmap', ... + 'sub', subID, ... + 'ses', sessions{iSes}); + + for iRun = 1:numel(runs) + + metadata = bids.query(BIDS, 'metadata', ... + 'modality', 'fmap', ... + 'sub', subID, ... + 'ses', sessions{iSes}, ... + 'run', runs{iRun}); + + if strfind(metadata.IntendedFor, opt.taskName) + + fmapFiles = bids.query(BIDS, 'data', ... + 'modality', 'fmap', ... + 'sub', subID, ... + 'ses', sessions{iSes}, ... + 'run', runs{iRun}); + + srcImage = strrep(fmapFiles{1}, 'phasediff', 'magnitude1'); + + otherImages = cell(2, 1); + otherImages{1} = strrep(fmapFiles{1}, 'phasediff', 'magnitude2'); + otherImages{2} = fmapFiles{1}; + + matlabbatch = setBatchCoregistration(matlabbatch, refImage, srcImage, otherImages); + + end + + end + end - - end - + end diff --git a/src/batches/setBatchCoregistrationFuncToAnat.m b/src/batches/setBatchCoregistrationFuncToAnat.m index bb70d1a0..f1b54fe5 100644 --- a/src/batches/setBatchCoregistrationFuncToAnat.m +++ b/src/batches/setBatchCoregistrationFuncToAnat.m @@ -1,6 +1,6 @@ % (C) Copyright 2020 CPP BIDS SPM-pipeline developers -function matlabbatch = setBatchCoregistrationFuncToAnat(matlabbatch, BIDS, subID, opt) +function matlabbatch = setBatchCoregistrationFuncToAnat(matlabbatch, BIDS, opt, subID) % % Set the batch for corregistering the functional images to the % anatomical image diff --git a/src/batches/setBatchCreateVDMs.m b/src/batches/setBatchCreateVDMs.m index 7d0b58ba..db39c6bc 100644 --- a/src/batches/setBatchCreateVDMs.m +++ b/src/batches/setBatchCreateVDMs.m @@ -1,121 +1,131 @@ % (C) Copyright 2020 CPP BIDS SPM-pipeline developers -function matlabbatch = setBatchCreateVDMs(BIDS, opt, subID) - % - % Short description of what the function does goes here. - % - % USAGE:: - % - % matlabbatch = setBatchCreateVDMs(BIDS, opt, subID) - % - % :param BIDS: BIDS layout returned by ``getData``. - % :type BIDS: structure - % :param opt: structure or json filename containing the options. See - % ``checkOptions()`` and ``loadAndCheckOptions()``. - % :type opt: structure - % :param subID: subject ID - % :type subID: string - % - % :returns: - :matlabbatch: (structure) The matlabbatch ready to run the spm job - % - % TODO - % assumes all the fieldmap relate to the current task - % - implement for 'phase12', 'fieldmap', 'epi' - - printBatchName('create voxel displacement map'); - - [sessions, nbSessions] = getInfo(BIDS, subID, opt, 'Sessions'); - - runs = getInfo(BIDS, subID, opt, 'Runs', sessions{1}); - [fileName, subFuncDataDir] = getBoldFilename(BIDS, subID, sessions{1}, runs{1}, opt); - refImage = validationInputFile(subFuncDataDir, fileName, 'mean_'); - - matlabbatch = []; - for iSes = 1:nbSessions - - runs = bids.query(BIDS, 'runs', ... - 'modality', 'fmap', ... - 'sub', subID, ... - 'ses', sessions{iSes}); - - for iRun = 1:numel(runs) - - matlabbatch = setBatchComputeVDM(matlabbatch, 'phasediff', refImage); - - % TODO - % Move to getInfo ? - fmapFiles = bids.query(BIDS, 'data', ... - 'modality', 'fmap', ... - 'sub', subID, ... - 'ses', sessions{iSes}, ... - 'run', runs{iRun}); - - phaseImage = fmapFiles{1}; - matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj.data.presubphasemag.phase = ... - {phaseImage}; - - magnitudeImage = strrep(phaseImage, 'phasediff', 'magnitude1'); - matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj.data.presubphasemag.magnitude = ... - {magnitudeImage}; - - [echotimes, isEPI, totReadTime, blipDir] = getMetadataForVDM(BIDS, ... - subID, ... - sessions{iSes}, ... - runs{iRun}); - - matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj.defaults.defaultsval.et = echotimes; - matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj.defaults.defaultsval.tert = totReadTime; - matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj.defaults.defaultsval.blipdir = blipDir; - matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj.defaults.defaultsval.epifm = isEPI; - +function matlabbatch = setBatchCreateVDMs(matlabbatch, BIDS, opt, subID) + % + % Short description of what the function does goes here. + % + % USAGE:: + % + % matlabbatch = setBatchCreateVDMs(matlabbatch, BIDS, opt, subID) + % + % :param matlabbatch: + % :type matlabbatch: structure + % :param BIDS: BIDS layout returned by ``getData``. + % :type BIDS: structure + % :param opt: structure or json filename containing the options. See + % ``checkOptions()`` and ``loadAndCheckOptions()``. + % :type opt: structure + % :param subID: subject ID + % :type subID: string + % + % :returns: - :matlabbatch: (structure) The matlabbatch ready to run the spm job + % + % TODO + % - implement for 'phase12', 'fieldmap', 'epi' + + printBatchName('create voxel displacement map'); + + [sessions, nbSessions] = getInfo(BIDS, subID, opt, 'Sessions'); + + runs = getInfo(BIDS, subID, opt, 'Runs', sessions{1}); + [fileName, subFuncDataDir] = getBoldFilename(BIDS, subID, sessions{1}, runs{1}, opt); + refImage = validationInputFile(subFuncDataDir, fileName, 'mean_'); + + for iSes = 1:nbSessions + + runs = bids.query(BIDS, 'runs', ... + 'modality', 'fmap', ... + 'sub', subID, ... + 'ses', sessions{iSes}); + + for iRun = 1:numel(runs) + + metadata = bids.query(BIDS, 'metadata', ... + 'modality', 'fmap', ... + 'sub', subID, ... + 'ses', sessions{iSes}, ... + 'run', runs{iRun}); + + if strfind(metadata.IntendedFor, opt.taskName) + + matlabbatch = setBatchComputeVDM(matlabbatch, 'phasediff', refImage); + + % TODO + % Move to getInfo ? + fmapFiles = bids.query(BIDS, 'data', ... + 'modality', 'fmap', ... + 'sub', subID, ... + 'ses', sessions{iSes}, ... + 'run', runs{iRun}); + + phaseImage = fmapFiles{1}; + matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj.data.presubphasemag.phase = ... + {phaseImage}; + + magnitudeImage = strrep(phaseImage, 'phasediff', 'magnitude1'); + matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj.data.presubphasemag.magnitude = ... + {magnitudeImage}; + + [echotimes, isEPI, totReadTime, blipDir] = getMetadataForVDM(BIDS, ... + subID, ... + sessions{iSes}, ... + runs{iRun}); + + matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj.defaults.defaultsval.et = echotimes; + matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj.defaults.defaultsval.tert = totReadTime; + matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj.defaults.defaultsval.blipdir = blipDir; + matlabbatch{end}.spm.tools.fieldmap.calculatevdm.subj.defaults.defaultsval.epifm = isEPI; + + end + + end + end - - end - + end function varargout = getMetadataForVDM(BIDS, subID, sessionID, runID) - - % get metadata fmap and its associated func files - fmapMetadata = bids.query(BIDS, 'metadata', ... - 'modality', 'fmap', ... - 'sub', subID, ... - 'ses', sessionID, ... - 'run', runID); - if numel(fmapMetadata) > 1 - fmapMetadata = fmapMetadata{1}; - end - - echotimes = getEchoTimes(fmapMetadata); - - isEPI = checkFmapPulseSequenceType(fmapMetadata); - - varargout{1} = echotimes; - varargout{2} = isEPI; - - [totalReadoutTime, blipDir] = getMetadataFromIntendedForFunc(BIDS, fmapMetadata); - - varargout{3} = totalReadoutTime; - varargout{4} = blipDir; - + + % get metadata fmap and its associated func files + fmapMetadata = bids.query(BIDS, 'metadata', ... + 'modality', 'fmap', ... + 'sub', subID, ... + 'ses', sessionID, ... + 'run', runID); + if numel(fmapMetadata) > 1 + fmapMetadata = fmapMetadata{1}; + end + + echotimes = getEchoTimes(fmapMetadata); + + isEPI = checkFmapPulseSequenceType(fmapMetadata); + + varargout{1} = echotimes; + varargout{2} = isEPI; + + [totalReadoutTime, blipDir] = getMetadataFromIntendedForFunc(BIDS, fmapMetadata); + + varargout{3} = totalReadoutTime; + varargout{4} = blipDir; + end function echotimes = getEchoTimes(fmapMetadata) - - echotimes = 1000 * [ ... - fmapMetadata.EchoTime1, ... - fmapMetadata.EchoTime2]; % in milliseconds - + + echotimes = 1000 * [ ... + fmapMetadata.EchoTime1, ... + fmapMetadata.EchoTime2]; % in milliseconds + end function isEPI = checkFmapPulseSequenceType(fmapMetadata) - - isEPI = 0; - - if isfield(fmapMetadata, 'PulseSequenceType') && ... - sum(strfind(fmapMetadata.PulseSequenceType, 'EPI')) ~= 0 - - isEPI = 1; - end - + + isEPI = 0; + + if isfield(fmapMetadata, 'PulseSequenceType') && ... + sum(strfind(fmapMetadata.PulseSequenceType, 'EPI')) ~= 0 + + isEPI = 1; + end + end diff --git a/src/batches/setBatchEstimateModel.m b/src/batches/setBatchEstimateModel.m new file mode 100644 index 00000000..777cfea7 --- /dev/null +++ b/src/batches/setBatchEstimateModel.m @@ -0,0 +1,59 @@ +% (C) Copyright 2019 CPP BIDS SPM-pipeline developers + +function matlabbatch = setBatchEstimateModel(matlabbatch, grpLvlCon) + % + % Short description of what the function does goes here. + % + % USAGE:: + % + % matlabbatch = setBatchEstimateModel(matlabbatch, grpLvlCon) + % + % :param matlabbatch: + % :type matlabbatch: structure + % :param grpLvlCon: + % :type grpLvlCon: + % + % :returns: - :matlabbatch: (structure) + % + + switch nargin + + case 1 + + printBatchName('estimate subject level fmri model'); + + spmMatFile = cfg_dep( ... + 'fMRI model specification SPM file', ... + substruct( ... + '.', 'val', '{}', {1}, ... + '.', 'val', '{}', {1}, ... + '.', 'val', '{}', {1}), ... + substruct('.', 'spmmat')); + + matlabbatch = returnEstimateModelBatch(spmMatFile); + + case 2 + + printBatchName('estimate group level fmri model'); + + for j = 1:size(grpLvlCon, 1) + + conName = rmTrialTypeStr(grpLvlCon{j}); + + spmMatFile = { fullfile(rfxDir, conName, 'SPM.mat') }; + + matlabbatch = returnEstimateModelBatch(spmMatFile); + + end + + end + +end + +function matlabbatch = returnEstimateModelBatch(spmMatFile) + + matlabbatch{end + 1}.spm.stats.fmri_est.method.Classical = 1; + matlabbatch{end}.spm.stats.fmri_est.write_residuals = 1; + matlabbatch{end}.spm.stats.fmri_est.spmmat = spmMatFile; + +end diff --git a/src/batches/setBatchFactorialDesign.m b/src/batches/setBatchFactorialDesign.m index 07dfa40e..6b5d46b3 100644 --- a/src/batches/setBatchFactorialDesign.m +++ b/src/batches/setBatchFactorialDesign.m @@ -1,23 +1,23 @@ % (C) Copyright 2019 CPP BIDS SPM-pipeline developers -function matlabbatch = setBatchFactorialDesign(grpLvlCon, group, conFWHM, rfxDir) +function matlabbatch = setBatchFactorialDesign(matlabbatch, opt, funcFWHM, conFWHM) % % Short description of what the function does goes here. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % matlabbatch = setBatchFactorialDesign(matlabbatch, opt, funcFWHM, conFWHM) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument + % :param matlabbatch: + % :type matlabbatch: structure + % :param opt: + % :type opt: structure + % :param funcFWHM: + % :type funcFWHM: + % :param conFWHM: + % :type conFWHM: % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :returns: - :matlabbatch: (structure) % printBatchName('specify group level fmri model'); @@ -27,8 +27,12 @@ if conFWHM > 0 smoothPrefix = ['s', num2str(conFWHM)]; end + + [group, opt] = getData(opt); - con = 0; + rfxDir = getRFXdir(opt, funcFWHM, conFWHM); + + grpLvlCon = getGrpLevelContrastToCompute(opt); % For each contrast for j = 1:size(grpLvlCon, 1) @@ -37,16 +41,25 @@ % 'trial_type.' because contrasts against baseline are renamed % at the subject level conName = rmTrialTypeStr(grpLvlCon{j}); + + fprintf(1, '\n\n Group contrast: %s\n\n', conName); + + directory = fullfile(rfxDir, conName); + + % If it exists, issue a warning that it has been overwritten + if exist(directory, 'dir') + warning('overwriting directory: %s \n', directory); + rmdir(directory, 's'); + end - con = con + 1; + mkdir(directory); % For each group for iGroup = 1:length(group) groupName = group(iGroup).name; - matlabbatch{j}.spm.stats.factorial_design.des.fd.icell(iGroup).levels = ... - iGroup; %#ok<*AGROW> + icell(iGroup).levels = iGroup; %#ok<*AGROW> for iSub = 1:group(iGroup).numSub @@ -64,42 +77,43 @@ fileName = sprintf('con_%0.4d.nii', conIdx); file = validationInputFile(ffxDir, fileName, smoothPrefix); - matlabbatch{j}.spm.stats.factorial_design.des.fd.icell(iGroup).scans(iSub, :) = ... - {file}; + icell(iGroup).scans(iSub, :) = {file}; + + fprintf(1, ' %s\n\n', file); end end + + matlabbatch = returnFactorialDesignBatch(matlabbatch, directory, icell); - % GROUP and the number of levels in the group. if 2 groups , - % then number of levels = 2 - matlabbatch{j}.spm.stats.factorial_design.des.fd.fact.name = 'GROUP'; - matlabbatch{j}.spm.stats.factorial_design.des.fd.fact.levels = 1; - matlabbatch{j}.spm.stats.factorial_design.des.fd.fact.dept = 0; - - % 1: Assumes that the variance is not the same across groups - % 0: There is no difference in the variance between groups - matlabbatch{j}.spm.stats.factorial_design.des.fd.fact.variance = 1; - matlabbatch{j}.spm.stats.factorial_design.des.fd.fact.gmsca = 0; - matlabbatch{j}.spm.stats.factorial_design.des.fd.fact.ancova = 0; - % matlabbatch{j}.spm.stats.factorial_design.cov = []; - matlabbatch{j}.spm.stats.factorial_design.masking.tm.tm_none = 1; - matlabbatch{j}.spm.stats.factorial_design.masking.im = 1; - matlabbatch{j}.spm.stats.factorial_design.masking.em = { ... - fullfile(rfxDir, 'MeanMask.nii')}; - matlabbatch{j}.spm.stats.factorial_design.globalc.g_omit = 1; - matlabbatch{j}.spm.stats.factorial_design.globalm.gmsca.gmsca_no = 1; - matlabbatch{j}.spm.stats.factorial_design.globalm.glonorm = 1; - - % If it exists, issue a warning that it has been overwritten - if exist(fullfile(rfxDir, conName), 'dir') - warning('overwriting directory: %s \n', fullfile(rfxDir, conName)); - rmdir(fullfile(rfxDir, conName), 's'); - end + end - mkdir(fullfile(rfxDir, conName)); - matlabbatch{j}.spm.stats.factorial_design.dir = { fullfile(rfxDir, conName) }; +end - end +function matlabbatch = returnFactorialDesignBatch(matlabbatch, directory, icell) + + matlabbatch{end + 1}.spm.stats.factorial_design.dir = {directory}; + + matlabbatch{end}.spm.stats.factorial_design.des.fd.icell = icell; + + % GROUP and the number of levels in the group. + % If 2 groups, then number of levels = 2 + matlabbatch{end}.spm.stats.factorial_design.des.fd.fact.name = 'GROUP'; + matlabbatch{end}.spm.stats.factorial_design.des.fd.fact.levels = 1; + matlabbatch{end}.spm.stats.factorial_design.des.fd.fact.dept = 0; + + % 1: Assumes that the variance is not the same across groups + % 0: There is no difference in the variance between groups + matlabbatch{end}.spm.stats.factorial_design.des.fd.fact.variance = 1; + matlabbatch{end}.spm.stats.factorial_design.des.fd.fact.gmsca = 0; + matlabbatch{end}.spm.stats.factorial_design.des.fd.fact.ancova = 0; + % matlabbatch{end}.spm.stats.factorial_design.cov = []; + matlabbatch{end}.spm.stats.factorial_design.masking.tm.tm_none = 1; + matlabbatch{end}.spm.stats.factorial_design.masking.im = 1; + matlabbatch{end}.spm.stats.factorial_design.masking.em = {''}; + matlabbatch{end}.spm.stats.factorial_design.globalc.g_omit = 1; + matlabbatch{end}.spm.stats.factorial_design.globalm.gmsca.gmsca_no = 1; + matlabbatch{end}.spm.stats.factorial_design.globalm.glonorm = 1; end diff --git a/src/batches/setBatchFmriEstimate.m b/src/batches/setBatchFmriEstimate.m deleted file mode 100644 index 629d4c40..00000000 --- a/src/batches/setBatchFmriEstimate.m +++ /dev/null @@ -1,36 +0,0 @@ -% (C) Copyright 2019 CPP BIDS SPM-pipeline developers - -function matlabbatch = setBatchFmriEstimate(matlabbatch) - % - % Short description of what the function does goes here. - % - % USAGE:: - % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) - % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) - % - - printBatchName('estimate subject level fmri model'); - - matlabbatch{2}.spm.stats.fmri_est.spmmat(1) = cfg_dep( ... - 'fMRI model specification SPM file', ... - substruct( ... - '.', 'val', '{}', {1}, ... - '.', 'val', '{}', {1}, ... - '.', 'val', '{}', {1}), ... - substruct('.', 'spmmat')); - - matlabbatch{2}.spm.stats.fmri_est.method.Classical = 1; - matlabbatch{2}.spm.stats.fmri_est.write_residuals = 1; - -end diff --git a/src/batches/setBatchGZip.m b/src/batches/setBatchGZip.m index d20b82dc..81fb9fa5 100644 --- a/src/batches/setBatchGZip.m +++ b/src/batches/setBatchGZip.m @@ -1,13 +1,15 @@ % (C) Copyright 2020 CPP BIDS SPM-pipeline developers -function matlabbatch = setBatchGZip(unzippedNiifiles, keepUnzippedNii) +function matlabbatch = setBatchGZip(matlabbatch, unzippedNiifiles, keepUnzippedNii) % % Set the batch for GZip the 4D volumes % % USAGE:: % - % matlabbatch = setBatchGZip(unzippedNiifiles, keepUnzippedNii) + % matlabbatch = setBatchGZip(matlabbatch, unzippedNiifiles, keepUnzippedNii = false) % + % :param matlabbatch: + % :type matlabbatch: structure % :param unzippedNiifiles: List of volumes to be gzipped % :type unzippedNiifiles: array % :param keepUnzippedNii: Boolean to decide to delete the unzipped files @@ -15,8 +17,15 @@ % % :returns: - :matlabbatch: (struct) The matlabbath ready to run the spm job - matlabbatch{1}.cfg_basicio.file_dir.file_ops.cfg_gzip_files.files = unzippedNiifiles; - matlabbatch{1}.cfg_basicio.file_dir.file_ops.cfg_gzip_files.outdir = {''}; - matlabbatch{1}.cfg_basicio.file_dir.file_ops.cfg_gzip_files.keep = keepUnzippedNii; + if nargin < 3 || isempty(keepUnzippedNii) + % delete the original unzipped .nii + keepUnzippedNii = false; + end + + printBatchName('zipping'); + + matlabbatch{end + 1}.cfg_basicio.file_dir.file_ops.cfg_gzip_files.files = unzippedNiifiles; + matlabbatch{end}.cfg_basicio.file_dir.file_ops.cfg_gzip_files.outdir = {''}; + matlabbatch{end}.cfg_basicio.file_dir.file_ops.cfg_gzip_files.keep = keepUnzippedNii; end diff --git a/src/batches/setBatchGroupLevelContrasts.m b/src/batches/setBatchGroupLevelContrasts.m new file mode 100644 index 00000000..5d83966c --- /dev/null +++ b/src/batches/setBatchGroupLevelContrasts.m @@ -0,0 +1,21 @@ +% (C) Copyright 2019 CPP BIDS SPM-pipeline developers + +function matlabbatch = setBatchGroupLevelContrasts(matlabbatch, grpLvlCon, rfxDir) + + printBatchName('group level contrast estimation'); + + for j = 1:size(grpLvlCon, 1) + + conName = rmTrialTypeStr(grpLvlCon{j}); + + spmMatFile = {fullfile(rfxDir, conName, 'SPM.mat')}; + + consess{1}.tcon.name = 'GROUP'; + consess{1}.tcon.convec = 1; + consess{1}.tcon.sessrep = 'none'; + + matlabbatch = setBatchContrasts(matlabbatch, spmMatFile, consess); + + end + +end diff --git a/src/batches/setBatchImageCalculation.m b/src/batches/setBatchImageCalculation.m index bed63ae9..75e61378 100644 --- a/src/batches/setBatchImageCalculation.m +++ b/src/batches/setBatchImageCalculation.m @@ -2,24 +2,30 @@ function matlabbatch = setBatchImageCalculation(matlabbatch, input, output, outDir, expression) % - % Short description of what the function does goes here. + % Set a batch for a image calculation % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % matlabbatch = setBatchImageCalculation(matlabbatch, input, output, outDir, expression) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument + % :param matlabbatch: + % :type matlabbatch: structure + % :param input: list of images + % :type input: cell + % :param output: name of the output file + % :type output: string + % :param outDir: output directory + % :type outDir: string + % :param expression: mathematical expression to apply (for example '(i1+i2)>3') + % :type expression: string % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :returns: - :matlabbatch: % + if ~iscell(input) + error('The list of images must be in a cell.'); + end + printBatchName('image calculation'); matlabbatch{end + 1}.spm.util.imcalc.input = input; diff --git a/src/batches/setBatchMeanAnatAndMask.m b/src/batches/setBatchMeanAnatAndMask.m index 98ce182c..bd845192 100644 --- a/src/batches/setBatchMeanAnatAndMask.m +++ b/src/batches/setBatchMeanAnatAndMask.m @@ -1,31 +1,30 @@ % (C) Copyright 2019 CPP BIDS SPM-pipeline developers -function matlabbatch = setBatchMeanAnatAndMask(opt, funcFWHM, rfxDir) +function matlabbatch = setBatchMeanAnatAndMask(matlabbatch, opt, funcFWHM, outputDir) % - % Short description of what the function does goes here. + % Creates batxh to create mean anatomical image and a grop mask % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % matlabbatch = setBatchMeanAnatAndMask(matlabbatch, opt, funcFWHM, outputDir) % - % :param argin1: Options chosen for the analysis. See ``checkOptions()``. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument + % :param matlabbatch: + % :type matlabbatch: structure + % :param opt: Options chosen for the analysis. See ``checkOptions()``. + % :type opt: structure + % :param funcFWHM: + % :param outputDir: + % :type outputDir: tring % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :returns: - :matlabbatch: (structure) % [group, opt, BIDS] = getData(opt); - matlabbatch = {}; - printBatchName('create mean anatomical image and mask'); - subCounter = 0; + inputAnat = {}; + inputMask = {}; for iGroup = 1:length(group) @@ -33,13 +32,11 @@ for iSub = 1:group(iGroup).numSub - subCounter = subCounter + 1; - subID = group(iGroup).subNumber{iSub}; printProcessingSubject(groupName, iSub, subID); - %% STRUCTURAL + %% Anat [anatImage, anatDataDir] = getAnatFilename(BIDS, subID, opt); anatImage = validationInputFile( ... @@ -48,50 +45,50 @@ [spm_get_defaults('normalise.write.prefix'), ... spm_get_defaults('deformations.modulate.prefix')]); - matlabbatch{1}.spm.util.imcalc.input{subCounter, :} = anatImage; + inputAnat{end + 1, 1} = anatImage; %#ok<*AGROW> %% Mask ffxDir = getFFXdir(subID, funcFWHM, opt); files = validationInputFile(ffxDir, 'mask.nii'); - matlabbatch{2}.spm.util.imcalc.input{subCounter, :} = files; + inputMask{end + 1, 1} = files; end end %% Generate the equation to get the mean of the mask and structural image % example : if we have 5 subjects, Average equation = '(i1+i2+i3+i4+i5)/5' - nbImg = subCounter; - imgRange = 1:subCounter; + nbImg = numel(inputAnat); + imgRange = 1:nbImg; tmpImg = sprintf('+i%i', imgRange); tmpImg = tmpImg(2:end); sumEquation = ['(', tmpImg, ')']; - % meanStruct_equation = '(i1+i2+i3+i4+i5)/5' - meanStruct_equation = ['(', tmpImg, ')/', num2str(nbImg)]; + %% The mean structural will be saved in the group level folder + % meanStructEquation = '(i1+i2+i3+i4+i5)/5' + meanAnatEquation = [sumEquation, '/', num2str(nbImg)]; + + matlabbatch = setBatchImageCalculation(matlabbatch, ... + inputAnat, ... + 'meanAnat.nii', ... + outputDir, ... + meanAnatEquation); + + %% The mean mask will be saved in the group level folder - % ------ % TODO % not sure this makes sense for the mask as voxels that have no data for one % subject are excluded anyway !!!! - % meanMask_equation = '(i1+i2+i3+i4+i5)>0.75*5' - meanMask_equation = strcat(sumEquation, '>0.75*', num2str(nbImg)); - - %% The mean structural will be saved in the RFX folder - matlabbatch{1}.spm.util.imcalc.output = 'meanAnat.nii'; - matlabbatch{1}.spm.util.imcalc.outdir{:} = rfxDir; - matlabbatch{1}.spm.util.imcalc.expression = meanStruct_equation; - % matlabbatch{1}.spm.util.imcalc.options.interp = 1; - % matlabbatch{1}.spm.util.imcalc.options.dtype = 4; - - %% The mean mask will be saved in the RFX folder - matlabbatch{2}.spm.util.imcalc.output = 'meanMask.nii'; - matlabbatch{2}.spm.util.imcalc.outdir{:} = rfxDir; - matlabbatch{2}.spm.util.imcalc.expression = meanMask_equation; - % matlabbatch{2}.spm.util.imcalc.options.interp = 1; - % matlabbatch{2}.spm.util.imcalc.options.dtype = 4; + % meanMaskEquation = '(i1+i2+i3+i4+i5)>0.75*5' + meanMaskEquation = [sumEquation, '>0.75*', num2str(nbImg)]; + + matlabbatch = setBatchImageCalculation(matlabbatch, ... + inputMask, ... + 'meanMask.nii', ... + outputDir, ... + meanMaskEquation); end diff --git a/src/batches/setBatchNormalizationSpatialPrepro.m b/src/batches/setBatchNormalizationSpatialPrepro.m index 5f4919ea..c34f7cd5 100644 --- a/src/batches/setBatchNormalizationSpatialPrepro.m +++ b/src/batches/setBatchNormalizationSpatialPrepro.m @@ -1,23 +1,21 @@ % (C) Copyright 2019 CPP BIDS SPM-pipeline developers -function matlabbatch = setBatchNormalizationSpatialPrepro(matlabbatch, voxDim, opt) +function matlabbatch = setBatchNormalizationSpatialPrepro(matlabbatch, opt, voxDim) % % Short description of what the function does goes here. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % matlabbatch = setBatchNormalizationSpatialPrepro(matlabbatch, opt, voxDim) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: Options chosen for the analysis. See ``checkOptions()``. + % :param matlabbatch: + % :type matlabbatch: structure + % :param opt: + % :type opt: structure + % :param voxDim: + % :type opt: array % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :returns: - :matlabbatch: (structure) % jobsToAdd = numel(matlabbatch) + 1; diff --git a/src/batches/setBatchNormalize.m b/src/batches/setBatchNormalize.m index 3cb0a9bd..4416d37d 100644 --- a/src/batches/setBatchNormalize.m +++ b/src/batches/setBatchNormalize.m @@ -6,18 +6,18 @@ % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % matlabbatch = setBatchNormalize(matlabbatch [, deformField] [, voxDim] [, imgToResample]) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument + % :param matlabbatch: + % :type matlabbatch: structure + % :param deformField: + % :type deformField: + % :param voxDim: + % :param voxDim: + % :param imgToResample: + % :param imgToResample: % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :returns: - :matlabbatch: (structure) % if nargin > 1 && ~isempty(deformField) diff --git a/src/batches/setBatchRealign.m b/src/batches/setBatchRealign.m index 6f88e173..e509008e 100644 --- a/src/batches/setBatchRealign.m +++ b/src/batches/setBatchRealign.m @@ -6,18 +6,18 @@ % % USAGE:: % - % [matlabbatch, voxDim] = setBatchRealign(matlabbatch, BIDS, subID, opt, [action = 'realign']) + % [matlabbatch, voxDim] = setBatchRealign(matlabbatch, [action = 'realign'], BIDS, opt, subID) % % :param matlabbatch: SPM batch % :type matlabbatch: structure % :param BIDS: BIDS layout returned by ``getData``. % :type BIDS: structure - % :param subID: subject label - % :type subID: string - % :param opt: Options chosen for the analysis. See ``checkOptions()``. - % :type opt: structure % :param action: ``realign``, ``realignReslice``, ``realignUnwarp`` % :type action: string + % :param opt: Options chosen for the analysis. See ``checkOptions()``. + % :type opt: structure + % :type subID: string + % :param subID: subject label % % :returns: - :matlabbatch: (structure) (dimension) % - :voxDim: (array) (dimension) @@ -26,10 +26,10 @@ % make which image is resliced more consistent 'which = []' if numel(varargin) < 5 - [matlabbatch, BIDS, subID, opt] = deal(varargin{:}); + [matlabbatch, BIDS, opt, subID] = deal(varargin{:}); action = ''; else - [matlabbatch, BIDS, subID, opt, action] = deal(varargin{:}); + [matlabbatch, action, BIDS, opt, subID] = deal(varargin{:}); end if isempty(action) diff --git a/src/batches/setBatchSTC.m b/src/batches/setBatchSTC.m index 8014af10..cdcd81cd 100644 --- a/src/batches/setBatchSTC.m +++ b/src/batches/setBatchSTC.m @@ -1,12 +1,12 @@ % (C) Copyright 2019 CPP BIDS SPM-pipeline developers -function matlabbatch = setBatchSTC(BIDS, opt, subID) +function matlabbatch = setBatchSTC(matlabbatch, BIDS, opt, subID) % - % Short description of what the function does goes here. + % Creates batch for slice timing correction % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % matlabbatch = setBatchSTC(matlabbatch, BIDS, opt, subID) % % :param BIDS: BIDS layout returned by ``getData``. % :type BIDS: structure @@ -18,8 +18,6 @@ % % :returns: - :matlabbatch: (structure) The matlabbatch ready to run the spm job % - % matlabbatch = setBatchSTC(BIDS, opt, subID) - % % Slice timing units is in milliseconds to be BIDS compliant and not in slice number % as is more traditionally the case with SPM. % @@ -32,9 +30,6 @@ % If not specified this function will take the mid-volume time point as reference % to do the slice timing correction % - % See README.md for more information about slice timing correction - - matlabbatch = []; % get slice order sliceOrder = getSliceOrder(opt, 1); @@ -70,6 +65,12 @@ 'or leave it empty to use mid-acquisition time as reference.']); end + matlabbatch{end + 1}.spm.temporal.st.nslices = nbSlices; + matlabbatch{end}.spm.temporal.st.tr = TR; + matlabbatch{end}.spm.temporal.st.ta = TA; + matlabbatch{end}.spm.temporal.st.so = sliceOrder; + matlabbatch{end}.spm.temporal.st.refslice = referenceSlice; + [sessions, nbSessions] = getInfo(BIDS, subID, opt, 'Sessions'); runCounter = 1; @@ -90,7 +91,7 @@ file = validationInputFile(subFuncDataDir, fileName); % add the file to the list - matlabbatch{1}.spm.temporal.st.scans{runCounter} = {file}; + matlabbatch{end}.spm.temporal.st.scans{runCounter} = {file}; runCounter = runCounter + 1; @@ -100,12 +101,6 @@ end - matlabbatch{1}.spm.temporal.st.nslices = nbSlices; - matlabbatch{1}.spm.temporal.st.tr = TR; - matlabbatch{1}.spm.temporal.st.ta = TA; - matlabbatch{1}.spm.temporal.st.so = sliceOrder; - matlabbatch{1}.spm.temporal.st.refslice = referenceSlice; - % The following lines are commented out because those parameters % can be set in the spm_my_defaults.m % matlabbatch{1}.spm.temporal.st.prefix = spm_get_defaults('slicetiming.prefix'); diff --git a/src/batches/setBatchSaveCoregistrationMatrix.m b/src/batches/setBatchSaveCoregistrationMatrix.m index f427e7ac..82212043 100644 --- a/src/batches/setBatchSaveCoregistrationMatrix.m +++ b/src/batches/setBatchSaveCoregistrationMatrix.m @@ -1,21 +1,21 @@ % (C) Copyright 2020 CPP BIDS SPM-pipeline developers -function matlabbatch = setBatchSaveCoregistrationMatrix(matlabbatch, BIDS, subID, opt) +function matlabbatch = setBatchSaveCoregistrationMatrix(matlabbatch, BIDS, opt, subID) % % Short description of what the function does goes here. % % USAGE:: % - % matlabbatch = setBatchSaveCoregistrationMatrix(matlabbatch, BIDS, subID, opt) + % matlabbatch = setBatchSaveCoregistrationMatrix(matlabbatch, BIDS, opt, subID) % % :param matlabbatch: % :type matlabbatch: structure % :param BIDS: BIDS layout returned by ``getData``. % :type BIDS: structure - % :param subID: - % :type subID: % :param opt: % :type opt: Options chosen for the analysis. See ``checkOptions()``. + % :param subID: + % :type subID: % % :returns: - :matlabbatch: % diff --git a/src/batches/setBatchSkullStripping.m b/src/batches/setBatchSkullStripping.m index 379aa9dc..ed28a389 100644 --- a/src/batches/setBatchSkullStripping.m +++ b/src/batches/setBatchSkullStripping.m @@ -1,23 +1,23 @@ % (C) Copyright 2020 CPP BIDS SPM-pipeline developers -function matlabbatch = setBatchSkullStripping(matlabbatch, BIDS, subID, opt) +function matlabbatch = setBatchSkullStripping(matlabbatch, BIDS, opt, subID) % % Creates a batch to compute a brain mask based on the tissue probability maps % from the segmentation. % % USAGE:: % - % matlabbatch = setBatchSkullStripping(matlabbatch, BIDS, subID, opt) + % matlabbatch = setBatchSkullStripping(matlabbatch, BIDS, opt, subID) % % :param matlabbatch: list of SPM batches % :type matlabbatch: structure % :param BIDS: BIDS layout returned by ``getData``. % :type BIDS: structure - % :param subID: subject ID - % :type subID: string % :param opt: structure or json filename containing the options. See % ``checkOptions()`` and ``loadAndCheckOptions()``. % :type opt: structure + % :param subID: subject ID + % :type subID: string % % :returns: - :matlabbatch: (structure) The matlabbatch ready to run the spm job % @@ -38,12 +38,32 @@ [anatImage, anatDataDir] = getAnatFilename(BIDS, subID, opt); + % bias corrected image + biasCorrectedAnatImage = validationInputFile(anatDataDir, anatImage, 'm'); + % get the tissue probability maps in native space for that subject + TPMs = validationInputFile(anatDataDir, anatImage, 'c[123]'); + + input{1} = biasCorrectedAnatImage; + % grey matter + input{2} = TPMs(1, :); + % white matter + input{3} = TPMs(2, :); + % csf + input{4} = TPMs(3, :); + + output = ['m' strrep(anatImage, '.nii', '_skullstripped.nii')]; + expression = sprintf('i1.*((i2+i3+i4)>%f)', opt.skullstrip.threshold); + + matlabbatch = setBatchImageCalculation(matlabbatch, input, output, anatDataDir, expression); + % if this is part of a pipeline we get the segmentation dependency to get % the input from. % Otherwise the files to process are stored in a cell if isfield(opt, 'orderBatches') && isfield(opt.orderBatches, 'segment') - matlabbatch{end + 1}.spm.util.imcalc.input(1) = ... + matlabbatch{end}.spm.util.imcalc = rmfield(matlabbatch{end}.spm.util.imcalc, 'input'); + + matlabbatch{end}.spm.util.imcalc.input(1) = ... cfg_dep( ... 'Segment: Bias Corrected (1)', ... substruct( ... @@ -83,32 +103,10 @@ substruct( ... '.', 'tiss', '()', {3}, ... '.', 'c', '()', {':'})); - else - - % bias corrected image - biasCorrectedAnatImage = validationInputFile(anatDataDir, anatImage, 'm'); - matlabbatch{end + 1}.spm.util.imcalc.input(1) = biasCorrectedAnatImage; - - % get the tissue probability maps in native space for that subject - TPMs = validationInputFile(anatDataDir, anatImage, 'c[123]'); - - % grey matter - matlabbatch{end}.spm.util.imcalc.input(2) = TPMs(1, :); - % white matter - matlabbatch{end}.spm.util.imcalc.input(3) = TPMs(2, :); - % csf - matlabbatch{end}.spm.util.imcalc.input(4) = TPMs(3, :); end - matlabbatch{end}.spm.util.imcalc.output = ['m' strrep(anatImage, '.nii', '_skullstripped.nii')]; - matlabbatch{end}.spm.util.imcalc.outdir = {anatDataDir}; - - matlabbatch{end}.spm.util.imcalc.expression = sprintf( ... - 'i1.*((i2+i3+i4)>%f)', ... - opt.skullstrip.threshold); - - % add a batch to output the mask + %% Add a batch to output the mask matlabbatch{end + 1} = matlabbatch{end}; matlabbatch{end}.spm.util.imcalc.expression = sprintf( ... '(i2+i3+i4)>%f', ... diff --git a/src/batches/setBatchSmoothConImages.m b/src/batches/setBatchSmoothConImages.m index be0897d2..8e19b61c 100644 --- a/src/batches/setBatchSmoothConImages.m +++ b/src/batches/setBatchSmoothConImages.m @@ -1,31 +1,29 @@ % (C) Copyright 2019 CPP BIDS SPM-pipeline developers -function matlabbatch = setBatchSmoothConImages(group, funcFWHM, conFWHM, opt) +function matlabbatch = setBatchSmoothConImages(matlabbatch, group, opt, funcFWHM, conFWHM) % - % Short description of what the function does goes here. + % Creates a batch to smooth all the con images of all subjects % % USAGE:: % - % matlabbatch = setBatchSmoothConImages(group, funcFWHM, conFWHM, opt) + % matlabbatch = setBatchSmoothConImages(matlabbatch, group, opt, funcFWHM, conFWHM) % + % :param matlabbatch: + % :type matlabbatch: % :param group: % :type group: + % :param opt: Options chosen for the analysis. See ``checkOptions()``. + % :type opt: % :param funcFWHM: % :type funcFWHM: % :param conFWHM: % :type conFWHM: - % :param opt: Options chosen for the analysis. See ``checkOptions()``. - % :type opt: % % :returns: - :matlabbatch: % printBatchName('smoothing contrast images'); - counter = 0; - - matlabbatch = {}; - %% Loop through the groups, subjects, and sessions for iGroup = 1:length(group) @@ -33,8 +31,6 @@ for iSub = 1:group(iGroup).numSub - counter = counter + 1; - subNumber = group(iGroup).subNumber{iSub}; printProcessingSubject(groupName, iSub, subNumber); @@ -42,17 +38,16 @@ ffxDir = getFFXdir(subNumber, funcFWHM, opt); conImg = spm_select('FPlist', ffxDir, '^con*.*nii$'); - matlabbatch{counter}.spm.spatial.smooth.data = cellstr(conImg); %#ok<*AGROW> + data = cellstr(conImg); - % Define how much smoothing is required - matlabbatch{counter}.spm.spatial.smooth.fwhm = ... - [conFWHM conFWHM conFWHM]; - matlabbatch{counter}.spm.spatial.smooth.dtype = 0; - matlabbatch{counter}.spm.spatial.smooth.prefix = [ ... - spm_get_defaults('smooth.prefix'), ... - num2str(conFWHM)]; + matlabbatch = setBatchSmoothing( ... + matlabbatch, ... + data, ... + conFWHM, ... + [spm_get_defaults('smooth.prefix'), num2str(conFWHM)]); end + end end diff --git a/src/batches/setBatchSmoothing.m b/src/batches/setBatchSmoothing.m index e931bf5e..f0e353de 100644 --- a/src/batches/setBatchSmoothing.m +++ b/src/batches/setBatchSmoothing.m @@ -1,65 +1,33 @@ % (C) Copyright 2019 CPP BIDS SPM-pipeline developers -function matlabbatch = setBatchSmoothing(BIDS, opt, subID, funcFWHM) +function matlabbatch = setBatchSmoothing(matlabbatch, images, FWHM, prefix) % - % Short description of what the function does goes here. + % Small wrapper to create smoothing batch % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % matlabbatch = setBatchSmoothing(matlabbatch, images, FWHM, prefix) % - % :param BIDS: BIDS layout returned by ``getData``. - % :type BIDS: structure - % :param argin2: Options chosen for the analysis. See ``checkOptions()``. - % :type argin2: string - % :param argin3: (dimension) optional argument + % :param matlabbatch: + % :type matlabbatch: structure + % :param images: + % :type images: + % :param funcFWHM: + % :type funcFWHM: + % :param prefix: + % :type prefix: + % + % :returns: - :matlabbatch: (structure) % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) % - printBatchName('smoothing functional images'); - - prefix = getPrefix('smooth', opt); - - % identify sessions for this subject - [sessions, nbSessions] = getInfo(BIDS, subID, opt, 'Sessions'); - - % clear previous matlabbatch and files - matlabbatch = []; - allFiles = []; - - for iSes = 1:nbSessions % For each session - - % get all runs for that subject across all sessions - [runs, nbRuns] = getInfo(BIDS, subID, opt, 'Runs', sessions{iSes}); - - % numRuns = group(iGroup).numRuns(iSub); - for iRun = 1:nbRuns - - % get the filename for this bold run for this task - [fileName, subFuncDataDir] = getBoldFilename( ... - BIDS, ... - subID, sessions{iSes}, runs{iRun}, opt); - - % check that the file with the right prefix exist - files = validationInputFile(subFuncDataDir, fileName, prefix); - - % add the files to list - allFilesTemp = cellstr(files); - allFiles = [allFiles; allFilesTemp]; %#ok - - end - end + printBatchName('smoothing images'); - matlabbatch{1}.spm.spatial.smooth.data = allFiles; - % Define the amount of smoothing required - matlabbatch{1}.spm.spatial.smooth.fwhm = [funcFWHM funcFWHM funcFWHM]; - matlabbatch{1}.spm.spatial.smooth.dtype = 0; - matlabbatch{1}.spm.spatial.smooth.im = 0; + matlabbatch{end + 1}.spm.spatial.smooth.data = images; + matlabbatch{end}.spm.spatial.smooth.prefix = prefix; + matlabbatch{end}.spm.spatial.smooth.fwhm = [FWHM FWHM FWHM]; - % Prefix = s+funcFWHM - matlabbatch{1}.spm.spatial.smooth.prefix = ... - [spm_get_defaults('smooth.prefix'), num2str(funcFWHM)]; + matlabbatch{end}.spm.spatial.smooth.dtype = 0; + matlabbatch{end}.spm.spatial.smooth.im = 0; end diff --git a/src/batches/setBatchSmoothingFunc.m b/src/batches/setBatchSmoothingFunc.m new file mode 100644 index 00000000..3baf0487 --- /dev/null +++ b/src/batches/setBatchSmoothingFunc.m @@ -0,0 +1,65 @@ +% (C) Copyright 2019 CPP BIDS SPM-pipeline developers + +function matlabbatch = setBatchSmoothingFunc(matlabbatch, BIDS, opt, subID, funcFWHM) + % + % Short description of what the function does goes here. + % + % USAGE:: + % + % matlabbatch = setBatchSmoothingFunc(matlabbatch, BIDS, opt, subID, funcFWHM) + % + % :param matlabbatch: + % :type matlabbatch: structure + % :param BIDS: BIDS layout returned by ``getData``. + % :type BIDS: structure + % :param opt: Options chosen for the analysis. See ``checkOptions()``. + % :type opt: string + % :param subID: + % :type subID: + % :param funcFWHM: + % :type funcFWHM: + % + % :returns: - :matlabbatch: (structure) + % + % + + printBatchName('smoothing functional images'); + + prefix = getPrefix('smooth', opt); + + % identify sessions for this subject + [sessions, nbSessions] = getInfo(BIDS, subID, opt, 'Sessions'); + + % clear previous matlabbatch and files + allFiles = []; + + for iSes = 1:nbSessions % For each session + + % get all runs for that subject across all sessions + [runs, nbRuns] = getInfo(BIDS, subID, opt, 'Runs', sessions{iSes}); + + % numRuns = group(iGroup).numRuns(iSub); + for iRun = 1:nbRuns + + % get the filename for this bold run for this task + [fileName, subFuncDataDir] = getBoldFilename( ... + BIDS, ... + subID, sessions{iSes}, runs{iRun}, opt); + + % check that the file with the right prefix exist + files = validationInputFile(subFuncDataDir, fileName, prefix); + + % add the files to list + allFilesTemp = cellstr(files); + allFiles = [allFiles; allFilesTemp]; %#ok + + end + end + + % Prefix = s+funcFWHM + matlabbatch = setBatchSmoothing(matlabbatch, ... + allFiles, ... + funcFWHM, ... + [spm_get_defaults('smooth.prefix'), num2str(funcFWHM)]); + +end diff --git a/src/batches/setBatchSubjectLevelContrasts.m b/src/batches/setBatchSubjectLevelContrasts.m index 667faded..ad971576 100644 --- a/src/batches/setBatchSubjectLevelContrasts.m +++ b/src/batches/setBatchSubjectLevelContrasts.m @@ -1,42 +1,39 @@ % (C) Copyright 2019 CPP BIDS SPM-pipeline developers -function matlabbatch = setBatchSubjectLevelContrasts(opt, subID, funcFWHM) +function matlabbatch = setBatchSubjectLevelContrasts(matlabbatch, opt, subID, funcFWHM) % % Short description of what the function does goes here. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % matlabbatch = setBatchSubjectLevelContrasts(matlabbatch, opt, subID, funcFWHM) % - % :param argin1: Options chosen for the analysis. See ``checkOptions()``. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument + % :param matlabbatch: + % :type matlabbatch: structure + % :param opt: + % :type opt: structure + % :param subID: + % :type subID: string + % :param funcFWHM: + % :type funcFWHM: % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :returns: - :matlabbatch: % printBatchName('subject level contrasts specification'); ffxDir = getFFXdir(subID, funcFWHM, opt); + spmMatFile = cellstr(fullfile(ffxDir, 'SPM.mat')); + % Create Contrasts contrasts = specifyContrasts(ffxDir, opt.taskName, opt); - - matlabbatch = []; - for icon = 1:size(contrasts, 2) - matlabbatch{1}.spm.stats.con.consess{icon}.tcon.name = ... - contrasts(icon).name; - matlabbatch{1}.spm.stats.con.consess{icon}.tcon.convec = ... - contrasts(icon).C; - matlabbatch{1}.spm.stats.con.consess{icon}.tcon.sessrep = 'none'; + consess{icon}.tcon.name = contrasts(icon).name; %#ok<*AGROW> + consess{icon}.tcon.convec = contrasts(icon).C; + consess{icon}.tcon.sessrep = 'none'; end - matlabbatch{1}.spm.stats.con.spmmat = cellstr(fullfile(ffxDir, 'SPM.mat')); - matlabbatch{1}.spm.stats.con.delete = 1; + matlabbatch = setBatchContrasts(matlabbatch, spmMatFile, consess); end diff --git a/src/batches/setBatchSubjectLevelGLMSpec.m b/src/batches/setBatchSubjectLevelGLMSpec.m index 1161530a..4e9ad835 100644 --- a/src/batches/setBatchSubjectLevelGLMSpec.m +++ b/src/batches/setBatchSubjectLevelGLMSpec.m @@ -6,7 +6,7 @@ % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % matlabbatch = setBatchSubjectLevelGLMSpec(matlabbatch, BIDS, opt, subID, funcFWHM) % % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, % consectetur adipiscing elit. Ut congue nec est ac lacinia. @@ -19,7 +19,7 @@ % - :argout2: (type) (dimension) % - [BIDS, opt, subID, funcFWHM] = deal(varargin{:}); + [matlabbatch, BIDS, opt, subID, funcFWHM] = deal(varargin{:}); printBatchName('specify subject level fmri model'); @@ -43,21 +43,18 @@ sliceOrder = 1:hdr(1).dim(3); end - %% - matlabbatch = []; - - matlabbatch{1}.spm.stats.fmri_spec.timing.units = 'secs'; + matlabbatch{end + 1}.spm.stats.fmri_spec.timing.units = 'secs'; % get TR from metadata TR = opt.metadata.RepetitionTime; - matlabbatch{1}.spm.stats.fmri_spec.timing.RT = TR; + matlabbatch{end}.spm.stats.fmri_spec.timing.RT = TR; % number of times bins nbTimeBins = numel(unique(sliceOrder)); - matlabbatch{1}.spm.stats.fmri_spec.timing.fmri_t = nbTimeBins; + matlabbatch{end}.spm.stats.fmri_spec.timing.fmri_t = nbTimeBins; refBin = floor(nbTimeBins / 2); - matlabbatch{1}.spm.stats.fmri_spec.timing.fmri_t0 = refBin; + matlabbatch{end}.spm.stats.fmri_spec.timing.fmri_t0 = refBin; % Create ffxDir if it doesnt exist % If it exists, issue a warning that it has been overwritten @@ -67,21 +64,21 @@ rmdir(ffxDir, 's'); mkdir(ffxDir); end - matlabbatch{1}.spm.stats.fmri_spec.dir = {ffxDir}; + matlabbatch{end}.spm.stats.fmri_spec.dir = {ffxDir}; - matlabbatch{1}.spm.stats.fmri_spec.fact = struct('name', {}, 'levels', {}); + matlabbatch{end}.spm.stats.fmri_spec.fact = struct('name', {}, 'levels', {}); - matlabbatch{1}.spm.stats.fmri_spec.bases.hrf.derivs = [0 0]; + matlabbatch{end}.spm.stats.fmri_spec.bases.hrf.derivs = [0 0]; - matlabbatch{1}.spm.stats.fmri_spec.volt = 1; + matlabbatch{end}.spm.stats.fmri_spec.volt = 1; - matlabbatch{1}.spm.stats.fmri_spec.global = 'None'; + matlabbatch{end}.spm.stats.fmri_spec.global = 'None'; - matlabbatch{1}.spm.stats.fmri_spec.mask = {''}; + matlabbatch{end}.spm.stats.fmri_spec.mask = {''}; % The following lines are commented out because those parameters % can be set in the spm_my_defaults.m - % matlabbatch{1}.spm.stats.fmri_spec.cvi = 'AR(1)'; + % matlabbatch{end}.spm.stats.fmri_spec.cvi = 'AR(1)'; % identify sessions for this subject [sessions, nbSessions] = getInfo(BIDS, subID, opt, 'Sessions'); @@ -101,7 +98,7 @@ disp(fullpathBoldFileName); - matlabbatch{1}.spm.stats.fmri_spec.sess(sesCounter).scans = ... + matlabbatch{end}.spm.stats.fmri_spec.sess(sesCounter).scans = ... {fullpathBoldFileName}; % get stimuli onset time file @@ -114,25 +111,25 @@ tsvFile, ... funcFWHM); - matlabbatch{1}.spm.stats.fmri_spec.sess(sesCounter).multi = ... + matlabbatch{end}.spm.stats.fmri_spec.sess(sesCounter).multi = ... cellstr(fullpathOnsetFileName); % get realignment parameters realignParamFile = getRealignParamFile(fullpathBoldFileName, prefix); - matlabbatch{1}.spm.stats.fmri_spec.sess(sesCounter).multi_reg = ... + matlabbatch{end}.spm.stats.fmri_spec.sess(sesCounter).multi_reg = ... cellstr(realignParamFile); % multiregressor selection - matlabbatch{1}.spm.stats.fmri_spec.sess(sesCounter).regress = ... + matlabbatch{end}.spm.stats.fmri_spec.sess(sesCounter).regress = ... struct('name', {}, 'val', {}); % multicondition selection - matlabbatch{1}.spm.stats.fmri_spec.sess(sesCounter).cond = ... + matlabbatch{end}.spm.stats.fmri_spec.sess(sesCounter).cond = ... struct('name', {}, 'onset', {}, 'duration', {}); % The following lines are commented out because those parameters % can be set in the spm_my_defaults.m - % matlabbatch{1}.spm.stats.fmri_spec.sess(ses_counter).hpf = 128; + % matlabbatch{end}.spm.stats.fmri_spec.sess(ses_counter).hpf = 128; sesCounter = sesCounter + 1; diff --git a/src/batches/setBatchSubjectLevelResults.m b/src/batches/setBatchSubjectLevelResults.m index c96d8531..838750f6 100644 --- a/src/batches/setBatchSubjectLevelResults.m +++ b/src/batches/setBatchSubjectLevelResults.m @@ -12,10 +12,10 @@ % :type matlabbatch: structure % :param grp: % :type grp: - % :param funcFWHM: - % :type funcFWHM: float % :param opt: % :type opt: structure + % :param funcFWHM: + % :type funcFWHM: float % :param iStep: % :type iStep: positive integer % :param iCon: @@ -24,7 +24,7 @@ % :returns: - :matlabbatch: (structure) % - [matlabbatch, grp, funcFWHM, opt, iStep, iCon] = deal(varargin{:}); + [matlabbatch, grp, opt, funcFWHM, iStep, iCon] = deal(varargin{:}); for iGroup = 1:length(grp) diff --git a/src/defaults/createDefaultModel.m b/src/defaults/createDefaultModel.m index 4936188d..d2670381 100644 --- a/src/defaults/createDefaultModel.m +++ b/src/defaults/createDefaultModel.m @@ -90,7 +90,13 @@ trialTypeList{end + 1, 1} = tmp.trial_type{iTrialType}; %#ok<*AGROW> end end + trialTypeList = unique(trialTypeList); + idx = ismember(trialTypeList, 'trial_type'); + if any(idx) + trialTypeList{idx} = []; + end + end function content = fillDefaultDesginMatrixAndContrasts(content, trialTypeList) @@ -101,16 +107,18 @@ for iTrialType = 1:numel(trialTypeList) - trialTypeName = ['trial_type.' trialTypeList{iTrialType}]; + if ~isempty(trialTypeList{iTrialType}) + trialTypeName = ['trial_type.' trialTypeList{iTrialType}]; - % subject - content.Steps{1}.Model.X{iTrialType} = trialTypeName; + % subject + content.Steps{1}.Model.X{iTrialType} = trialTypeName; - % run - content.Steps{2}.Model.X{iTrialType} = trialTypeName; + % run + content.Steps{2}.Model.X{iTrialType} = trialTypeName; - for iStep = 1:numel(content.Steps) - content.Steps{iStep}.AutoContrasts{iTrialType} = trialTypeName; + for iStep = 1:numel(content.Steps) + content.Steps{iStep}.AutoContrasts{iTrialType} = trialTypeName; + end end end diff --git a/src/fieldmaps/getMetadataFromIntendedForFunc.m b/src/fieldmaps/getMetadataFromIntendedForFunc.m index 9dd309d7..8ee9ad57 100644 --- a/src/fieldmaps/getMetadataFromIntendedForFunc.m +++ b/src/fieldmaps/getMetadataFromIntendedForFunc.m @@ -37,6 +37,10 @@ filename = spm_file(filename, 'filename'); fragments = bids.internal.parse_filename(filename); + + if ~isfield(fragments, 'acq') + fragments.acq = ''; + end funcMetadata = bids.query(BIDS, 'metadata', ... 'modality', 'func', ... diff --git a/src/getData.m b/src/getData.m index b212bc33..d28da2b2 100644 --- a/src/getData.m +++ b/src/getData.m @@ -6,54 +6,55 @@ % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % [group, opt, BIDS] = getData(opt, [BIDSdir], [type = 'bold']) % % :param opt: Options chosen for the analysis. See ``checkOptions()``. % :type opt: structure - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) - % - % [group, opt, BIDS] = getData(opt, BIDSdir, type) - % - % getData checks that all the options specified by the user in getOptions - % and fills the blank for any that might have been missed out. - % It then reads the specified BIDS data set and gets the groups and - % subjects to analyze. This can be specified in the opt structure in - % different ways: - % Set the group of subjects to analyze. - % opt.groups = {'control', 'blind'}; - % - % If there are no groups (i.e subjects names are of the form `sub-01` for - % example) or if you want to run all subjects of all groups then use: - % opt.groups = {''}; - % opt.subjects = {[]}; - % - % If you have 2 groups (`cont` and `cat` for example) the following will - % run cont01, cont02, cat03, cat04. - % opt.groups = {'cont', 'cat'}; - % opt.subjects = {[1 2], [3 4]}; + % :param BIDSdir: the directory where the data is ; default is : + % ``fullfile(opt.dataDir, '..', 'derivatives', 'cpp_spm')`` + % :type BIDSdir: string + % :param type: the data type you want to get the metadata of; + % supported: ``'bold'`` (default) and ``T1w`` + % :type type: string + % + % :returns: - :group: (structure) + % - :opt: (structure) + % - :BIDS: (structure) + % + % ``getData()`` reads the specified BIDS data set and gets the groups and + % subjects to analyze. This can be specified in the opt structure in different ways. + % + % Set the group of subjects to analyze:: + % + % opt.groups = {'control', 'blind'}; + % + % If there are no groups (i.e subjects names are of the form ``sub-01`` for + % example) or if you want to run all subjects of all groups then use:: + % + % opt.groups = {''}; + % opt.subjects = {[]}; + % + % If you have 2 groups (``cont`` and ``cat`` for example) the following will + % run ``cont01``, ``cont02``, ``cat03``, ``cat04``:: + % + % opt.groups = {'cont', 'cat'}; + % opt.subjects = {[1 2], [3 4]}; % % If you have more than 2 groups but want to only run the subjects of 2 - % groups then you can use. - % opt.groups = {'cont', 'cat'}; - % opt.subjects = {[], []}; + % groups then you can use:: + % + % opt.groups = {'cont', 'cat'}; + % opt.subjects = {[], []}; + % + % You can also directly specify the subject label for the participants you + % want to run:: % - % You can also directly specify the subject label for the participants you want to run - % opt.groups = {''}; - % opt.subjects = {'01', 'cont01', 'cat02', 'ctrl02', 'blind01'}; + % opt.groups = {''}; + % opt.subjects = {'01', 'cont01', 'cat02', 'ctrl02', 'blind01'}; % - % You can also specify: - % - BIDSdir: the directory where the data is ; default is : - % fullfile(opt.dataDir, '..', 'derivatives', 'SPM12_CPPL') - % - type: the data type you want to get the metadata of ; - % supported: bold (default) and T1w + % .. todo + % Check if the following is true? Ideally write a test to make sure. % - % TODO: Check if the following is true? Ideally write a test to make sure. % IMPORTANT NOTE: if you specify the type variable for T1w then you must % make sure that the T1w.json is also present in the anat folder because % of the way the bids.query function works at the moment @@ -129,6 +130,7 @@ function opt = getMetaData(BIDS, opt, subjects, type) + % TODO % THIS NEEDS FIXING AS WE MIGHT WANT THE METADATA OF THE SUBJECTS SELECTED % RATHER THAN THE FIRST SUBJECT OF THE DATASET diff --git a/src/group_level/getGrpLevelContrastToCompute.m b/src/group_level/getGrpLevelContrastToCompute.m index b8dfb48d..52ec91ad 100644 --- a/src/group_level/getGrpLevelContrastToCompute.m +++ b/src/group_level/getGrpLevelContrastToCompute.m @@ -2,7 +2,7 @@ function [grpLvlCon, iStep] = getGrpLevelContrastToCompute(opt) % - % Short description of what the function does goes here. + % Returns the autocontrast part of the dataset step of the BIDS model % % USAGE:: % diff --git a/src/group_level/getRFXdir.m b/src/group_level/getRFXdir.m index 19a4622e..69e0ff51 100644 --- a/src/group_level/getRFXdir.m +++ b/src/group_level/getRFXdir.m @@ -1,6 +1,6 @@ % (C) Copyright 2019 CPP BIDS SPM-pipeline developers -function rfxDir = getRFXdir(opt, funcFWHM, conFWHM, contrastName) +function rfxDir = getRFXdir(opt, funcFWHM, conFWHM) % % Sets the name the group level analysis directory and creates it if it does not exist % @@ -26,8 +26,7 @@ opt.derivativesDir, ... 'group', ... ['rfx_task-', opt.taskName], ... - ['rfx_funcFWHM-', num2str(funcFWHM), '_conFWHM-', num2str(conFWHM)], ... - contrastName); + ['rfx_funcFWHM-', num2str(funcFWHM), '_conFWHM-', num2str(conFWHM)]); if ~exist(rfxDir, 'dir') mkdir(rfxDir); diff --git a/src/subject_level/concatBetaImgTmaps.m b/src/subject_level/concatBetaImgTmaps.m deleted file mode 100644 index c27ddb71..00000000 --- a/src/subject_level/concatBetaImgTmaps.m +++ /dev/null @@ -1,140 +0,0 @@ -% (C) Copyright 2019 CPP BIDS SPM-pipeline developers - -function concatBetaImgTmaps(funcFWHM, opt, deleteIndBeta, deleteIndTmaps) - % - % Short description of what the function does goes here. - % - % USAGE:: - % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) - % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) - % - % Make 4D images of beta and t-maps for the MVPA. :: - % - % concatBetaImgTmaps(funcFWHM, opt, [deleteIndBeta = true,] [deleteIndTmaps = true]) - % - % :param funcFWHM: (scalar) smoothing (FWHM) applied to the the normalized EPI - % :param opt: (boolean) options structure - % :param deleteIndBeta: (boolean) - % :param deleteIndTmaps: (boolean) decide to delete t-maps, beta-maps - % - % If no ``opt`` input is given this function will attempt to load a json file. - % - - % delete individual Beta and tmaps - if nargin < 3 - deleteIndBeta = 1; - deleteIndTmaps = 1; - end - - % load the subjects/Groups information and the task name - [group, opt, ~] = getData(opt); - - %% Loop through the groups, subjects - for iGroup = 1:length(group) - - for iSub = 1:group(iGroup).numSub - - subID = group(iGroup).subNumber{iSub}; - - fprintf(1, 'PREPARING: 4D maps: %s \n', subID); - - ffxDir = getFFXdir(subID, funcFWHM, opt, isMVPA); - - load(fullfile(ffxDir, 'SPM.mat')); - - contrasts = specifyContrasts(ffxDir, opt.taskName, opt, isMVPA); - - beta_maps = cell(length(contrasts), 1); - t_maps = cell(length(contrasts), 1); - - % path to beta and t-map files. - for iContrast = 1:length(beta_maps) - % Note that the betas are created from the idx (Beta_idx(iBeta)) - fileName = sprintf('beta_%04d.nii', find(contrasts(iContrast).C)); - fileName = validationInputFile(ffxDir, fileName); - beta_maps{iContrast, 1} = [fileName, ',1']; - - % while the contrastes (t-maps) are not from the index. They were created - fileName = sprintf('spmT_%04d.nii', iContrast); - fileName = validationInputFile(ffxDir, fileName); - t_maps{iContrast, 1} = [fileName, ',1']; - end - - % clear previous matlabbatch and files - matlabbatch = []; - - % 4D beta maps - matlabbatch{1}.spm.util.cat.vols = beta_maps; - matlabbatch{1}.spm.util.cat.name = ['4D_beta_', num2str(funcFWHM), '.nii']; - matlabbatch{1}.spm.util.cat.dtype = 4; - - % 4D t-maps - matlabbatch{2}.spm.util.cat.vols = t_maps; - matlabbatch{2}.spm.util.cat.name = ['4D_t_maps_', num2str(funcFWHM), '.nii']; - matlabbatch{2}.spm.util.cat.dtype = 4; - - saveMatlabBatch(matlabbatch, 'concatBetaImgTmaps', opt, subID); - - spm_jobman('run', matlabbatch); - - removeBetaImgTmaps(beta_maps, t_maps, deleteIndBeta, deleteIndTmaps); - - end - end - -end - -function removeBetaImgTmaps(beta_maps, t_maps, deleteIndBeta, deleteIndTmaps) - - % delete maps - if deleteIndBeta - - % delete all individual beta maps - fprintf('Deleting individual beta-maps ... '); - for iBeta = 1:length(beta_maps) - delete(beta_maps{iBeta}(1:end - 2)); - end - fprintf('Done. \n\n\n '); - - end - - if deleteIndTmaps - - % delete all individual con maps - fprintf('Deleting individual con maps ... '); - for iCon = 1:length(t_maps) - delete(fullfile(ffxDir, ['con_', sprintf('%04d', iCon), '.nii'])); - end - fprintf('Done. \n\n\n '); - - % delete all individual t-maps - fprintf('Deleting individual t-maps ... '); - for iTmap = 1:length(t_maps) - delete(t_maps{iTmap}(1:end - 2)); - end - fprintf('Done. \n\n\n '); - end - - % delete mat files - - % This is refactorable - % ex: delete(fullfile(ffxDir, ['4D_*', num2str(funcFWHM), '.mat'])); - - if exist(fullfile(ffxDir, ['4D_beta_', num2str(funcFWHM), '.mat']), 'file') - delete(fullfile(ffxDir, ['4D_beta_', num2str(funcFWHM), '.mat'])); - end - if exist(fullfile(ffxDir, ['4D_t_maps_', num2str(funcFWHM), '.mat']), 'file') - delete(fullfile(ffxDir, ['4D_t_maps_', num2str(funcFWHM), '.mat'])); - end -end diff --git a/src/subject_level/deleteResidualImages.m b/src/subject_level/deleteResidualImages.m index f90ab38d..5429b5bd 100644 --- a/src/subject_level/deleteResidualImages.m +++ b/src/subject_level/deleteResidualImages.m @@ -1,23 +1,13 @@ % (C) Copyright 2020 CPP BIDS SPM-pipeline developers function deleteResidualImages(ffxDir) - % - % Short description of what the function does goes here. % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) - % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument + % deleteResidualImages(ffxDir) % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :param ffxDir: + % :type ffxDir: string % delete(fullfile(ffxDir, 'Res_*.nii')); diff --git a/src/subject_level/getBoldFilenameForFFX.m b/src/subject_level/getBoldFilenameForFFX.m index b2202139..117ed609 100644 --- a/src/subject_level/getBoldFilenameForFFX.m +++ b/src/subject_level/getBoldFilenameForFFX.m @@ -2,27 +2,30 @@ function [boldFileName, prefix] = getBoldFilenameForFFX(varargin) % - % Short description of what the function does goes here. + % Gets the filename for this bold run for this task for the FFX setup + % and check that the file with the right prefix exist % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % [boldFileName, prefix] = getBoldFilenameForFFX(BIDS, opt, subID, funcFWHM, iSes, iRun) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument + % :param BIDS: + % :type BIDS: structure + % :param opt: + % :type opt: structure + % :param subID: + % :type subID: string + % :param funcFWHM: + % :type funcFWHM: scalar + % :param iSes: + % :type iSes: integer + % :param iRun: + % :type iRun: integer % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :returns: - :boldFileName: (string) + % - :prefix: (srting) % - % [boldFileName, prefix] = getBoldFilenameForFFX(BIDS, opt, subID, funcFWHM, iSes, iRun) % - % get the filename for this bold run for this task for the FFX setup - % and check that the file with the right prefix exist [BIDS, opt, subID, funcFWHM, iSes, iRun] = deal(varargin{:}); diff --git a/src/subject_level/getFFXdir.m b/src/subject_level/getFFXdir.m index 16004493..e2d4d4cc 100644 --- a/src/subject_level/getFFXdir.m +++ b/src/subject_level/getFFXdir.m @@ -2,27 +2,20 @@ function ffxDir = getFFXdir(subID, funcFWFM, opt) % - % Short description of what the function does goes here. + % Sets the name the FFX directory and creates it if it does not exist % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) + % ffxDir = getFFXdir(subID, funcFWFM, opt) % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument - % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) - % - % ffxDir = getFFXdir(subID, funcFWFM, opt) - % - % sets the name the FFX directory and creates it if it does not exist + % :param subID: + % :type subID: string + % :param funcFWFM: + % :type funcFWFM: scalar + % :param opt: + % :param opt: structure % + % :returns: - :ffxDir: (string) % ffxDir = fullfile(opt.derivativesDir, ... @@ -34,4 +27,5 @@ if ~exist(ffxDir, 'dir') mkdir(ffxDir); end + end diff --git a/src/subject_level/specifyContrasts.m b/src/subject_level/specifyContrasts.m index 2d4e81fe..811c6e27 100644 --- a/src/subject_level/specifyContrasts.m +++ b/src/subject_level/specifyContrasts.m @@ -2,39 +2,34 @@ function contrasts = specifyContrasts(ffxDir, taskName, opt) % - % Short description of what the function does goes here. + % Specifies the first level contrasts % % USAGE:: % - % [argout1, argout2] = templateFunction(argin1, [argin2 == default,] [argin3]) - % - % :param argin1: (dimension) obligatory argument. Lorem ipsum dolor sit amet, - % consectetur adipiscing elit. Ut congue nec est ac lacinia. - % :type argin1: type - % :param argin2: optional argument and its default value. And some of the - % options can be shown in litteral like ``this`` or ``that``. - % :type argin2: string - % :param argin3: (dimension) optional argument + % contrasts = specifyContrasts(ffxDir, taskName, opt) % - % :returns: - :argout1: (type) (dimension) - % - :argout2: (type) (dimension) + % :param ffxDir: + % :type ffxDir: + % :param taskName: + % :type taskName: + % :param opt: % - % Specifies the first level contrasts + % :returns: - :contrasts: (type) (dimension) % % To know the names of the columns of the design matrix, type : - % strvcat(SPM.xX.name) + % ``strvcat(SPM.xX.name)`` % % EXAMPLE - % Sn(1) ins 1 - % Sn(1) ins 2 - % Sn(1) T1 - % Sn(1) T2 - % Sn(1) R1 - % Sn(1) R2 - % Sn(1) R3 - % Sn(1) R4 - % Sn(1) R5 - % Sn(1) R6 + % Sn(1) ins 1 + % Sn(1) ins 2 + % Sn(1) T1 + % Sn(1) T2 + % Sn(1) R1 + % Sn(1) R2 + % Sn(1) R3 + % Sn(1) R4 + % Sn(1) R5 + % Sn(1) R6 load(fullfile(ffxDir, 'SPM.mat')); diff --git a/src/templates/setBatchTemplate.m b/src/templates/setBatchTemplate.m new file mode 100644 index 00000000..7a7536b6 --- /dev/null +++ b/src/templates/setBatchTemplate.m @@ -0,0 +1,23 @@ +% (C) Copyright 2020 CPP BIDS SPM-pipeline developers + +function matlabbatch = setBatchTemplate(matlabbatch, BIDS, opt, subID, info, varargin) + % + % template to creae new setBatch functions + % + % USAGE:: + % + % matlabbatch = setBatchTemplate(matlabbatch, BIDS, opt, subID, info, varargin) + % + % :param matlabbatch: + % :type matlabbatch: + % + % :returns: - :matlabbatch: (structure) The matlabbatch ready to run the spm job + + printBatchName('name for this batch'); + + matlabbatch{end + 1}.spm.something = BIDS; + matlabbatch{end}.spm.else = opt; + matlabbatch{end}.spm.other = subID; + matlabbatch{end}.spm.thing = info; + +end diff --git a/src/utils/convert3Dto4D.m b/src/utils/convert3Dto4D.m index 898dd0dd..2d2df441 100644 --- a/src/utils/convert3Dto4D.m +++ b/src/utils/convert3Dto4D.m @@ -83,7 +83,9 @@ function convert3Dto4D(optSource) % % % % % % % % % % % % % % % % % % % % % % Set and run spm batch, input all the volumes minus the dummies if > 0 - matlabbatch = setBatch3Dto4D(volumesList(nbDummies + 1:end, :), ... + matlabbatch = []; + matlabbatch = setBatch3Dto4D(matlabbatch, ... + volumesList(nbDummies + 1:end, :), ... outputNameImage, ... optSource.dataType, ... RT); diff --git a/src/utils/rmTrialTypeStr.m b/src/utils/rmTrialTypeStr.m new file mode 100644 index 00000000..82116dd6 --- /dev/null +++ b/src/utils/rmTrialTypeStr.m @@ -0,0 +1,6 @@ +% (C) Copyright 2019 CPP BIDS SPM-pipeline developers +function conName = rmTrialTypeStr(conName) + + conName = strrep(conName, 'trial_type.', ''); + +end diff --git a/src/workflows/bidsConcatBetaTmaps.m b/src/workflows/bidsConcatBetaTmaps.m new file mode 100644 index 00000000..36d59f97 --- /dev/null +++ b/src/workflows/bidsConcatBetaTmaps.m @@ -0,0 +1,109 @@ +% (C) Copyright 2019 CPP BIDS SPM-pipeline developers + +function bidsConcatBetaTmaps(opt, funcFWHM, deleteIndBeta, deleteIndTmaps) + % + % Make 4D images of beta and t-maps for the MVPA. :: + % + % concatBetaImgTmaps(funcFWHM, opt, [deleteIndBeta = true,] [deleteIndTmaps = true]) + % + % :param opt: options structure + % :type opt: structure + % :param funcFWHM: smoothing (FWHM) applied to the the normalized EPI + % :type funcFWHM: (scalar) + % :param deleteIndBeta: decide to delete beta-maps + % :type funcFWHM: (boolean) + % :param deleteIndTmaps: decide to delete t-maps + % :type funcFWHM: (boolean) + % + + % delete individual Beta and tmaps + if nargin < 3 + deleteIndBeta = 1; + deleteIndTmaps = 1; + end + + [~, opt, group] = setUpWorkflow(opt, 'merge beta images and t-maps'); + + % clear previous matlabbatch and files + matlabbatch = []; + RT = 0; + + %% Loop through the groups, subjects + for iGroup = 1:length(group) + + for iSub = 1:group(iGroup).numSub + + subID = group(iGroup).subNumber{iSub}; + + ffxDir = getFFXdir(subID, funcFWHM, opt); + + contrasts = specifyContrasts(ffxDir, opt.taskName, opt); + + beta_maps = cell(length(contrasts), 1); + t_maps = cell(length(contrasts), 1); + + % path to beta and t-map files. + for iContrast = 1:length(beta_maps) + % Note that the betas are created from the idx (Beta_idx(iBeta)) + fileName = sprintf('beta_%04d.nii', find(contrasts(iContrast).C)); + fileName = validationInputFile(ffxDir, fileName); + beta_maps{iContrast, 1} = [fileName, ',1']; + + % while the contrastes (t-maps) are not from the index. They were created + fileName = sprintf('spmT_%04d.nii', iContrast); + fileName = validationInputFile(ffxDir, fileName); + t_maps{iContrast, 1} = [fileName, ',1']; + end + + % beta maps + outputName = ['4D_beta_', num2str(funcFWHM), '.nii']; + matlabbatch = setBatch3Dto4D(matlabbatch, beta_maps, RT, outputName); + + % t-maps + outputName = ['4D_t_maps_', num2str(funcFWHM), '.nii']; + matlabbatch = setBatch3Dto4D(matlabbatch, t_maps, RT, outputName); + + saveAndRunWorkflow(matlabbatch, 'concat_betaImg_tMaps', opt, subID); + + removeBetaImgTmaps(beta_maps, t_maps, deleteIndBeta, deleteIndTmaps); + + end + end + +end + +function removeBetaImgTmaps(beta_maps, t_maps, deleteIndBeta, deleteIndTmaps) + + % delete maps + if deleteIndBeta + + % delete all individual beta maps + fprintf('Deleting individual beta-maps ... '); + for iBeta = 1:length(beta_maps) + delete(beta_maps{iBeta}(1:end - 2)); + end + fprintf('Done. \n\n\n '); + + end + + if deleteIndTmaps + + % delete all individual con maps + fprintf('Deleting individual con maps ... '); + for iCon = 1:length(t_maps) + delete(fullfile(ffxDir, ['con_', sprintf('%04d', iCon), '.nii'])); + end + fprintf('Done. \n\n\n '); + + % delete all individual t-maps + fprintf('Deleting individual t-maps ... '); + for iTmap = 1:length(t_maps) + delete(t_maps{iTmap}(1:end - 2)); + end + fprintf('Done. \n\n\n '); + end + + % delete mat files + delete(fullfile(ffxDir, ['4D_*', num2str(funcFWHM), '.mat'])); + +end diff --git a/src/workflows/bidsCreateVDM.m b/src/workflows/bidsCreateVDM.m index 37be37b1..9e4622ab 100644 --- a/src/workflows/bidsCreateVDM.m +++ b/src/workflows/bidsCreateVDM.m @@ -42,11 +42,20 @@ function bidsCreateVDM(opt) if any(ismember(types, {'phase12', 'phasediff', 'fieldmap', 'epi'})) printProcessingSubject(groupName, iSub, subID); - - matlabbatch = setBatchCoregistrationFmap(BIDS, opt, subID); + + % Create rough mean of the 1rst run to improve SNR for coregistration + % TODO use the slice timed EPI if STC was used ? + sessions = getInfo(BIDS, subID, opt, 'Sessions'); + runs = getInfo(BIDS, subID, opt, 'Runs', sessions{1}); + [fileName, subFuncDataDir] = getBoldFilename(BIDS, subID, sessions{1}, runs{1}, opt); + spmup_basics(fullfile(subFuncDataDir, fileName), 'mean'); + + matlabbatch = []; + matlabbatch = setBatchCoregistrationFmap(matlabbatch, BIDS, opt, subID); saveAndRunWorkflow(matlabbatch, 'coregister_fmap', opt, subID); - matlabbatch = setBatchCreateVDMs(BIDS, opt, subID); + matlabbatch = []; + matlabbatch = setBatchCreateVDMs(matlabbatch, BIDS, opt, subID); saveAndRunWorkflow(matlabbatch, 'create_vdm', opt, subID); % TODO diff --git a/src/workflows/bidsFFX.m b/src/workflows/bidsFFX.m index f80db125..8a12ebbe 100644 --- a/src/workflows/bidsFFX.m +++ b/src/workflows/bidsFFX.m @@ -49,14 +49,14 @@ function bidsFFX(action, opt, funcFWHM) printProcessingSubject(groupName, iSub, subID); + matlabbatch = []; + switch action case 'specifyAndEstimate' - matlabbatch = setBatchSubjectLevelGLMSpec( ... - BIDS, opt, subID, funcFWHM); - - matlabbatch = setBatchFmriEstimate(matlabbatch); + matlabbatch = setBatchSubjectLevelGLMSpec(matlabbatch, BIDS, opt, subID, funcFWHM); + matlabbatch = setBatchEstimateModel(matlabbatch); batchName = ... ['specify_estimate_ffx_task-', opt.taskName, ... @@ -65,7 +65,7 @@ function bidsFFX(action, opt, funcFWHM) case 'contrasts' - matlabbatch = setBatchSubjectLevelContrasts(opt, subID, funcFWHM); + matlabbatch = setBatchSubjectLevelContrasts(matlabbatch, opt, subID, funcFWHM); batchName = ... ['contrasts_ffx_task-', opt.taskName, ... diff --git a/src/workflows/bidsGZipRawFolder.m b/src/workflows/bidsGZipRawFolder.m index 3e371fd4..99003501 100644 --- a/src/workflows/bidsGZipRawFolder.m +++ b/src/workflows/bidsGZipRawFolder.m @@ -1,7 +1,7 @@ % (C) Copyright 2020 CPP BIDS SPM-pipeline developers -function bidsGZipRawFolder(optSource, keepUnzippedNii) - +function bidsGZipRawFolder(opt, keepUnzippedNii) + % % % GZip the nii files in a ``raw`` bids folders from the. It will do it independently of the task. % @@ -10,7 +10,7 @@ function bidsGZipRawFolder(optSource, keepUnzippedNii) % bidsGZipRawFolder(optSource ... % [, keepUnzippedNii = false]) % - % :param optSource: The structure that contains the options set by the user to run the batch + % :param opt: The structure that contains the options set by the user to run the batch % workflow for source processing % :type opt: structure % :param keepUnzippedNii: will keep the original ``.nii`` if set to ``true``. Default is false @@ -27,12 +27,15 @@ function bidsGZipRawFolder(optSource, keepUnzippedNii) printWorklowName('GZip data'); - rawDir = optSource.dataDir; + rawDir = opt.dataDir; unzippedNiifiles = cellstr(spm_select('FPListRec', rawDir, '^.*.nii$')); - matlabbatch = setBatchGZip(unzippedNiifiles, keepUnzippedNii); + matlabbatch = []; + matlabbatch = setBatchGZip(matlabbatch, unzippedNiifiles, keepUnzippedNii); spm_jobman('run', matlabbatch); toc; + +end diff --git a/src/workflows/bidsRFX.m b/src/workflows/bidsRFX.m index 48a1d294..6eb7e022 100644 --- a/src/workflows/bidsRFX.m +++ b/src/workflows/bidsRFX.m @@ -49,7 +49,8 @@ function bidsRFX(action, opt, funcFWHM, conFWHM) case 'smoothContrasts' - matlabbatch = setBatchSmoothConImages(group, funcFWHM, conFWHM, opt); + matlabbatch = []; + matlabbatch = setBatchSmoothConImages(matlabbatch, group, funcFWHM, conFWHM, opt); saveAndRunWorkflow(matlabbatch, ... ['smooth_con_FWHM-', num2str(conFWHM), '_task-', opt.taskName], ... @@ -57,101 +58,39 @@ function bidsRFX(action, opt, funcFWHM, conFWHM) case 'RFX' - rfxDir = getRFXdir(opt, funcFWHM, conFWHM, contrastName); - - % Load the list of contrasts of interest for the RFX - grpLvlCon = getGrpLevelContrastToCompute(opt); - % ------ % TODO % - need to rethink where to save the anat and mask % - need to smooth the anat % - create a masked version of the anat too % - needs to be improved (maybe??) as the structural and mask may vary for - % different analysis + % different analysis % ------ - - matlabbatch = setBatchMeanAnatAndMask(opt, funcFWHM, rfxDir); - + matlabbatch = []; + matlabbatch = setBatchMeanAnatAndMask(matlabbatch, ... + opt, ... + funcFWHM, ... + fullfile(opt.derivativesDir, 'group')); saveAndRunWorkflow(matlabbatch, 'create_mean_struc_mask', opt); - % ------ - % TODO - % rfxDir should probably be set in setBatchFactorialDesign - % needs to be improved (maybe??) as the name may vary with FXHM and - % contrast - % ------ - - matlabbatch = setBatchFactorialDesign(grpLvlCon, group, conFWHM, rfxDir); - - saveAndRunWorkflow(matlabbatch, 'group_level_specification', opt); - - matlabbatch = setBatchEstimateGroupLevel(grpLvlCon); - - % ------ % TODO - % needs to be improved (maybe??) as the name may vary with FXHM and - % contrast - % ------ + % saving needs to be improved (maybe??) as the name may vary with FXHM and contrast + matlabbatch = []; + matlabbatch = setBatchFactorialDesign(matlabbatch, opt, funcFWHM, conFWHM); - saveAndRunWorkflow(matlabbatch, 'group_level_model_estimation', opt); + % Load the list of contrasts of interest for the RFX + grpLvlCon = getGrpLevelContrastToCompute(opt); + matlabbatch = setBatchEstimateModel(matlabbatch, grpLvlCon); - [matlabbatch] = setBatchContrastsGroupLevel(grpLvlCon, rfxDir); + saveAndRunWorkflow(matlabbatch, 'group_level_model_specification_estimation', opt); - % ------ % TODO - % needs to be improved (maybe??) as the name may vary with FXHM and - % contrast - % ------ - + % saving needs to be improved (maybe??) as the name may vary with FXHM and contrast + rfxDir = getRFXdir(opt, funcFWHM, conFWHM); + matlabbatch = []; + matlabbatch = setBatchGroupLevelContrasts(matlabbatch, grpLvlCon, rfxDir); saveAndRunWorkflow(matlabbatch, 'contrasts_rfx', opt); end end - -function conName = rmTrialTypeStr(conName) - conName = strrep(conName, 'trial_type.', ''); -end - -function matlabbatch = setBatchEstimateGroupLevel(grpLvlCon) - - printBatchName('estimate group level fmri model'); - - matlabbatch = {}; - - for j = 1:size(grpLvlCon, 1) - - conName = rmTrialTypeStr(grpLvlCon{j}); - - matlabbatch{j}.spm.stats.fmri_est.spmmat = ... - { fullfile(rfxDir, conName, 'SPM.mat') }; %#ok<*AGROW> - - matlabbatch{j}.spm.stats.fmri_est.method.Classical = 1; - - end - -end - -function [matlabbatch] = setBatchContrastsGroupLevel(grpLvlCon, rfxDir) - - printBatchName('group level contrast estimation'); - - matlabbatch = {}; - - % ADD/REMOVE CONTRASTS DEPENDING ON YOUR EXPERIMENT AND YOUR GROUPS - for j = 1:size(grpLvlCon, 1) - - conName = rmTrialTypeStr(grpLvlCon{j}); - - matlabbatch{j}.spm.stats.con.spmmat = ... - {fullfile(rfxDir, conName, 'SPM.mat')}; - - matlabbatch{j}.spm.stats.con.consess{1}.tcon.name = 'GROUP'; - matlabbatch{j}.spm.stats.con.consess{1}.tcon.convec = 1; - matlabbatch{j}.spm.stats.con.consess{1}.tcon.sessrep = 'none'; - - matlabbatch{j}.spm.stats.con.delete = 0; - end - -end diff --git a/src/workflows/bidsResults.m b/src/workflows/bidsResults.m index 6398ae6f..9b69e981 100644 --- a/src/workflows/bidsResults.m +++ b/src/workflows/bidsResults.m @@ -50,8 +50,8 @@ function bidsResults(opt, funcFWHM, conFWHM) setBatchSubjectLevelResults( ... matlabbatch, ... group, ... - funcFWHM, ... opt, ... + funcFWHM, ... iStep, ... iCon); diff --git a/src/workflows/bidsSTC.m b/src/workflows/bidsSTC.m index 56595797..032ab495 100644 --- a/src/workflows/bidsSTC.m +++ b/src/workflows/bidsSTC.m @@ -47,7 +47,8 @@ function bidsSTC(opt) printProcessingSubject(groupName, iSub, subID); - matlabbatch = setBatchSTC(BIDS, opt, subID); + matlabbatch = []; + matlabbatch = setBatchSTC(matlabbatch, BIDS, opt, subID); saveAndRunWorkflow(matlabbatch, 'STC', opt, subID); diff --git a/src/workflows/bidsSpatialPrepro.m b/src/workflows/bidsSpatialPrepro.m index 636c4d63..8e644864 100644 --- a/src/workflows/bidsSpatialPrepro.m +++ b/src/workflows/bidsSpatialPrepro.m @@ -67,31 +67,31 @@ function bidsSpatialPrepro(opt) if ~opt.realign.useUnwarp action = 'realign'; end - [matlabbatch, voxDim] = setBatchRealign(matlabbatch, BIDS, subID, opt, action); + [matlabbatch, voxDim] = setBatchRealign(matlabbatch, action, BIDS, opt, subID); opt.orderBatches.realign = 2; % dependency from file selector ('Anatomical') - matlabbatch = setBatchCoregistrationFuncToAnat(matlabbatch, BIDS, subID, opt); + matlabbatch = setBatchCoregistrationFuncToAnat(matlabbatch, BIDS, opt, subID); opt.orderBatches.coregister = 3; - matlabbatch = setBatchSaveCoregistrationMatrix(matlabbatch, BIDS, subID, opt); + matlabbatch = setBatchSaveCoregistrationMatrix(matlabbatch, BIDS, opt, subID); % dependency from file selector ('Anatomical') matlabbatch = setBatchSegmentation(matlabbatch, opt); opt.orderBatches.segment = 5; - matlabbatch = setBatchSkullStripping(matlabbatch, BIDS, subID, opt); + matlabbatch = setBatchSkullStripping(matlabbatch, BIDS, opt, subID); if strcmp(opt.space, 'MNI') % dependency from segmentation % dependency from coregistration - matlabbatch = setBatchNormalizationSpatialPrepro(matlabbatch, voxDim, opt); + matlabbatch = setBatchNormalizationSpatialPrepro(matlabbatch, opt, voxDim); end % if no unwarping was done on func, we reslice the func, so we can use % them for the functionalQA if ~opt.realign.useUnwarp - matlabbatch = setBatchRealign(matlabbatch, BIDS, subID, opt, 'reslice'); + matlabbatch = setBatchRealign(matlabbatch, 'reslice', BIDS, opt, subID); end batchName = ['spatial_preprocessing-' upper(opt.space(1)) opt.space(2:end)]; diff --git a/src/workflows/convert3Dto4D.m b/src/workflows/convert3Dto4D.m new file mode 100644 index 00000000..2e808131 --- /dev/null +++ b/src/workflows/convert3Dto4D.m @@ -0,0 +1,152 @@ +% (C) Copyright 2020 CPP BIDS SPM-pipeline developers + +function convert3Dto4D(optSource) + % + % It converts single volumes of a sequence in a 4D file, remove the dummies (optional), zip the + % 4D file (optional) and delete the converted files. Recursevly loops through a folder in which a + % not-yet-BIDS dataset live and the nii files are sorted in each sequence folder. + % + % USAGE:: + % + % convert3Dto4D(optSource) + % + % :param optSource: Obligatory argument. The structure that contains the options set by the user + % to run the batch workflow for source processing + % + % .. todo: + % + % - expand to run through multiple subjs ans groups + % (https://stackoverflow.com/questions/8748976/ + % list-the-subfolders-in-a-folder-matlab-only-subfolders-not-files) + % - generalize how to retrieve RT from sidecar json file + % - saveMatlabBatch(matlabbatch, ... + % ['3Dto4D_dataType-' num2str(dataType) '_RT-' num2str(RT)], opt, subID); + % - Cover the MoCo use case: if the sequence is MoCo (motion corrected when the "scanner" + % reconstructs the images - an option on can tick on Siemens scanner and that output an + % additional MoCo file with the regular sequence) then each JSON file of each volume contains + % the motion correction information for that volume. So only taking the JSON of the first + % volume means we "lose" the realignment parameters that could be useful later. + + % Get source folder content + sourceDataStruc = dir(optSource.sourceDir); + + isDir = [sourceDataStruc(:).isdir]; + + optSource.sequenceList = {sourceDataStruc(isDir).name}'; + + % Loop through the sequence folders + + tic; + + for iSeq = 1:size(optSource.sequenceList, 1) + + % Skip 'non' folders + if length(optSource.sequenceList{iSeq}) > 2 + + % Check if sequence to ignore or not + if contains(optSource.sequenceList(iSeq), optSource.sequenceToIgnore) + + warning('\nIGNORING SEQUENCE: %s\n', string(optSource.sequenceList(iSeq))); + + else + + fprintf('\n\nCONVERTING SEQUENCE: %s \n', char(optSource.sequenceList(iSeq))); + + % Set whether to remove dummies or not + + nbDummies = 0; + + if contains(optSource.sequenceList(iSeq), optSource.sequenceRmDummies) + + nbDummies = optSource.nbDummies; + + fprintf('\n\nREMOVING %s DUMMIES\n\n', num2str(nbDummies)); + + end + + % Get sequence folder path + sequencePath = fullfile(optSource.sourceDir, optSource.sequenceList{iSeq}); + + % Retrieve volume files info + [volumesList, outputNameImage] = parseFiles('nii', sequencePath, nbDummies); + + % Set output name, it takes the file name of the 1st volume of the 4D file and add subfix + outputNameImage = strrep(outputNameImage, '.nii', '_4D.nii'); + + % Retrieve sidecar json files info + [jsonList, outputNameJson] = parseFiles('json', sequencePath, nbDummies); + + jsonFile = spm_jsonread(jsonList{1}); + + % % % % % % LIEGE SPECIFIC % % % % % % % + RT = jsonFile.acqpar.RepetitionTime / 1000; + % % % % % % % % % % % % % % % % % % % % % + + % Set and run spm batch, input all the volumes minus the dummies if > 0 + matlabbatch = setBatch3Dto4D(volumesList(nbDummies + 1:end, :), ... + RT, ... + outputNameImage, ... + optSource.dataType); + + spm_jobman('run', matlabbatch); + + if optSource.zip + + % Zip and delete the and the new 4D file + fprintf(1, 'ZIP AND DELETE THE NEW 4D BRAIN \n\n'); + + gzip([sequencePath filesep outputNameImage]); + + delete([sequencePath filesep outputNameImage]); + + end + + % Save one sidecar json file, it takes the file name of the 1st volume of the 4D file and + % add subfix + if ~isempty(jsonList) + + copyfile(jsonList{1}, [sequencePath filesep strrep(outputNameJson, '.json', '_4D.json')]); + + end + + % Delete all the single volumes .nii and .json files + fprintf(1, 'EXTERMINATE SINGLE VOLUMES FILES \n\n'); + + for iDel = 1:length(volumesList) + + delete(volumesList{iDel}); + delete(jsonList{iDel}); + + end + + end + + end + + end + + toc; + +end + +function [fileList, outputName] = parseFiles(fileExtention, sequencePath, nbDummies) + + fileList = spm_select('list', sequencePath, fileExtention); + + if size(fileList, 1) > 0 + + outputName = fileList(nbDummies + 1, :); + + fileList = strcat(sequencePath, filesep, cellstr(fileList)); + + else + + fileList = {}; + + outputName = []; + + warning('\nI have found 0 files with extension ''.%s'' \n', fileExtention); + + end + +end diff --git a/tests/createDummyDataSet.sh b/tests/createDummyDataSet.sh index f9e96df4..d4de1e38 100755 --- a/tests/createDummyDataSet.sh +++ b/tests/createDummyDataSet.sh @@ -19,43 +19,96 @@ do do # create folder for each session and functional and fmap - ThisDir=$StartDir/sub-$Subject/ses-$Ses + mkdir $StartDir/sub-$Subject/ses-$Ses + + # FUNC + ThisDir=$StartDir/sub-$Subject/ses-$Ses/func mkdir $ThisDir - mkdir $ThisDir/func + touch $ThisDir/sub-$Subject\_ses-$Ses\_task-vismotion_run-1_bold.nii + touch $ThisDir/sub-$Subject\_ses-$Ses\_task-vismotion_run-2_bold.nii + touch $ThisDir/asub-$Subject\_ses-$Ses\_task-vismotion_run-1_bold.nii + touch $ThisDir/asub-$Subject\_ses-$Ses\_task-vismotion_run-2_bold.nii + + touch $ThisDir/mean_sub-$Subject\_ses-$Ses\_task-vismotion_run-1_bold.nii - rm $ThisDir/func/* + touch $ThisDir/sub-$Subject\_ses-$Ses\_task-vislocalizer_bold.nii + touch $ThisDir/meanusub-$Subject\_ses-$Ses\_task-vislocalizer_bold.nii + touch $ThisDir/s6wsub-$Subject\_ses-$Ses\_task-vislocalizer_bold.nii + touch $ThisDir/s6rsub-$Subject\_ses-$Ses\_task-vislocalizer_bold.nii + touch $ThisDir/s6usub-$Subject\_ses-$Ses\_task-vislocalizer_bold.nii + touch $ThisDir/s6wusub-$Subject\_ses-$Ses\_task-vislocalizer_bold.nii + touch $ThisDir/rp_sub-$Subject\_ses-$Ses\_task-vislocalizer_bold.txt - touch $ThisDir/func/sub-$Subject\_ses-$Ses\_task-vismotion_run-1_bold.nii - touch $ThisDir/func/sub-$Subject\_ses-$Ses\_task-vismotion_run-2_bold.nii - touch $ThisDir/func/sub-$Subject\_ses-$Ses\_task-vislocalizer_bold.nii + echo "onset\tduration\ttrial_type" >> $ThisDir/sub-$Subject\_ses-$Ses\_task-vislocalizer_events.tsv + echo "2\t15\tVisMot" >> $ThisDir/sub-$Subject\_ses-$Ses\_task-vislocalizer_events.tsv + echo "25\t15\tVisStat" >> $ThisDir/sub-$Subject\_ses-$Ses\_task-vislocalizer_events.tsv - touch $ThisDir/func/asub-$Subject\_ses-$Ses\_task-vismotion_run-1_bold.nii - touch $ThisDir/func/asub-$Subject\_ses-$Ses\_task-vismotion_run-2_bold.nii + echo "onset\tduration\ttrial_type" >> $ThisDir/sub-$Subject\_ses-$Ses\_task-vismotion_run-1_events.tsv + echo "2\t2\tVisMotUp" >> $ThisDir/sub-$Subject\_ses-$Ses\_task-vismotion_run-1_events.tsv + echo "4\t2\tVisMotDown" >> $ThisDir/sub-$Subject\_ses-$Ses\_task-vismotion_run-1_events.tsv - touch $ThisDir/func/meanusub-$Subject\_ses-$Ses\_task-vislocalizer_bold.nii - touch $ThisDir/func/s6wsub-$Subject\_ses-$Ses\_task-vislocalizer_bold.nii - touch $ThisDir/func/s6rsub-$Subject\_ses-$Ses\_task-vislocalizer_bold.nii - touch $ThisDir/func/s6usub-$Subject\_ses-$Ses\_task-vislocalizer_bold.nii - touch $ThisDir/func/s6wusub-$Subject\_ses-$Ses\_task-vislocalizer_bold.nii - touch $ThisDir/func/rp_sub-$Subject\_ses-$Ses\_task-vislocalizer_bold.txt + echo "onset\tduration\ttrial_type" >> $ThisDir/sub-$Subject\_ses-$Ses\_task-vismotion_run-2_events.tsv + echo "3\t2\tVisMotDown" >> $ThisDir/sub-$Subject\_ses-$Ses\_task-vismotion_run-2_events.tsv + echo "6\t2\tVisMotUp" >> $ThisDir/sub-$Subject\_ses-$Ses\_task-vismotion_run-2_events.tsv - echo "onset\tduration\ttrial_type" >> $ThisDir/func/sub-$Subject\_ses-$Ses\_task-vislocalizer_events.tsv - echo "2\t15\tVisMot" >> $ThisDir/func/sub-$Subject\_ses-$Ses\_task-vislocalizer_events.tsv - echo "25\t15\tVisStat" >> $ThisDir/func/sub-$Subject\_ses-$Ses\_task-vislocalizer_events.tsv + # FMAP + ThisDir=$StartDir/sub-$Subject/ses-$Ses/fmap + mkdir $ThisDir - echo "onset\tduration\ttrial_type" >> $ThisDir/func/sub-$Subject\_ses-$Ses\_task-vismotion_run-1_events.tsv - echo "2\t2\tVisMotUp" >> $ThisDir/func/sub-$Subject\_ses-$Ses\_task-vismotion_run-1_events.tsv - echo "4\t2\tVisMotDown" >> $ThisDir/func/sub-$Subject\_ses-$Ses\_task-vismotion_run-1_events.tsv + touch $ThisDir/sub-$Subject\_ses-$Ses\_run-1_phasediff.nii + touch $ThisDir/sub-$Subject\_ses-$Ses\_run-1_magnitude1.nii + touch $ThisDir/sub-$Subject\_ses-$Ses\_run-1_magnitude2.nii + touch $ThisDir/sub-$Subject\_ses-$Ses\_run-2_phasediff.nii + touch $ThisDir/sub-$Subject\_ses-$Ses\_run-2_magnitude1.nii + touch $ThisDir/sub-$Subject\_ses-$Ses\_run-2_magnitude2.nii - echo "onset\tduration\ttrial_type" >> $ThisDir/func/sub-$Subject\_ses-$Ses\_task-vismotion_run-2_events.tsv - echo "3\t2\tVisMotDown" >> $ThisDir/func/sub-$Subject\_ses-$Ses\_task-vismotion_run-2_events.tsv - echo "6\t2\tVisMotUp" >> $ThisDir/func/sub-$Subject\_ses-$Ses\_task-vismotion_run-2_events.tsv + EchoTime1=0.006 + EchoTime2=0.00746 + template='{"EchoTime1":%f, "EchoTime2":%f, "IntendedFor":"%s"}' - mkdir $ThisDir/anat + IntendedFor=`echo func/sub-$Subject\_ses-$Ses\_task-vismotion_run-1_bold.nii` + json_string=$(printf "$template" "$EchoTime1" "$EchoTime2" "$IntendedFor") + echo "$json_string" > $ThisDir/sub-$Subject\_ses-$Ses\_run-2_phasediff.json - touch $ThisDir/anat/sub-$Subject\_ses-$Ses\_T1w.nii + IntendedFor=`echo func/sub-$Subject\_ses-$Ses\_task-vislocalizer_bold.nii` + json_string=$(printf "$template" "$EchoTime1" "$EchoTime2" "$IntendedFor") + echo "$json_string" > $ThisDir/sub-$Subject\_ses-$Ses\_run-1_phasediff.json done + # ANAT + ThisDir=$StartDir/sub-$Subject/ses-01/anat + mkdir $ThisDir + + touch $ThisDir/sub-$Subject\_ses-01_T1w.nii + touch $ThisDir/msub-$Subject\_ses-01_T1w.nii + touch $ThisDir/wmsub-$Subject\_ses-01_T1w.nii + touch $ThisDir/c1sub-$Subject\_ses-01_T1w.nii + touch $ThisDir/c2sub-$Subject\_ses-01_T1w.nii + touch $ThisDir/c3sub-$Subject\_ses-01_T1w.nii + + # STATS + mkdir $StartDir/sub-$Subject/stats + mkdir $StartDir/sub-$Subject/stats/ffx_task-vismotion/ + ThisDir=$StartDir/sub-$Subject/stats/ffx_task-vismotion/ffx_space-MNI_FWHM-6 + mkdir $ThisDir + + cp $StartDir/sub-01/stats/ffx_task-vismotion/ffx_space-MNI_FWHM-6/SPM.mat $ThisDir + + touch $ThisDir/mask.nii + + touch $ThisDir/spmT_0001.nii + touch $ThisDir/spmT_0002.nii + + touch $ThisDir/con_0001.nii + touch $ThisDir/con_0002.nii + touch $ThisDir/con_0003.nii + touch $ThisDir/con_0004.nii + + touch $ThisDir/s6con_0001.nii + touch $ThisDir/s6con_0002.nii + touch $ThisDir/s6con_0003.nii + touch $ThisDir/s6con_0004.nii + done; diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/anat/sub-01_ses-01_T1w.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/anat/sub-01_ses-01_T1w.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/asub-01_ses-01_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/asub-01_ses-01_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/asub-01_ses-01_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/asub-01_ses-01_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/meanusub-01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/meanusub-01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/rp_sub-01_ses-01_task-vislocalizer_bold.txt b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/rp_sub-01_ses-01_task-vislocalizer_bold.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/s6rsub-01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/s6rsub-01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/s6usub-01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/s6usub-01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/s6wsub-01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/s6wsub-01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/s6wusub-01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/s6wusub-01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vislocalizer_desc-confounds_regressors.json b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vislocalizer_desc-confounds_regressors.json deleted file mode 100644 index efe53027..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vislocalizer_desc-confounds_regressors.json +++ /dev/null @@ -1,31 +0,0 @@ -{ - "Columns": [ - "trans_x", - "trans_y", - "trans_z", - "rot_x", - "rot_y", - "rot_z", - "trans_x_derivative1", - "trans_y_derivative1", - "trans_z_derivative1", - "rot_x_derivative1", - "rot_y_derivative1", - "rot_z_derivative1", - "trans_x_power2", - "trans_y_power2", - "trans_z_power2", - "rot_x_power2", - "rot_y_power2", - "rot_z_power2", - "trans_x_derivative1_power2", - "trans_y_derivative1_power2", - "trans_z_derivative1_power2", - "rot_x_derivative1_power2", - "rot_y_derivative1_power2", - "rot_z_derivative1_power2", - "censoring_regressor_1", - "censoring_regressor_2", - "censoring_regressor_3" - ] -} \ No newline at end of file diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vislocalizer_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vislocalizer_events.tsv deleted file mode 100644 index eef890c1..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vislocalizer_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 15 VisMot -25 15 VisStat diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vismotion_run-1_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vismotion_run-1_events.tsv deleted file mode 100644 index 899cce33..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vismotion_run-1_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 2 VisMotUp -4 2 VisMotDown diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vismotion_run-2_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vismotion_run-2_events.tsv deleted file mode 100644 index 4b01c47d..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-01/func/sub-01_ses-01_task-vismotion_run-2_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -3 2 VisMotDown -6 2 VisMotUp diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/anat/sub-01_ses-02_T1w.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/anat/sub-01_ses-02_T1w.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/asub-01_ses-02_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/asub-01_ses-02_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/asub-01_ses-02_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/asub-01_ses-02_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/meanusub-01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/meanusub-01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/rp_sub-01_ses-02_task-vislocalizer_bold.txt b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/rp_sub-01_ses-02_task-vislocalizer_bold.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/s6rsub-01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/s6rsub-01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/s6usub-01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/s6usub-01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/s6wsub-01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/s6wsub-01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/s6wusub-01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/s6wusub-01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vislocalizer_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vislocalizer_events.tsv deleted file mode 100644 index eef890c1..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vislocalizer_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 15 VisMot -25 15 VisStat diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vismotion_run-1_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vismotion_run-1_events.tsv deleted file mode 100644 index 899cce33..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vismotion_run-1_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 2 VisMotUp -4 2 VisMotDown diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vismotion_run-2_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vismotion_run-2_events.tsv deleted file mode 100644 index 4b01c47d..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-01/ses-02/func/sub-01_ses-02_task-vismotion_run-2_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -3 2 VisMotDown -6 2 VisMotUp diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/stats/ffx_task-vismotion/ffx_space-MNI_FWHM-6/SPM.mat b/tests/dummyData/derivatives/cpp_spm/sub-01/stats/ffx_task-vismotion/ffx_space-MNI_FWHM-6/SPM.mat new file mode 100644 index 00000000..7d25a82b Binary files /dev/null and b/tests/dummyData/derivatives/cpp_spm/sub-01/stats/ffx_task-vismotion/ffx_space-MNI_FWHM-6/SPM.mat differ diff --git a/tests/dummyData/derivatives/cpp_spm/sub-01/stats/ffx_visMotion/ffx_space-MNI_FWHM-6/SPM.mat b/tests/dummyData/derivatives/cpp_spm/sub-01/stats/ffx_visMotion/ffx_space-MNI_FWHM-6/SPM.mat deleted file mode 100644 index 19e65bcc..00000000 Binary files a/tests/dummyData/derivatives/cpp_spm/sub-01/stats/ffx_visMotion/ffx_space-MNI_FWHM-6/SPM.mat and /dev/null differ diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/anat/sub-02_ses-01_T1w.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/anat/sub-02_ses-01_T1w.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/asub-02_ses-01_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/asub-02_ses-01_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/asub-02_ses-01_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/asub-02_ses-01_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/meanusub-02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/meanusub-02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/rp_sub-02_ses-01_task-vislocalizer_bold.txt b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/rp_sub-02_ses-01_task-vislocalizer_bold.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/s6rsub-02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/s6rsub-02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/s6usub-02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/s6usub-02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/s6wsub-02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/s6wsub-02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/s6wusub-02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/s6wusub-02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vislocalizer_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vislocalizer_events.tsv deleted file mode 100644 index eef890c1..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vislocalizer_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 15 VisMot -25 15 VisStat diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vismotion_run-1_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vismotion_run-1_events.tsv deleted file mode 100644 index 899cce33..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vismotion_run-1_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 2 VisMotUp -4 2 VisMotDown diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vismotion_run-2_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vismotion_run-2_events.tsv deleted file mode 100644 index 4b01c47d..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-01/func/sub-02_ses-01_task-vismotion_run-2_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -3 2 VisMotDown -6 2 VisMotUp diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/anat/sub-02_ses-02_T1w.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/anat/sub-02_ses-02_T1w.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/asub-02_ses-02_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/asub-02_ses-02_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/asub-02_ses-02_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/asub-02_ses-02_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/meanusub-02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/meanusub-02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/rp_sub-02_ses-02_task-vislocalizer_bold.txt b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/rp_sub-02_ses-02_task-vislocalizer_bold.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/s6rsub-02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/s6rsub-02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/s6usub-02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/s6usub-02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/s6wsub-02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/s6wsub-02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/s6wusub-02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/s6wusub-02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vislocalizer_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vislocalizer_events.tsv deleted file mode 100644 index eef890c1..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vislocalizer_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 15 VisMot -25 15 VisStat diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vismotion_run-1_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vismotion_run-1_events.tsv deleted file mode 100644 index 899cce33..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vismotion_run-1_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 2 VisMotUp -4 2 VisMotDown diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vismotion_run-2_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vismotion_run-2_events.tsv deleted file mode 100644 index 4b01c47d..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-02/ses-02/func/sub-02_ses-02_task-vismotion_run-2_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -3 2 VisMotDown -6 2 VisMotUp diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/anat/sub-blind01_ses-01_T1w.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/anat/sub-blind01_ses-01_T1w.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/asub-blind01_ses-01_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/asub-blind01_ses-01_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/asub-blind01_ses-01_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/asub-blind01_ses-01_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/meanusub-blind01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/meanusub-blind01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/rp_sub-blind01_ses-01_task-vislocalizer_bold.txt b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/rp_sub-blind01_ses-01_task-vislocalizer_bold.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/s6rsub-blind01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/s6rsub-blind01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/s6usub-blind01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/s6usub-blind01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/s6wsub-blind01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/s6wsub-blind01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/s6wusub-blind01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/s6wusub-blind01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vislocalizer_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vislocalizer_events.tsv deleted file mode 100644 index eef890c1..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vislocalizer_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 15 VisMot -25 15 VisStat diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vismotion_run-1_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vismotion_run-1_events.tsv deleted file mode 100644 index 899cce33..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vismotion_run-1_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 2 VisMotUp -4 2 VisMotDown diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vismotion_run-2_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vismotion_run-2_events.tsv deleted file mode 100644 index 4b01c47d..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-01/func/sub-blind01_ses-01_task-vismotion_run-2_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -3 2 VisMotDown -6 2 VisMotUp diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/anat/sub-blind01_ses-02_T1w.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/anat/sub-blind01_ses-02_T1w.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/asub-blind01_ses-02_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/asub-blind01_ses-02_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/asub-blind01_ses-02_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/asub-blind01_ses-02_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/meanusub-blind01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/meanusub-blind01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/rp_sub-blind01_ses-02_task-vislocalizer_bold.txt b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/rp_sub-blind01_ses-02_task-vislocalizer_bold.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/s6rsub-blind01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/s6rsub-blind01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/s6usub-blind01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/s6usub-blind01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/s6wsub-blind01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/s6wsub-blind01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/s6wusub-blind01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/s6wusub-blind01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vislocalizer_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vislocalizer_events.tsv deleted file mode 100644 index eef890c1..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vislocalizer_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 15 VisMot -25 15 VisStat diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vismotion_run-1_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vismotion_run-1_events.tsv deleted file mode 100644 index 899cce33..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vismotion_run-1_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 2 VisMotUp -4 2 VisMotDown diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vismotion_run-2_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vismotion_run-2_events.tsv deleted file mode 100644 index 4b01c47d..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-blind01/ses-02/func/sub-blind01_ses-02_task-vismotion_run-2_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -3 2 VisMotDown -6 2 VisMotUp diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/anat/sub-blind02_ses-01_T1w.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/anat/sub-blind02_ses-01_T1w.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/asub-blind02_ses-01_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/asub-blind02_ses-01_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/asub-blind02_ses-01_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/asub-blind02_ses-01_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/meanusub-blind02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/meanusub-blind02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/rp_sub-blind02_ses-01_task-vislocalizer_bold.txt b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/rp_sub-blind02_ses-01_task-vislocalizer_bold.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/s6rsub-blind02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/s6rsub-blind02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/s6usub-blind02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/s6usub-blind02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/s6wsub-blind02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/s6wsub-blind02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/s6wusub-blind02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/s6wusub-blind02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vislocalizer_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vislocalizer_events.tsv deleted file mode 100644 index eef890c1..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vislocalizer_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 15 VisMot -25 15 VisStat diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vismotion_run-1_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vismotion_run-1_events.tsv deleted file mode 100644 index 899cce33..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vismotion_run-1_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 2 VisMotUp -4 2 VisMotDown diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vismotion_run-2_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vismotion_run-2_events.tsv deleted file mode 100644 index 4b01c47d..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-01/func/sub-blind02_ses-01_task-vismotion_run-2_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -3 2 VisMotDown -6 2 VisMotUp diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/anat/sub-blind02_ses-02_T1w.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/anat/sub-blind02_ses-02_T1w.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/asub-blind02_ses-02_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/asub-blind02_ses-02_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/asub-blind02_ses-02_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/asub-blind02_ses-02_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/meanusub-blind02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/meanusub-blind02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/rp_sub-blind02_ses-02_task-vislocalizer_bold.txt b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/rp_sub-blind02_ses-02_task-vislocalizer_bold.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/s6rsub-blind02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/s6rsub-blind02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/s6usub-blind02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/s6usub-blind02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/s6wsub-blind02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/s6wsub-blind02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/s6wusub-blind02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/s6wusub-blind02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vislocalizer_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vislocalizer_events.tsv deleted file mode 100644 index eef890c1..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vislocalizer_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 15 VisMot -25 15 VisStat diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vismotion_run-1_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vismotion_run-1_events.tsv deleted file mode 100644 index 899cce33..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vismotion_run-1_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 2 VisMotUp -4 2 VisMotDown diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vismotion_run-2_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vismotion_run-2_events.tsv deleted file mode 100644 index 4b01c47d..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-blind02/ses-02/func/sub-blind02_ses-02_task-vismotion_run-2_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -3 2 VisMotDown -6 2 VisMotUp diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/anat/sub-ctrl01_ses-01_T1w.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/anat/sub-ctrl01_ses-01_T1w.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/asub-ctrl01_ses-01_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/asub-ctrl01_ses-01_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/asub-ctrl01_ses-01_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/asub-ctrl01_ses-01_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/meanusub-ctrl01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/meanusub-ctrl01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/rp_sub-ctrl01_ses-01_task-vislocalizer_bold.txt b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/rp_sub-ctrl01_ses-01_task-vislocalizer_bold.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/s6rsub-ctrl01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/s6rsub-ctrl01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/s6usub-ctrl01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/s6usub-ctrl01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/s6wsub-ctrl01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/s6wsub-ctrl01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/s6wusub-ctrl01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/s6wusub-ctrl01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vislocalizer_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vislocalizer_events.tsv deleted file mode 100644 index eef890c1..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vislocalizer_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 15 VisMot -25 15 VisStat diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vismotion_run-1_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vismotion_run-1_events.tsv deleted file mode 100644 index 899cce33..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vismotion_run-1_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 2 VisMotUp -4 2 VisMotDown diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vismotion_run-2_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vismotion_run-2_events.tsv deleted file mode 100644 index 4b01c47d..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-01/func/sub-ctrl01_ses-01_task-vismotion_run-2_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -3 2 VisMotDown -6 2 VisMotUp diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/anat/sub-ctrl01_ses-02_T1w.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/anat/sub-ctrl01_ses-02_T1w.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/asub-ctrl01_ses-02_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/asub-ctrl01_ses-02_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/asub-ctrl01_ses-02_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/asub-ctrl01_ses-02_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/meanusub-ctrl01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/meanusub-ctrl01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/rp_sub-ctrl01_ses-02_task-vislocalizer_bold.txt b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/rp_sub-ctrl01_ses-02_task-vislocalizer_bold.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/s6rsub-ctrl01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/s6rsub-ctrl01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/s6usub-ctrl01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/s6usub-ctrl01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/s6wsub-ctrl01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/s6wsub-ctrl01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/s6wusub-ctrl01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/s6wusub-ctrl01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vislocalizer_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vislocalizer_events.tsv deleted file mode 100644 index eef890c1..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vislocalizer_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 15 VisMot -25 15 VisStat diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vismotion_run-1_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vismotion_run-1_events.tsv deleted file mode 100644 index 899cce33..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vismotion_run-1_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 2 VisMotUp -4 2 VisMotDown diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vismotion_run-2_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vismotion_run-2_events.tsv deleted file mode 100644 index 4b01c47d..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-ctrl01/ses-02/func/sub-ctrl01_ses-02_task-vismotion_run-2_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -3 2 VisMotDown -6 2 VisMotUp diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/anat/sub-ctrl02_ses-01_T1w.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/anat/sub-ctrl02_ses-01_T1w.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/asub-ctrl02_ses-01_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/asub-ctrl02_ses-01_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/asub-ctrl02_ses-01_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/asub-ctrl02_ses-01_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/meanusub-ctrl02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/meanusub-ctrl02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/rp_sub-ctrl02_ses-01_task-vislocalizer_bold.txt b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/rp_sub-ctrl02_ses-01_task-vislocalizer_bold.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/s6rsub-ctrl02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/s6rsub-ctrl02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/s6usub-ctrl02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/s6usub-ctrl02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/s6wsub-ctrl02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/s6wsub-ctrl02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/s6wusub-ctrl02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/s6wusub-ctrl02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vislocalizer_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vislocalizer_events.tsv deleted file mode 100644 index eef890c1..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vislocalizer_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 15 VisMot -25 15 VisStat diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vismotion_run-1_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vismotion_run-1_events.tsv deleted file mode 100644 index 899cce33..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vismotion_run-1_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 2 VisMotUp -4 2 VisMotDown diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vismotion_run-2_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vismotion_run-2_events.tsv deleted file mode 100644 index 4b01c47d..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-01/func/sub-ctrl02_ses-01_task-vismotion_run-2_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -3 2 VisMotDown -6 2 VisMotUp diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/anat/sub-ctrl02_ses-02_T1w.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/anat/sub-ctrl02_ses-02_T1w.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/asub-ctrl02_ses-02_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/asub-ctrl02_ses-02_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/asub-ctrl02_ses-02_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/asub-ctrl02_ses-02_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/meanusub-ctrl02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/meanusub-ctrl02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/rp_sub-ctrl02_ses-02_task-vislocalizer_bold.txt b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/rp_sub-ctrl02_ses-02_task-vislocalizer_bold.txt deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/s6rsub-ctrl02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/s6rsub-ctrl02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/s6usub-ctrl02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/s6usub-ctrl02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/s6wsub-ctrl02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/s6wsub-ctrl02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/s6wusub-ctrl02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/s6wusub-ctrl02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vislocalizer_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vislocalizer_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vislocalizer_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vislocalizer_events.tsv deleted file mode 100644 index eef890c1..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vislocalizer_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 15 VisMot -25 15 VisStat diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vismotion_run-1_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vismotion_run-1_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vismotion_run-1_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vismotion_run-1_events.tsv deleted file mode 100644 index 899cce33..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vismotion_run-1_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -2 2 VisMotUp -4 2 VisMotDown diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vismotion_run-2_bold.nii b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vismotion_run-2_bold.nii deleted file mode 100644 index e69de29b..00000000 diff --git a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vismotion_run-2_events.tsv b/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vismotion_run-2_events.tsv deleted file mode 100644 index 4b01c47d..00000000 --- a/tests/dummyData/derivatives/cpp_spm/sub-ctrl02/ses-02/func/sub-ctrl02_ses-02_task-vismotion_run-2_events.tsv +++ /dev/null @@ -1,3 +0,0 @@ -onset duration trial_type -3 2 VisMotDown -6 2 VisMotUp diff --git a/tests/dummyData/models/model-visMotionLoc_smdl.json b/tests/dummyData/models/model-visMotionLoc_smdl.json index a1c21046..aca51a49 100644 --- a/tests/dummyData/models/model-visMotionLoc_smdl.json +++ b/tests/dummyData/models/model-visMotionLoc_smdl.json @@ -2,7 +2,7 @@ "Name": "Motion localizer", "Description": "contrasts for the motion localizer dataset", "Input": { - "task": "visMotion" + "task": "vismotion" }, "Steps": [ { diff --git a/tests/test_createDefaultModel.m b/tests/test_createDefaultModel.m index 2819d34b..b10f963b 100644 --- a/tests/test_createDefaultModel.m +++ b/tests/test_createDefaultModel.m @@ -28,6 +28,6 @@ function test_createDefaultModelBasic() 'models', ... 'model-default_smdl.json')); - assertEqual(content, expectedContent); + assertEqual(content.Steps, expectedContent.Steps); end diff --git a/tests/test_getRFXdir.m b/tests/test_getRFXdir.m index f97da44d..3473ae94 100644 --- a/tests/test_getRFXdir.m +++ b/tests/test_getRFXdir.m @@ -16,9 +16,7 @@ function test_getRFXdirBasic() opt = setDerivativesDir(opt); - contrastName = 'stim_gt_baseline'; - - rfxDir = getRFXdir(opt, funcFWHM, conFWHM, contrastName); + rfxDir = getRFXdir(opt, funcFWHM, conFWHM); expectedOutput = fullfile( ... fileparts(mfilename('fullpath')), ... @@ -27,8 +25,7 @@ function test_getRFXdirBasic() 'cpp_spm', ... 'group', ... 'rfx_task-funcLocalizer', ... - 'rfx_funcFWHM-0_conFWHM-0', ... - 'stim_gt_baseline'); + 'rfx_funcFWHM-0_conFWHM-0'); assertEqual(exist(expectedOutput, 'dir'), 7); diff --git a/tests/test_setBatch3Dto4D.m b/tests/test_setBatch3Dto4D.m new file mode 100644 index 00000000..6a169d3e --- /dev/null +++ b/tests/test_setBatch3Dto4D.m @@ -0,0 +1,27 @@ +function test_suite = test_setBatch3Dto4D %#ok<*STOUT> + try % assignment of 'localfunctions' is necessary in Matlab >= 2016 + test_functions = localfunctions(); %#ok<*NASGU> + catch % no problem; early Matlab versions can use initTestSuite fine + end + initTestSuite; +end + +function test_setBatch3Dto4DBasic() + + volumesList = [ ... + fullfile(pwd, 'sub-01_task-rest_bold.nii,1'); ... + fullfile(pwd, 'sub-01_task-rest_bold.nii,2')]; + + RT = 2; + + matlabbatch = []; + matlabbatch = setBatch3Dto4D(matlabbatch, volumesList, RT); + + expectedBatch{1}.spm.util.cat.vols = volumesList; + expectedBatch{1}.spm.util.cat.name = fullfile(pwd, 'sub-01_task-rest_bold_4D.nii'); + expectedBatch{1}.spm.util.cat.dtype = 0; + expectedBatch{1}.spm.util.cat.RT = 2; + + assertEqual(matlabbatch, expectedBatch); + +end diff --git a/tests/test_setBatchComputeVDM.m b/tests/test_setBatchComputeVDM.m new file mode 100644 index 00000000..64774ded --- /dev/null +++ b/tests/test_setBatchComputeVDM.m @@ -0,0 +1,70 @@ +function test_suite = test_setBatchComputeVDM %#ok<*STOUT> + try % assignment of 'localfunctions' is necessary in Matlab >= 2016 + test_functions = localfunctions(); %#ok<*NASGU> + catch % no problem; early Matlab versions can use initTestSuite fine + end + initTestSuite; +end + +function test_setBatchComputeVDMBasic() + + fmapType = 'phasediff'; + refImage = fullfile(pwd, 'mean_sub-01-task-rest_bold.nii'); + + matlabbatch = []; + matlabbatch = setBatchComputeVDM(matlabbatch, fmapType, refImage); + + expectedBatch = returnExpectedBatch(refImage); + + assertEqual(matlabbatch, expectedBatch); + +end + +function expectedBatch = returnExpectedBatch(refImage) + + expectedBatch = []; + + expectedBatch{end + 1}.spm.tools.fieldmap.calculatevdm.subj(1).data.presubphasemag.phase = ''; + expectedBatch{end}.spm.tools.fieldmap.calculatevdm.subj(1).data.presubphasemag.magnitude = ''; + + UF = struct( ... + 'method', 'Mark3D', ... + 'fwhm', 10, ... + 'pad', 0, ... + 'ws', 1); + + MF = struct( ... + 'fwhm', 5, ... + 'nerode', 2, ... + 'ndilate', 4, ... + 'thresh', 0.5, ... + 'reg', 0.02); + + defaultsval = struct( ... + 'et', [NaN NaN], ... + 'maskbrain', 1, ... + 'blipdir', 1, ... + 'tert', '', ... + 'epifm', 0, ... % can be changed + 'ajm', 0, ... + 'uflags', UF, ... + 'mflags', MF); + + defaultsval.mflags.template = { spm_select( ... + 'FPList', ... + fullfile( ... + spm('dir'), ... + 'toolbox', ... + 'FieldMap'), ... + '^T1.nii$')}; + + expectedBatch{end}.spm.tools.fieldmap.calculatevdm.subj(1).defaults.defaultsval = defaultsval; + + expectedBatch{end}.spm.tools.fieldmap.calculatevdm.subj(1).session.epi = {refImage}; + expectedBatch{end}.spm.tools.fieldmap.calculatevdm.subj(1).matchvdm = 1; + expectedBatch{end}.spm.tools.fieldmap.calculatevdm.subj(1).sessname = 'vdm-'; + expectedBatch{end}.spm.tools.fieldmap.calculatevdm.subj(1).writeunwarped = 1; + expectedBatch{end}.spm.tools.fieldmap.calculatevdm.subj(1).anat = ''; + expectedBatch{end}.spm.tools.fieldmap.calculatevdm.subj(1).matchanat = 0; + +end diff --git a/tests/test_setBatchCoregistrationFuncToAnat.m b/tests/test_setBatchCoregistrationFuncToAnat.m index a8a6a687..fe07cb59 100644 --- a/tests/test_setBatchCoregistrationFuncToAnat.m +++ b/tests/test_setBatchCoregistrationFuncToAnat.m @@ -24,7 +24,7 @@ function test_setBatchCoregistrationFuncToAnatBasic() opt.orderBatches.realign = 2; matlabbatch = {}; - matlabbatch = setBatchCoregistrationFuncToAnat(matlabbatch, BIDS, subID, opt); + matlabbatch = setBatchCoregistrationFuncToAnat(matlabbatch, BIDS, opt, subID); nbRuns = 4; @@ -63,7 +63,7 @@ function test_setBatchCoregistrationFuncToAnatNoUnwarp() opt.orderBatches.realign = 2; matlabbatch = {}; - matlabbatch = setBatchCoregistrationFuncToAnat(matlabbatch, BIDS, subID, opt); + matlabbatch = setBatchCoregistrationFuncToAnat(matlabbatch, BIDS, opt, subID); nbRuns = 4; diff --git a/tests/test_setBatchFactorialDesign.m b/tests/test_setBatchFactorialDesign.m new file mode 100644 index 00000000..f8b75325 --- /dev/null +++ b/tests/test_setBatchFactorialDesign.m @@ -0,0 +1,28 @@ +function test_suite = test_setBatchFactorialDesign %#ok<*STOUT> + try % assignment of 'localfunctions' is necessary in Matlab >= 2016 + test_functions = localfunctions(); %#ok<*NASGU> + catch % no problem; early Matlab versions can use initTestSuite fine + end + initTestSuite; +end + +function test_setBatchFactorialDesignBasic() + + funcFWHM = 6; + conFWHM = 6; + + opt.subjects = {'01' '02'}; + opt.derivativesDir = fullfile(fileparts(mfilename('fullpath')), 'dummyData'); + opt.taskName = 'vismotion'; + opt.model.file = fullfile(fileparts(mfilename('fullpath')), ... + 'dummyData', 'models', 'model-visMotionLoc_smdl.json'); + + opt = checkOptions(opt); + + matlabbatch = []; + matlabbatch = setBatchFactorialDesign(matlabbatch, opt, funcFWHM, conFWHM); + + % TODO + % add assert + +end diff --git a/tests/test_setBatchGZip.m b/tests/test_setBatchGZip.m new file mode 100644 index 00000000..2651e069 --- /dev/null +++ b/tests/test_setBatchGZip.m @@ -0,0 +1,22 @@ +function test_suite = test_setBatchGZip %#ok<*STOUT> + try % assignment of 'localfunctions' is necessary in Matlab >= 2016 + test_functions = localfunctions(); %#ok<*NASGU> + catch % no problem; early Matlab versions can use initTestSuite fine + end + initTestSuite; +end + +function test_setBatchGZipBasic() + + unzippedNiifiles = 'sub-01_ses-01_T1w.nii'; + + matlabbatch = []; + matlabbatch = setBatchGZip(matlabbatch, unzippedNiifiles); + + expectedBatch{1}.cfg_basicio.file_dir.file_ops.cfg_gzip_files.files = 'sub-01_ses-01_T1w.nii'; + expectedBatch{1}.cfg_basicio.file_dir.file_ops.cfg_gzip_files.outdir = {''}; + expectedBatch{1}.cfg_basicio.file_dir.file_ops.cfg_gzip_files.keep = false(); + + assertEqual(matlabbatch, expectedBatch); + +end diff --git a/tests/test_setBatchImageCalculation.m b/tests/test_setBatchImageCalculation.m new file mode 100644 index 00000000..235d27a4 --- /dev/null +++ b/tests/test_setBatchImageCalculation.m @@ -0,0 +1,26 @@ +function test_suite = test_setBatchImageCalculation %#ok<*STOUT> + try % assignment of 'localfunctions' is necessary in Matlab >= 2016 + test_functions = localfunctions(); %#ok<*NASGU> + catch % no problem; early Matlab versions can use initTestSuite fine + end + initTestSuite; +end + +function test_setBatchImageCalculationBasic() + + input = {'sub-01_ses-01_T1w.nii'}; + output = 'sub-01_ses-01_T1w_thres.nii'; + outDir = pwd; + expression = 'i1 > 10'; + + matlabbatch = []; + matlabbatch = setBatchImageCalculation(matlabbatch, input, output, outDir, expression); + + expectedBatch{1}.spm.util.imcalc.input{1} = 'sub-01_ses-01_T1w.nii'; + expectedBatch{end}.spm.util.imcalc.output = 'sub-01_ses-01_T1w_thres.nii'; + expectedBatch{end}.spm.util.imcalc.outdir{1} = pwd; + expectedBatch{end}.spm.util.imcalc.expression = 'i1 > 10'; + + assertEqual(matlabbatch, expectedBatch); + +end diff --git a/tests/test_setBatchMeanAnatAndMask.m b/tests/test_setBatchMeanAnatAndMask.m new file mode 100644 index 00000000..780567c4 --- /dev/null +++ b/tests/test_setBatchMeanAnatAndMask.m @@ -0,0 +1,59 @@ +function test_suite = test_setBatchMeanAnatAndMask %#ok<*STOUT> + try % assignment of 'localfunctions' is necessary in Matlab >= 2016 + test_functions = localfunctions(); %#ok<*NASGU> + catch % no problem; early Matlab versions can use initTestSuite fine + end + initTestSuite; +end + +function test_setBatchMeanAnatAndMaskBasic() + + funcFWHM = 6; + + opt.subjects = {'01', '02'}; + opt.taskName = 'vismotion'; + opt.space = 'MNI'; + opt.derivativesDir = fullfile(fileparts(mfilename('fullpath')), ... + 'dummyData', ... + 'derivatives', ... + 'cpp_spm'); + + opt = checkOptions(opt); + + matlabbatch = []; + matlabbatch = setBatchMeanAnatAndMask(matlabbatch, opt, funcFWHM, pwd); + + % + expectedBatch{1}.spm.util.imcalc.input{1, 1} = fullfile(opt.derivativesDir, ... + 'sub-01', ... + 'ses-01', ... + 'anat', ... + 'wmsub-01_ses-01_T1w.nii'); + expectedBatch{1}.spm.util.imcalc.input{2, 1} = fullfile(opt.derivativesDir, ... + 'sub-02', ... + 'ses-01', ... + 'anat', ... + 'wmsub-02_ses-01_T1w.nii'); + + expectedBatch{1}.spm.util.imcalc.output = 'meanAnat.nii'; + expectedBatch{1}.spm.util.imcalc.outdir{1} = pwd; + expectedBatch{1}.spm.util.imcalc.expression = '(i1+i2)/2'; + + % + expectedBatch{2}.spm.util.imcalc.input{1, 1} = fullfile(opt.derivativesDir, 'sub-01', ... + 'stats', ... + 'ffx_task-vismotion', ... + 'ffx_space-MNI_FWHM-6', 'mask.nii'); + expectedBatch{2}.spm.util.imcalc.input{2, 1} = fullfile(opt.derivativesDir, ... + 'sub-02', ... + 'stats', ... + 'ffx_task-vismotion', ... + 'ffx_space-MNI_FWHM-6', 'mask.nii'); + + expectedBatch{2}.spm.util.imcalc.output = 'meanMask.nii'; + expectedBatch{2}.spm.util.imcalc.outdir{1} = pwd; + expectedBatch{2}.spm.util.imcalc.expression = '(i1+i2)>0.75*2'; + + assertEqual(matlabbatch, expectedBatch); + +end diff --git a/tests/test_setBatchNormalizationSpatialPrepro.m b/tests/test_setBatchNormalizationSpatialPrepro.m index 2d69117c..7a3199a5 100644 --- a/tests/test_setBatchNormalizationSpatialPrepro.m +++ b/tests/test_setBatchNormalizationSpatialPrepro.m @@ -16,7 +16,7 @@ function test_setBatchNormalizationSpatialPreproBasic() matlabbatch = {}; voxDim = [3 3 3]; - matlabbatch = setBatchNormalizationSpatialPrepro(matlabbatch, voxDim, opt); + matlabbatch = setBatchNormalizationSpatialPrepro(matlabbatch, opt, voxDim); expectedBatch = returnExpectedBatch(voxDim); diff --git a/tests/test_setBatchRealign.m b/tests/test_setBatchRealign.m index cf5bbc1a..5be5d90f 100644 --- a/tests/test_setBatchRealign.m +++ b/tests/test_setBatchRealign.m @@ -25,7 +25,7 @@ function test_setBatchRealignBasic() subID = '01'; matlabbatch = []; - matlabbatch = setBatchRealign(matlabbatch, BIDS, subID, opt); + matlabbatch = setBatchRealign(matlabbatch, BIDS, opt, subID); expectedBatch{1}.spm.spatial.realignunwarp.eoptions.weight = {''}; expectedBatch{end}.spm.spatial.realignunwarp.uwroptions.uwwhich = [2 1]; diff --git a/tests/test_setBatchSTC.m b/tests/test_setBatchSTC.m index bdb66312..d37a150c 100644 --- a/tests/test_setBatchSTC.m +++ b/tests/test_setBatchSTC.m @@ -16,7 +16,8 @@ function test_setBatchSTCEmpty() [~, opt, BIDS] = getData(opt); subID = '02'; - matlabbatch = setBatchSTC(BIDS, opt, subID); + matlabbatch = []; + matlabbatch = setBatchSTC(matlabbatch, BIDS, opt, subID); % no slice timing info for this run so nothing should be returned. assertEqual(matlabbatch, []); @@ -36,7 +37,9 @@ function test_setBatchSTCForce() [~, opt, BIDS] = getData(opt); subID = '02'; - matlabbatch = setBatchSTC(BIDS, opt, subID); + + matlabbatch = []; + matlabbatch = setBatchSTC(matlabbatch, BIDS, opt, subID); TR = 1.55; expectedBatch = returnExpectedBatch(opt.sliceOrder, opt.STC_referenceSlice, TR); @@ -66,7 +69,9 @@ function test_setBatchSTCBasic() [~, opt, BIDS] = getData(opt); subID = '02'; - matlabbatch = setBatchSTC(BIDS, opt, subID); + + matlabbatch = []; + matlabbatch = setBatchSTC(matlabbatch, BIDS, opt, subID); TR = 1.5; sliceOrder = repmat([ ... diff --git a/tests/test_setBatchSaveCoregistrationMatrix.m b/tests/test_setBatchSaveCoregistrationMatrix.m index 38d45e0c..89889ce1 100644 --- a/tests/test_setBatchSaveCoregistrationMatrix.m +++ b/tests/test_setBatchSaveCoregistrationMatrix.m @@ -22,7 +22,7 @@ function test_setBatchSaveCoregistrationMatrixBasic() opt.orderBatches.coregister = 1; matlabbatch = {}; - matlabbatch = setBatchSaveCoregistrationMatrix(matlabbatch, BIDS, subID, opt); + matlabbatch = setBatchSaveCoregistrationMatrix(matlabbatch, BIDS, opt, subID); expectedBatch = returnExpectedBatch(); assertEqual(matlabbatch, expectedBatch); diff --git a/tests/test_setBatchSkullStripping.m b/tests/test_setBatchSkullStripping.m index e63f6ac9..51d5cba2 100644 --- a/tests/test_setBatchSkullStripping.m +++ b/tests/test_setBatchSkullStripping.m @@ -24,7 +24,7 @@ function test_setBatchSkullStrippingBasic() opt.orderBatches.segment = 2; matlabbatch = []; - matlabbatch = setBatchSkullStripping(matlabbatch, BIDS, subID, opt); + matlabbatch = setBatchSkullStripping(matlabbatch, BIDS, opt, subID); expectedBatch = returnExpectedBatch(opt); diff --git a/tests/test_setBatchSmoothConImages.m b/tests/test_setBatchSmoothConImages.m new file mode 100644 index 00000000..87cf445e --- /dev/null +++ b/tests/test_setBatchSmoothConImages.m @@ -0,0 +1,72 @@ +function test_suite = test_setBatchSmoothConImages %#ok<*STOUT> + try % assignment of 'localfunctions' is necessary in Matlab >= 2016 + test_functions = localfunctions(); %#ok<*NASGU> + catch % no problem; early Matlab versions can use initTestSuite fine + end + initTestSuite; +end + +function test_setBatchSmoothConImagesBasic() + + opt.groups = {''}; + opt.subjects = {'01', '02'}; + opt.derivativesDir = fullfile(fileparts(mfilename('fullpath')), ... + 'dummyData', ... + 'derivatives', ... + 'cpp_spm'); + opt.taskName = 'vismotion'; + + funcFWHM = 6; + conFWHM = 6; + + opt = checkOptions(opt); + [group, opt] = getData(opt); + + matlabbatch = []; + matlabbatch = setBatchSmoothConImages(matlabbatch, group, opt, funcFWHM, conFWHM); + + expectedBatch{1}.spm.spatial.smooth.fwhm = [6 6 6]; + expectedBatch{1}.spm.spatial.smooth.prefix = 's6'; + expectedBatch{1}.spm.spatial.smooth.data = {fullfile(opt.derivativesDir, 'sub-01', 'stats', ... + 'ffx_task-vismotion', ... + 'ffx_space-MNI_FWHM-6', ... + 'con_0001.nii'); ... + fullfile(opt.derivativesDir, 'sub-01', 'stats', ... + 'ffx_task-vismotion', ... + 'ffx_space-MNI_FWHM-6', ... + 'con_0002.nii'); ... + fullfile(opt.derivativesDir, 'sub-01', 'stats', ... + 'ffx_task-vismotion', ... + 'ffx_space-MNI_FWHM-6', ... + 'con_0003.nii'); ... + fullfile(opt.derivativesDir, 'sub-01', 'stats', ... + 'ffx_task-vismotion', ... + 'ffx_space-MNI_FWHM-6', ... + 'con_0004.nii')}; + expectedBatch{1}.spm.spatial.smooth.dtype = 0; + expectedBatch{1}.spm.spatial.smooth.im = 0; + + expectedBatch{2}.spm.spatial.smooth.fwhm = [6 6 6]; + expectedBatch{2}.spm.spatial.smooth.prefix = 's6'; + expectedBatch{2}.spm.spatial.smooth.data = {fullfile(opt.derivativesDir, 'sub-02', 'stats', ... + 'ffx_task-vismotion', ... + 'ffx_space-MNI_FWHM-6', ... + 'con_0001.nii'); ... + fullfile(opt.derivativesDir, 'sub-02', 'stats', ... + 'ffx_task-vismotion', ... + 'ffx_space-MNI_FWHM-6', ... + 'con_0002.nii'); ... + fullfile(opt.derivativesDir, 'sub-02', 'stats', ... + 'ffx_task-vismotion', ... + 'ffx_space-MNI_FWHM-6', ... + 'con_0003.nii'); ... + fullfile(opt.derivativesDir, 'sub-02', 'stats', ... + 'ffx_task-vismotion', ... + 'ffx_space-MNI_FWHM-6', ... + 'con_0004.nii')}; + expectedBatch{2}.spm.spatial.smooth.dtype = 0; + expectedBatch{2}.spm.spatial.smooth.im = 0; + + assertEqual(matlabbatch{1}.spm.spatial.smooth.data, expectedBatch{1}.spm.spatial.smooth.data); + +end diff --git a/tests/test_setBatchSmoothing.m b/tests/test_setBatchSmoothing.m index 7c5d0c10..982219e3 100644 --- a/tests/test_setBatchSmoothing.m +++ b/tests/test_setBatchSmoothing.m @@ -8,46 +8,21 @@ function test_setBatchSmoothingBasic() - % TODO - % need a test with several sessions and runs + FWHM = 6; + prefix = 's6_'; - subID = '01'; - - funcFWHM = 6; - - opt.dataDir = fullfile(fileparts(mfilename('fullpath')), '..', 'demos', ... - 'MoAE', 'output', 'MoAEpilot'); - opt.taskName = 'auditory'; - - opt = checkOptions(opt); - - [~, opt, BIDS] = getData(opt); - - % create dummy normalized file - fileName = spm_BIDS(BIDS, 'data', ... - 'sub', subID, ... - 'task', opt.taskName, ... - 'type', 'bold'); - [filepath, filename, ext] = fileparts(fileName{1}); - fileName = fullfile( ... - filepath, ... - [spm_get_defaults('normalise.write.prefix'), ... - spm_get_defaults('unwarp.write.prefix'), ... - filename ext]); - system(sprintf('touch %s', fileName)); + images = { fullfile(pwd, 'sub-01_T1w.nii') }; matlabbatch = []; - matlabbatch = setBatchSmoothing(BIDS, opt, subID, funcFWHM); + matlabbatch = setBatchSmoothing(matlabbatch, images, FWHM, prefix); expectedBatch{1}.spm.spatial.smooth.fwhm = [6 6 6]; + expectedBatch{1}.spm.spatial.smooth.prefix = 's6_'; + expectedBatch{1}.spm.spatial.smooth.data = {fullfile(pwd, 'sub-01_T1w.nii')}; + expectedBatch{1}.spm.spatial.smooth.dtype = 0; expectedBatch{1}.spm.spatial.smooth.im = 0; - expectedBatch{1}.spm.spatial.smooth.prefix = ... - [spm_get_defaults('smooth.prefix'), '6']; - expectedBatch{1}.spm.spatial.smooth.data{1} = fileName; - assertEqual( ... - matlabbatch{1}.spm.spatial.smooth, ... - expectedBatch{1}.spm.spatial.smooth); + assertEqual(matlabbatch, expectedBatch); end diff --git a/tests/test_setBatchSmoothingFunc.m b/tests/test_setBatchSmoothingFunc.m new file mode 100644 index 00000000..0ea2ea31 --- /dev/null +++ b/tests/test_setBatchSmoothingFunc.m @@ -0,0 +1,51 @@ +function test_suite = test_setBatchSmoothingFunc %#ok<*STOUT> + try % assignment of 'localfunctions' is necessary in Matlab >= 2016 + test_functions = localfunctions(); %#ok<*NASGU> + catch % no problem; early Matlab versions can use initTestSuite fine + end + initTestSuite; +end + +function test_setBatchSmoothingFuncBasic() + + % TODO + % need a test with several sessions and runs + + subID = '01'; + + funcFWHM = 6; + + opt.dataDir = fullfile(fileparts(mfilename('fullpath')), '..', 'demos', ... + 'MoAE', 'output', 'MoAEpilot'); + opt.taskName = 'auditory'; + + opt = checkOptions(opt); + + [~, opt, BIDS] = getData(opt); + + % create dummy normalized file + fileName = spm_BIDS(BIDS, 'data', ... + 'sub', subID, ... + 'task', opt.taskName, ... + 'type', 'bold'); + [filepath, filename, ext] = fileparts(fileName{1}); + fileName = fullfile( ... + filepath, ... + [spm_get_defaults('normalise.write.prefix'), ... + spm_get_defaults('unwarp.write.prefix'), ... + filename ext]); + system(sprintf('touch %s', fileName)); + + matlabbatch = []; + matlabbatch = setBatchSmoothingFunc(matlabbatch, BIDS, opt, subID, funcFWHM); + + expectedBatch{1}.spm.spatial.smooth.fwhm = [6 6 6]; + expectedBatch{1}.spm.spatial.smooth.dtype = 0; + expectedBatch{1}.spm.spatial.smooth.im = 0; + expectedBatch{1}.spm.spatial.smooth.prefix = ... + [spm_get_defaults('smooth.prefix'), '6']; + expectedBatch{1}.spm.spatial.smooth.data{1} = fileName; + + assertEqual(matlabbatch, expectedBatch); + +end diff --git a/tests/test_setBatchSubjectLevelContrasts.m b/tests/test_setBatchSubjectLevelContrasts.m index 511e879e..5fc7855c 100644 --- a/tests/test_setBatchSubjectLevelContrasts.m +++ b/tests/test_setBatchSubjectLevelContrasts.m @@ -8,37 +8,51 @@ function test_setBatchSubjectLevelContrastsBasic() - funcFWHM = 6; subID = '01'; - iSes = 1; - iRun = 1; - - % directory with this script becomes the current directory - opt.subjects = {subID}; - opt.taskName = 'auditory'; - opt.dataDir = fullfile( ... - fileparts(mfilename('fullpath')), ... - '..', 'demos', 'MoAE', 'output', 'MoAEpilot'); - opt.model.file = fullfile(fileparts(mfilename('fullpath')), ... - '..', 'demos', 'MoAE', 'models', 'model-MoAE_smdl.json'); + funcFWHM = 6; + opt.derivativesDir = fullfile(fileparts(mfilename('fullpath')), 'dummyData'); + opt.space = 'MNI'; + opt.taskName = 'vismotion'; + opt.model.file = ... + fullfile(fileparts(mfilename('fullpath')), ... + 'dummyData', ... + 'models', ... + 'model-visMotionLoc_smdl.json'); + + opt = setDerivativesDir(opt); opt = checkOptions(opt); - ffxDir = fullfile(opt.derivativesDir, 'sub-01', 'stats', 'ffx_auditory', ... - 'ffx_space-MNI_FWHM-6'); + matlabbatch = []; + matlabbatch = setBatchSubjectLevelContrasts(matlabbatch, opt, subID, funcFWHM); - bidsCopyRawFolder(opt, 1); + expectedBatch = []; + expectedBatch{end + 1}.spm.stats.con.spmmat = {fullfile(opt.derivativesDir, ... + 'sub-01', ... + 'stats', ... + 'ffx_task-vismotion', ... + 'ffx_space-MNI_FWHM-6', ... + 'SPM.mat')}; + expectedBatch{end}.spm.stats.con.delete = 1; - % matlabbatch = setBatchSubjectLevelContrasts(opt, subID, funcFWHM); + consess{1}.tcon.name = 'VisMot'; %#ok<*AGROW> + consess{1}.tcon.convec = [1 0 0 0 0 0 0 0 0]; + consess{1}.tcon.sessrep = 'none'; - % TODO add assert - % expectedBatch = returnExpectedBatch(); - % assert(matlabbatch, returnExpectedBatch); + consess{2}.tcon.name = 'VisStat'; %#ok<*AGROW> + consess{2}.tcon.convec = [0 1 0 0 0 0 0 0 0]; + consess{2}.tcon.sessrep = 'none'; -end + consess{3}.tcon.name = 'VisMot_gt_VisStat'; %#ok<*AGROW> + consess{3}.tcon.convec = [1 -1 0 0 0 0 0 0 0]; + consess{3}.tcon.sessrep = 'none'; -% function expectedBatch = returnExpectedBatch() -% -% -% -% end + consess{4}.tcon.name = 'VisStat_gt_VisMot'; %#ok<*AGROW> + consess{4}.tcon.convec = [-1 1 0 0 0 0 0 0 0]; + consess{4}.tcon.sessrep = 'none'; + + expectedBatch{end}.spm.stats.con.consess = consess; + + assertEqual(matlabbatch{1}.spm.stats.con, expectedBatch{1}.spm.stats.con); + +end diff --git a/tests/test_setBatchSubjectLevelGLMSpec.m b/tests/test_setBatchSubjectLevelGLMSpec.m index c824e4b4..f5c53c2b 100644 --- a/tests/test_setBatchSubjectLevelGLMSpec.m +++ b/tests/test_setBatchSubjectLevelGLMSpec.m @@ -39,7 +39,8 @@ function test_setBatchSubjectLevelGLMSpecBasic() system(sprintf('touch %s', ... fullfile(subFuncDataDir, ['rp_', strrep(fileName, '.nii', '.txt')]))); - matlabbatch = setBatchSubjectLevelGLMSpec(BIDS, opt, subID, funcFWHM); + matlabbatch = []; + matlabbatch = setBatchSubjectLevelGLMSpec(matlabbatch, BIDS, opt, subID, funcFWHM); % TODO add assert % expectedBatch = returnExpectedBatch(); diff --git a/tests/test_specifyContrasts.m b/tests/test_specifyContrasts.m index f31380a4..5c3ff220 100644 --- a/tests/test_specifyContrasts.m +++ b/tests/test_specifyContrasts.m @@ -9,16 +9,19 @@ function test_specifyContrastsBasic() % Small test to ensure that pmCon returns what we asked for + subID = '01'; + funcFWFM = 6; + opt.derivativesDir = fullfile(fileparts(mfilename('fullpath')), 'dummyData'); - opt.taskName = 'visMotion'; + opt.space = 'MNI'; + opt.taskName = 'vismotion'; opt.model.file = ... fullfile(fileparts(mfilename('fullpath')), ... 'dummyData', 'models', 'model-visMotionLoc_smdl.json'); opt = setDerivativesDir(opt); - ffxDir = fullfile(opt.derivativesDir, 'sub-01', 'stats', 'ffx_visMotion', ... - 'ffx_space-MNI_FWHM-6'); + ffxDir = getFFXdir(subID, funcFWFM, opt); contrasts = specifyContrasts(ffxDir, opt.taskName, opt);