mriqc.utils package

Submodules

mriqc.utils.misc module

Helper functions

mriqc.utils.misc.bids_getfile(bids_dir, data_type, subject_id, session_id=None, run_id=None)[source]

A simple function to select files from a BIDS structure

Example:

>>> from mriqc.data import get_ds003_downsampled
>>> bids_getfile(get_ds003_downsampled(), 'anat', '05') 

u’...ds003_downsampled/sub-05/anat/sub-05_T1w.nii.gz’

mriqc.utils.misc.bids_path(subid, sesid=None, runid=None, prefix=None, out_path=None, ext='json')[source]
mriqc.utils.misc.bids_scan_file_walker(dataset='.', include_types=None, warn_no_files=False)[source]

Traverse a BIDS dataset and provide a generator interface to the imaging files contained within.

Author:@chrisfilo

https://github.com/preprocessed-connectomes-project/quality-assessment-protocol/blob/master/scripts/qap_bids_data_sublist_generator.py

Parameters:
  • dataset (str) – path to the BIDS dataset folder.
  • include_types (list(str)) – a list of the scan types (i.e. subfolder names) to include in the results. Can be any combination of “func”, “anat”, “fmap”, “dwi”.
  • warn_no_files (bool) – issue a warning if no imaging files are found for a subject or a session.
Returns:

a list containing, for each .nii or .nii.gz file found, the BIDS identifying tokens and their values. If a file doesn’t have an identifying token its key will be None.

mriqc.utils.misc.gather_bids_data(dataset_folder, subject_inclusion=None, include_types=None)[source]

Extract data from BIDS root folder

mriqc.utils.misc.reorder_csv(csv_file, out_file=None)[source]

Put subject, session and scan in front of csv file

Parameters:
  • csv_file (str) – the input csv file
  • out_file (str) – if provided, a new csv file is created
Returns:

the path to the file with the columns reordered

mriqc.utils.misc.rotate_files(fname)[source]

A function to rotate file names

Module contents

Module utils.misc contains utilities