cmtklib.functionalMRI module

Module that defines CMTK Nipype interfaces for the Functional MRI pipeline.

Detrending

Link to code

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 string or os.PathLike object referring to an existing file

FMRI volume to detrend.

gm_filea list of items which are a string or os.PathLike object referring to an existing file

ROI files registered to fMRI space.

mode‘linear’ or ‘quadratic’ or ‘cubic’

Detrending order.

out_filea string or os.PathLike object referring to an existing file

Detrended fMRI volume.

DiscardTP

Link to code

Bases: nipype.interfaces.base.core.BaseInterface

Discards the n first time frame in functional MRI data.

Examples

>>> from cmtklib.functionalMRI import DiscardTP
>>> discard = DiscardTP()
>>> 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 string or os.PathLike object referring to an existing file

Input 4D fMRI image.

n_discardan integer

Number of n first frames to discard.

out_filea string or os.PathLike object referring to an existing file

Output 4D fMRI image with discarded frames.

NuisanceRegression

Link to code

Bases: nipype.interfaces.base.core.BaseInterface

Regress out nuisance signals (WM, CSF, movements) through GLM.

Examples

>>> from cmtklib.functionalMRI import NuisanceRegression
>>> nuisance = NuisanceRegression()
>>> 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 string or os.PathLike object

Eroded brain mask registered to fMRI space.

csf_filea string or os.PathLike object

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 string or os.PathLike object

GM atlas files registered to fMRI space.

in_filea string or os.PathLike object referring to an existing file

Input fMRI volume.

motion_filea string or os.PathLike object

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 string or os.PathLike object

Eroded WM mask registered to fMRI space.

wm_nuisancea boolean

If True perform WM nuisance regression.

averageCSF_mata string or os.PathLike object

Output matrix of CSF regression.

averageCSF_npya string or os.PathLike object

Output of CSF regression in npy format.

averageGlobal_mata string or os.PathLike object

Output matrix of global regression.

averageGlobal_npya string or os.PathLike object

Output of global regression in npy format.

averageWM_mata string or os.PathLike object

Output matrix of WM regression.

averageWM_npya string or os.PathLike object

Output of WM regression in npy format.

out_filea string or os.PathLike object referring to an existing file

Output fMRI Volume.

Scrubbing

Link to code

Bases: nipype.interfaces.base.core.BaseInterface

Computes scrubbing parameters: FD and DVARS.

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 string or os.PathLike object referring to an existing file

FMRI volume to scrubb.

gm_filea list of items which are a string or os.PathLike object referring to an existing file

ROI volumes registered to fMRI space.

motion_parametersa string or os.PathLike object referring to an existing file

Motion parameters from preprocessing stage.

wm_maska string or os.PathLike object referring to an existing file

WM mask registered to fMRI space.

dvars_mata string or os.PathLike object referring to an existing file

DVARS matrix for scrubbing.

dvars_npya string or os.PathLike object referring to an existing file

DVARS in .npy format.

fd_mata string or os.PathLike object referring to an existing file

FD matrix for scrubbing.

fd_npya string or os.PathLike object referring to an existing file

FD in .npy format.