Configuration

Options

Most of the options you have chosen for your analysis will be set in a variable opt an Octave/Matlab structure.

Documentation on the options can be found here: checkOptions().

The content of that structure can be defined:

  • at run time in a script or a function

  • in a separate json file (that will be loaded with loadAndCheckOptions()).

You can find examples of both in the demos folder.

See checkOptions() for a list of all the options set by that function.

See bidsResults() for more details on the options to set to get specific results.

Defaults

The defaults are handled mostly by those functions:

spm_my_defaults

Some more SPM options can be set in the spm_my_defaults().

statistics defaults

Note that some of the defaults value may be over-ridden by the content of the opt structure but also by the content of your BIDS stats model.

Serial correlation modelisation

Use of FAST [OARW19] and not AR1 for auto-correlation modelisation.

Using FAST does not seem to affect results on time series with “normal” TRs but improves results when using sequences: it is therefore used by default in this pipeline.

See the Software section in the BIDS stats model page if you want to use the BIDS stats model to change the serial correlation modelisation.

SPM to BIDS filename conversion

set_spm_2_bids_defaults()

Setting directories

Below are some example on how to specify input and output directories.

Note

It will be easier and make your code more portable, if you use relative path for your directory setting.

For preprocessing

For a given folder structure:

my_fmri_project
  ├── code
  │   └── getOptionPreproc.m
  ├── outputs/derivatives
  └── inputs
      └── raw

Example content of getOptionPreproc file:

opt.pipeline.type = 'preproc';

this_dir = fileparts(mfilename('fullpath'));

opt.dir.raw = fullfile(this_dir, '..' 'inputs', 'raw');
opt.dir.derivatives = fullfile(this_dir, '..', 'outputs', 'derivatives');

For statistics

To run a GLM, bidspm gets the images and confound time series from a preprocessed derivatives BIDS dataset (from fMRIprep or bidspm) and the events.tsv files from a raw BIDS dataset.

For a given folder structure:

my_fmri_project
  ├── code
  │   └── getOptionStats.m
  ├── outputs/derivatives
  └── inputs
      ├── fmriprep
      └── raw

Example content of getOptionStats file:

opt.pipeline.type = 'stats';

this_dir = fileparts(mfilename('fullpath'));

opt.dir.raw = fullfile(this_dir, '..', 'inputs', 'raw');
opt.dir.preproc = fullfile(this_dir, '..', 'inputs', 'fmriprep');
opt.dir.derivatives = fullfile(this_dir, '..', 'outputs', 'derivatives');

The actual opt.dir.input and opt.dir.output folders will usually be set automatically when running:

opt = checkOptions(opt)

But you can set those by hand if you prefer.

List of defaults

opt.QA.glm.do = 0, ;
opt.anatOnly = 0, ;
opt.bidsFilterFile.bold.modality = 'func'  ;
opt.bidsFilterFile.bold.suffix = 'bold'  ;
opt.bidsFilterFile.fmap.modality = 'fmap'  ;
opt.bidsFilterFile.mp2rage.modality = 'anat'  ;
opt.bidsFilterFile.mp2rage.space = ''  ;
opt.bidsFilterFile.mp2rage.suffix = 'MP2RAGE'  ;
opt.bidsFilterFile.roi.modality = 'roi'  ;
opt.bidsFilterFile.roi.suffix = 'mask'  ;
opt.bidsFilterFile.t1w.modality = 'anat'  ;
opt.bidsFilterFile.t1w.space = ''  ;
opt.bidsFilterFile.t1w.suffix = 'T1w'  ;
opt.bidsFilterFile.t2w.modality = 'anat'  ;
opt.bidsFilterFile.t2w.suffix = 'T2w'  ;
opt.bidsFilterFile.xfm.modality = 'anat'  ;
opt.bidsFilterFile.xfm.suffix = 'xfm'  ;
opt.bidsFilterFile.xfm.to = 'T1w'  ;
opt.boilerplate_only = 0, ;
opt.contrastList = {};
opt.dir.derivatives = 'derivatives'  ;
opt.dir.input = ''  ;
opt.dir.jobs = 'jobs'  ;
opt.dir.output = ''  ;
opt.dir.preproc = ''  ;
opt.dir.raw = ''  ;
opt.dir.roi = 'derivatives/bidspm-roi'  ;
opt.dir.stats = ''  ;
opt.dryRun = 0, ;
opt.dummyScans = 0.000, ;
opt.funcVolToSelect = []  ;
opt.funcVoxelDims = []  ;
opt.fwhm.contrast = 0.000, ;
opt.fwhm.func = 6.000, ;
opt.glm.keepResiduals = 0, ;
opt.glm.maxNbVols = Inf, ;
opt.glm.roibased.do = 0, ;
opt.glm.useDummyRegressor = 0, ;
opt.groups{1} = ''  ;
opt.model.designOnly = 0, ;
opt.model.file = ''  ;
opt.msg.color = ''  ;
opt.pipeline.name = 'bidspm'  ;
opt.pipeline.type = ''  ;
opt.query.modality{1} = 'anat'  ;
opt.query.modality{2} = 'func'  ;
opt.realign.useUnwarp = 1, ;
opt.rename.do = 1, ;
opt.rename.overwrite = 1, ;
opt.results.MC = 'FWE'  ;
opt.results.atlas = 'Neuromorphometrics'  ;
opt.results.binary = 0, ;
opt.results.csv = 1, ;
opt.results.k = 0.000, ;
opt.results.montage.background = '/home/remi/github/spm12/canonical/avg152T1.nii'  ;
opt.results.montage.do = 0, ;
opt.results.montage.orientation = 'axial'  ;
opt.results.montage.slices = []  ;
opt.results.name{1} = ''  ;
opt.results.nidm = 1, ;
opt.results.nodeName = ''  ;
opt.results.p = 0.050, ;
opt.results.png = 1, ;
opt.results.threshSpm = 0, ;
opt.results.useMask = 0, ;
opt.segment.biasfwhm = 60.000, ;
opt.segment.do = 1, ;
opt.segment.force = 0, ;
opt.segment.samplingDistance = 3.000, ;
opt.skullstrip.do = 1, ;
opt.skullstrip.force = 0, ;
opt.skullstrip.mean = 0, ;
opt.skullstrip.threshold = 0.750, ;
opt.space{1} = 'individual'  ;
opt.space{2} = 'IXI549Space'  ;
opt.stc.referenceSlice = []  ;
opt.stc.skip = 0, ;
opt.subjects{1} = []  ;
opt.tolerant = 1, ;
opt.toolbox.MACS.model.files = []  ;
opt.useBidsSchema = 0, ;
opt.useFieldmaps = 1, ;
opt.verbosity = 2.000, ;
opt.zeropad = 2.000, ;