Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.
brainprep.workflow.quasiraw.brainprep_quasiraw¶
- brainprep.workflow.quasiraw.brainprep_quasiraw(anatomical_file, output_dir, keep_intermediate=False, **kwargs)[source]¶
Quasi-RAW pre-processing.
Applies the Quasi-RAW pre-processing described in [1]. This includes:
Reorient the anatomical image to standard MNI152 template space.
Compute a brain mask using a skull-stripping tool.
Apply the brain mask to the anatomical image.
Resample the anatomical image to 1mm isotropic voxel size.
Resample the brain mask image to 1mm isotropic voxel size.
Perform N4 bias field correction.
Linearly (9 dof) register the image to the MNI152 1mm template space.
Apply the registration to the antomical image.
Apply the registration to the brain mask image.
Apply the brain mask to the registered anatomical image.
- Parameters:
- anatomical_file: File
Path to the input image file.
- output_dir: Directory
Directory where the outputs will be saved (i.e., the root of your dataset).
- keep_intermediatebool
If True, retains intermediate results (i.e., the workspace); useful for debugging. Default False.
- **kwargsdict
- entities: dict
Dictionary of parsed BIDS entities.
- Returns:
- Bunch
A dictionary-like object containing:
aligned_anatomical_file : File - path to the aligned anatomical image - a Nifti file with the suffix “_T1w”.
aligned_mask_file : File - path to the aligned mask image - a Nifti file with the suffix “_mod-T1w_brainmask”.
transform_file : File - path to the 9 dof affine transformation - a text file with the suffix “_mod-T1w_affine”.
- Raises:
- ValueError
If the input anatomical file is not BIDS-compliant.
Notes
This workflow assumes the anatomical image is organized in BIDS.
References
Examples
>>> from brainprep.config import Config >>> from brainprep.reporting import RSTReport >>> from brainprep.workflow import brainprep_quasiraw >>> >>> with Config(dryrun=True, verbose=False): ... report = RSTReport() ... outputs = brainprep_quasiraw( ... anatomical_file=( ... "/tmp/dataset/rawdata/sub-01/ses-01/anat/" ... "sub-01_ses-01_run-01_T1w.nii.gz" ... ), ... output_dir="/tmp/dataset/derivatives", ... ) >>> outputs Bunch( aligned_anatomical_file: PosixPath('...') aligned_mask_file: PosixPath('...') transform_file: PosixPath('...') )