cmtklib.functionalMRI module¶
Module that defines CMTK Nipype interfaces for the Functional MRI pipeline.
Detrending¶
Bases: nipype.interfaces.base.core.BaseInterface
Apply linear, quadratic or cubic detrending on the Functional MRI signal.
Examples
>>> from cmtklib.functionalMRI import Detrending >>> detrend = Detrending() >>> detrend.inputs.base_dir = '/my_directory' >>> detrend.inputs.in_file = '/path/to/sub-01_task-rest_desc-preproc_bold.nii.gz' >>> detrend.inputs.gm_file = ['/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale1_dseg.nii.gz', >>> '/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale2_dseg.nii.gz', >>> '/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale3_dseg.nii.gz', >>> '/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale4_dseg.nii.gz', >>> '/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale5_dseg.nii.gz'] >>> detrend.inputs.mode = 'quadratic' >>> detrend.run()
- in_filea filename or object implementing the os.PathLike interface
FMRI volume to detrend.
- gm_filea list of items which are a filename or object implementing the os.PathLike interface
ROI files registered to fMRI space.
- mode‘linear’ or ‘quadratic’ or ‘cubic’
Detrending order.
- out_filea filename or object implementing the os.PathLike interface
Detrended fMRI volume.
Discard_tp¶
Bases: nipype.interfaces.base.core.BaseInterface
Discards the n first time frame in functional MRI data.
Examples
>>> from cmtklib.functionalMRI import Discard_tp >>> discard = Discard_tp() >>> discard.inputs.base_dir = '/my_directory' >>> discard.inputs.in_file = '/path/to/sub-01_task-rest_desc-preproc_bold.nii.gz' >>> discard.inputs.n_discard = 5 >>> discard.run()
- in_filea filename or object implementing the os.PathLike interface
Input 4D fMRI image.
- n_discardan integer
Number of n first frames to discard.
- out_filea filename or object implementing the os.PathLike interface
Output 4D fMRI image with discarded frames.
Nuisance_regression¶
Bases: nipype.interfaces.base.core.BaseInterface
Regress out nuisance signals (WM, CSF, movements) through GLM.
Examples
>>> from cmtklib.functionalMRI import Nuisance_regression >>> nuisance = Nuisance_regression() >>> nuisance.inputs.base_dir = '/my_directory' >>> nuisance.inputs.in_file = '/path/to/sub-01_task-rest_desc-preproc_bold.nii.gz' >>> nuisance.inputs.wm_file = '/path/to/sub-01_task-rest_desc-preproc_bold.nii.gz' >>> nuisance.inputs.csf_file = '/path/to/sub-01_task-rest_desc-preproc_bold.nii.gz' >>> nuisance.inputs.motion_file = '/path/to/sub-01_motions.par' >>> nuisance.inputs.gm_file = ['/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale1_dseg.nii.gz', >>> '/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale2_dseg.nii.gz', >>> '/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale3_dseg.nii.gz', >>> '/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale4_dseg.nii.gz', >>> '/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale5_dseg.nii.gz'] >>> nuisance.inputs.global_nuisance = False >>> nuisance.inputs.csf_nuisance = True >>> nuisance.inputs.wm_nuisance = True >>> nuisance.inputs.motion_nuisance = True >>> nuisance.inputs.nuisance_motion_nb_reg = 36 >>> nuisance.inputs.n_discard = 5 >>> nuisance.run()
- brainfilea filename or object implementing the os.PathLike interface
Eroded brain mask registered to fMRI space.
- csf_filea filename or object implementing the os.PathLike interface
Eroded CSF mask registered to fMRI space.
- csf_nuisancea boolean
If
True
perform CSF nuisance regression.- global_nuisancea boolean
If
True
perform global nuisance regression.- gm_filea list of items which are a filename or object implementing the os.PathLike interface
GM atlas files registered to fMRI space.
- in_filea filename or object implementing the os.PathLike interface
Input fMRI volume.
- motion_filea filename or object implementing the os.PathLike interface
Motion nuisance effect.
- motion_nuisancea boolean
If
True
perform motion nuisance regression.- n_discardan integer
Number of volumes discarded from the fMRI sequence during preprocessing.
- nuisance_motion_nb_regan integer
Number of reg to use in motion nuisance regression.
- wm_filea filename or object implementing the os.PathLike interface
Eroded WM mask registered to fMRI space.
- wm_nuisancea boolean
If
True
perform WM nuisance regression.
- averageCSF_mata filename or object implementing the os.PathLike interface
Output matrix of CSF regression.
- averageCSF_npya filename or object implementing the os.PathLike interface
Output of CSF regression in
npy
format.- averageGlobal_mata filename or object implementing the os.PathLike interface
Output matrix of global regression.
- averageGlobal_npya filename or object implementing the os.PathLike interface
Output of global regression in
npy
format.- averageWM_mata filename or object implementing the os.PathLike interface
Output matrix of WM regression.
- averageWM_npya filename or object implementing the os.PathLike interface
Output of WM regression in
npy
format.- out_filea filename or object implementing the os.PathLike interface
Output fMRI Volume.
Scrubbing¶
Bases: nipype.interfaces.base.core.BaseInterface
Computes scrubbing parameters:
FD
andDVARS
.Examples
>>> from cmtklib.functionalMRI import Scrubbing >>> scrub = Scrubbing() >>> scrub.inputs.base_dir = '/my_directory' >>> scrub.inputs.in_file = '/path/to/sub-01_task-rest_desc-preproc_bold.nii.gz' >>> scrub.inputs.gm_file = ['/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale1_dseg.nii.gz', >>> '/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale2_dseg.nii.gz', >>> '/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale3_dseg.nii.gz', >>> '/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale4_dseg.nii.gz', >>> '/path/to/sub-01_space-meanBOLD_atlas-L2018_desc-scale5_dseg.nii.gz'] >>> scrub.inputs.wm_mask = '/path/to/sub-01_space-meanBOLD_label-WM_dseg.nii.gz' >>> scrub.inputs.gm_file = '/path/to/sub-01_space-meanBOLD_label-GM_dseg.nii.gz' >>> scrub.inputs.mode = 'quadratic' >>> scrub.run()
- in_filea filename or object implementing the os.PathLike interface
FMRI volume to scrubb.
- gm_filea list of items which are a filename or object implementing the os.PathLike interface
ROI volumes registered to fMRI space.
- motion_parametersa filename or object implementing the os.PathLike interface
Motion parameters from preprocessing stage.
- wm_maska filename or object implementing the os.PathLike interface
WM mask registered to fMRI space.
- dvars_mata filename or object implementing the os.PathLike interface
DVARS matrix for scrubbing.
- dvars_npya filename or object implementing the os.PathLike interface
DVARS in .npy format.
- fd_mata filename or object implementing the os.PathLike interface
FD matrix for scrubbing.
- fd_npya filename or object implementing the os.PathLike interface
FD in .npy format.