Configuration File

The YAML (.yml) configuration file dictates what modalities and parameter information is used to write the BIDS NIFTI files, in addition to its associated metadata.

Configuration File Keywords

The configuration file will look for these 5 distinct keywords:

  • modality_search: Heuristic search terms for each modality (required).

  • bids_search: Heuristic search terms for each BIDS related filename description.

  • bids_map: Corresponding terms to map bids_search’s search terms to.

  • metadata: The metadata to write to each image file’s JSON (sidecar) file.

  • exclude: Files and/or modalities to exclude that contain any words in this list.

bids_search & bids_map

The bids_search and bids_map keywords are optional and intended for a heurestic search and mapping (, respectively) for BIDS descriptive labels in the source data, and what the output BIDS filename should contain. For example, subject 1 has a high resolution T1 weighted image stored in a DICOM directory as 001/T1_HighRes_05mm/MR000001.dcm. The output BIDS NIFTI file should preferably have the acq field populated to reflect this: sub-001/anat/sub-001_acq-highres05mm_run-01_T1w.nii.gz. This can be accomplished in the configuration file as shown below:

# Heurestic search terms for BIDS descriptive naming conventions

bids_search:
    anat:
        T1w:
            acq:
                - HighRes_05mm
            ce:
            rec:

# BIDS terms to map to

bids_map:
    anat:
        T1w:
            acq:
                - highres05mm
            ce:
            rec:

Warning

As bids_search parameters can accept a multiple search terms, bids_map is only capable of mapping to only one term. For example:

# Heurestic search terms for BIDS descriptive naming conventions

bids_search:
    anat:
        T1w:
            acq:
                - HighRes_05mm
                - HighRes_01mm
            ce:
            rec:

# BIDS terms to map to

bids_map:
    anat:
        T1w:
            acq:
                - highres05mm
                - highres01mm
            ce:
            rec:

This would result in only the last entry in bids_map for the acq field being written to the output NIFTI files that match these search terms (sub-001/anat/sub-001_acq-highres01mm_run-01_T1w.nii.gz) despite the fact that files may be found that contain either HighRes_05mm or HighRes_01mm in their filename or file header.

Note

The work-around for this issue would be to use one set of search and map labels to process one set of files, while ignoring/excluding the other, followed by switching HighRes_01mm and HighRes_05mm, as shown below:

# Heurestic search terms for BIDS descriptive naming conventions

bids_search:
    anat:
        T1w:
            acq:
                - HighRes_05mm
            ce:
            rec:

# BIDS terms to map to

bids_map:
    anat:
        T1w:
            acq:
                - highres05mm
            ce:
            rec:

# Exclude/Ignore terms

exclude:
    - HighRes_01mm

This would achieve the desired output: sub-001/anat/sub-001_acq-highres05mm_run-01_T1w.nii.gz.

metadata

The metadata keyword is optional, but strongly recommended. The metadata field in the configuration file will write the modality specific metadata for each NIFTI file’s JSON (sidecar) file. Additionally, the word common may also be specified under metadata to include metadata that is common between all of the study’s source images.

For example:

metadata:
    common:
        Manufacturer: Philips
        ManufacturersModelName: Ingenia
        MagneticFieldStrength: 3
        InstitutionName: Cincinnati Children's Hospital Medical Center
    func:
        rest:
            ParallelAcquisitionTechnique: SENSE
            ParallelReductionFactorInPlane: 1.5
            MultibandAccelerationFactor: 2
            TaskName: Resting State
            TaskDescription: Resting state scan, in which the participant looks at a fixed cross (+).
        nback:
            ParallelAcquisitionTechnique: SENSE
            ParallelReductionFactorInPlane: 1.0
            MultibandAccelerationFactor: 1
            TaskName: N-back Task
            TaskDescription: Working memory task.
    fmap:
        Units: Hz

Warning

The metadata names for the fields above (e.g. TaskName, InstitutionName, MagneticFieldStrength etc.) must be in CamelCase otherwise, a BIDSMetaDataError exception will be raised.

exclude

Files and/or modalities that one wants ignored can be done by specifying the exclude keyword, followed by a list of words that the associated files/modalities would contain (and are not case sensitive). For example:

exclude:
    - SURVEY
    - ScreenCapture
    - ProtonDensity
    - PD            # Some ProtonDensity images may be labeled with this in the filename
    - T1Rho

The above example would simply ignore all files that contain these words - which would achieve the goal of excluding files and/or image data that would generally correspond to:

  • Survey images

  • Secondary screen captures

  • Proton Density images

  • T1 rho images

Example Configuration File

Below is an example configuration file.

# Example configuration file

# Heurestic search terms for each modality
modality_search:
    # Anatomical scans
    anat:
        T1w:
            - T1
            - T1w
        T2w:
            - T2
            - T2w

    # Functional scans
    func:
        # BOLD contrast
        bold:
            rest:
                - rsfMR
                - rest

    # Diffusion Weighted Scans
    dwi:
        dwi:
            - diffusion


# Metadata Settings
metadata:
    common:
        Manufacturer: Philips
        ManufacturersModelName: Ingenia
        MagneticFieldStrength: 3
        InstitutionName: Cincinnati Children's Hospital Medical Center
    func:
        rest:
            ParallelAcquisitionTechnique: SENSE # GRAPPA, for the general term
            PhaseEncodingDirection: 'j'
            MultibandAccelerationFactor: 2
            TaskName: Resting State
            NumberOfVolumesDiscardedByScanner: 4

# Exclusion List (these filenames are not converted)
exclude:
    - SURVEY
    - Reg
    - DEFAULT
    - ScreenCapture