Function details

spm_2_bids only provides names to use but does not actually rename the files.

src.spm_2_bids(varargin)

Provides a bids derivatives name for a file preprocessed with SPM

USAGE:

[new_filename, pth, json] = spm_2_bids(file [, map][, verbose])
Parameters:
  • file (string) – SPM preprocessed filename (can be fullpath); for example wmsub-01_ses-01_T1w.nii

  • map – optional spm_2_bids map to overwrite the default map (see Mapping)

  • map – Mapping object

  • verbose

  • verbose – boolean

Returns:

  • new_filename:

    (string) BIDS compatible filename for example sub-01_ses-01_space-IXI549Space_desc-preproc_T1w.nii;

  • pth:

    (string) relative BIDS path for example sub-01/ses-01

  • json:

    (structure) JSON derivatives content

The behaviour of which prefix gives which BIDS derivatives can be modified by adapting the cfg.

src.defaults.check_cfg(cfg)

Check the option inputs and add any missing field with some defaults

USAGE:

cfg = check_cfg(cfg)
Parameters:

cfg (structure) – structure or json filename containing the spm_2_bids.anat.

Returns:

  • cfg:

    the option structure with missing values filled in by the defaults.

cfg fields:

  • all_entity_order: order of all the official bids entities

  • entity_order: order of the entities in bids derivatives

  • fwhm: value to append to smoothing description label

  • spec: specification details to over ride some of the defaults

BIDS derivatives defining fields:

Each of those fields contain a structure that lists the BIDS suffix and entities-label pairs for each type of preprocessed image.

  • segment

  • stc

  • realign_unwarp

  • real_param

  • mean

  • normalized_mean

  • preproc

  • preproc_norm

  • smooth

  • smooth_norm

For example:

% for grey matter segmentation output
cfg.segment.gm = struct('entities', struct('space', 'individual', ...
                                           'label', x), ...
                        'suffix', 'probseg')
src.defaults.Mapping