PUMI.pipelines.func package
Subpackages
PUMI.pipelines.func.compcor module
- PUMI.pipelines.func.compcor.anat_noise_roi(wf, **kwargs)[source]
Creates an anatomical noise ROI for use with compcor. Inputs are awaited from the (BBR-based) func2anat registration and are already transformed to functional space.
CAUTION: Name in the old PUMI was create_anat_noise_roi_workflow
- Inputs:
wm_mask (str): Path to white matter mask ventricle_mask (str): Path to ventricle mask
- Outputs:
out_file (str): Path to noise ROI
Sinking:
- Acknowledgements
Adapted from Tamas Spisak (2018)
- PUMI.pipelines.func.compcor.compcor(wf, volume='first', **kwargs)[source]
Component based noise reduction method (Behzadi et al.,2007): Regressing out principal components from noise ROIs. Here the aCompCor is used.
- Parameters:
volume (str) – Select which volume of the functional image should be used for the quality check image(s). Can be either ‘first’, ‘middle’, ‘last’, ‘mean’ or an arbitrary number
- Inputs:
func_aligned (str): Reoriented and realigned functional image mask_files (str): Mask files which determine ROI(s)
- Outputs:
out_file (str): Path to text file containing the noise components
- Sinking:
Text file containing the noise components
Mask files which determine ROI(s)
- Acknowledgements:
Adapted from Balint Kincses (2018)
- PUMI.pipelines.func.compcor.compcor_qc(wf, volume='first', **kwargs)[source]
Save quality check images for mcflirt motion-correction
- Parameters
- volume (str): Select which volume of the functional image should be used.
Can be either ‘first’, ‘middle’, ‘last’, ‘mean’ or an arbitrary number
- Inputs
func_aligned (str): Reoriented and realigned functional image mask_file (str): Mask files which determine ROI(s)
Outputs:
- Sinking
compcor qc image
PUMI.pipelines.func.concat module
PUMI.pipelines.func.data_censorer module
- PUMI.pipelines.func.data_censorer.datacens_workflow_threshold(wf, ex_before=1, ex_after=2, **kwargs)[source]
Do the data censoring on the 4D functional data. First, it calculates the framewise displacement according to Power’s method. Second, it indexes the volumes which FD is in the upper part in percent (determined by the threshold variable which is 5% by default). Thirdly, it excludes those volumes and one volume before and 2 volumes after the indexed volume. The workflow returns a 4D scrubbed functional data.
CAUTION: Name in the old PUMI was datacens_workflow_threshold
Parameters:
- Inputs:
func (str): The reoriented,motion occrected, nuissance removed and bandpass filtered functional file. FD (str): the frame wise displacement calculated by the MotionCorrecter.py script threshold (str): threshold of FD volumes which should be excluded
- Outputs:
scrubbed_image (str) FD_scrubbed (str)
- Sinking
- Acknowledgements:
Adapted from Balint Kincses (2018).
Modified version of CPAC.scrubbing.scrubbing (https://github.com/FCP-INDI/C-PAC/blob/main/CPAC/scrubbing/scrubbing.py), CPAC.generate_motion_statistics.generate_motion_statistics (https://github.com/FCP-INDI/C-PAC/blob/main/CPAC/generate_motion_statistics/generate_motion_statistics.py), CPAC.func_preproc.func_preproc (https://github.com/FCP-INDI/C-PAC/blob/main/CPAC/func_preproc/func_preproc.py)
- [1] Power, J. D., Barnes, K. A., Snyder, A. Z., Schlaggar, B. L., & Petersen, S. E. (2012). Spurious
but systematic correlations in functional connectivity MRI networks arise from subject motion. NeuroImage, 59(3), 2142-2154. doi:10.1016/j.neuroimage.2011.10.018
- [2] Power, J. D., Barnes, K. A., Snyder, A. Z., Schlaggar, B. L., & Petersen, S. E. (2012). Steps
toward optimizing motion artifact removal in functional connectivity MRI; a reply to Carp. NeuroImage. doi:10.1016/j.neuroimage.2012.03.017
- [3] Jenkinson, M., Bannister, P., Brady, M., Smith, S., 2002. Improved optimization for the robust
and accurate linear registration and motion correction of brain images. Neuroimage 17, 825-841.
PUMI.pipelines.func.deconfound module
- PUMI.pipelines.func.deconfound.despiking_afni(wf, **kwargs)[source]
Removes ‘spikes’ from functional 3d+time images.
- Inputs:
in_file (str): Path to the 4d image.
- Outputs:
out_file (str): 4d Image with spikes removed.
- Sinking:
The output image
- PUMI.pipelines.func.deconfound.motion_correction_mcflirt(wf, reference_vol='middle', FD_mode='Power', **kwargs)[source]
Use FSL MCFLIRT to do the motion correction of the 4D functional data and use the 6df rigid body motion parameters to calculate friston24 parameters for later nuissance regression step.
- Parameters:
reference_vol (str) – Either “first”, “middle”, “last”, “mean”, or the index of the volume which the rigid body registration (motion correction) will use as reference. Default is ‘middle’.
FD_mode – Either “Power” or “Jenkinson”
- Inputs:
in_file (str): Reoriented functional file
- Outputs:
func_out_file (str): Path to motion-corrected timeseries mat_file (str): Path to motion-correction transformation matrices mc_par_file (str): Path to file with motion parameters friston24_file (str): Path to file with friston24 parameters FD_file (str): Path to file with FD
- Sinking:
motion-corrected timeseries
motion-correction transformation matrices
absolute and relative displacement parameters
friston24 parameters
FD
FDmax
quality check images (FD/rotations/translations and timeseries plot)
- Acknowledgements:
Adapted from Balint Kincses (2018)
Modified version of PAC.func_preproc.func_preproc (https://github.com/FCP-INDI/C-PAC/blob/main/CPAC/func_preproc/func_preproc.py) and CPAC.generate_motion_statistics.generate_motion_statistics (https://github.com/FCP-INDI/C-PAC/blob/main/CPAC/generate_motion_statistics/generate_motion_statistics.py)
- PUMI.pipelines.func.deconfound.nuisance_removal(wf, **kwargs)[source]
Perform nuisance removal.
CAUTION: Name in the old PUMI was nuissremov_workflow
Parameters:
- Inputs:
in_file (str): Path to reoriented motion corrected functional data. design_file (str): Path to matrix which contains all the nuissance regressors (motion + compcor noise + …).
- Outputs:
Path to the filtered data
- Sinking:
Filtered data
- Acknowledgements:
Adapted from Balint Kincses (2018)
- PUMI.pipelines.func.deconfound.qc(wf)[source]
Creates carpet plot after dispiking.
- Inputs:
in_file (str): Path to dispiked 4d image.
- Outputs:
out_file (Axes): Matplotlib Axes to be used in composite figures.
- Sinking:
Carpet plot as png image.
PUMI.pipelines.func.func_proc module
- PUMI.pipelines.func.func_proc.func_proc_despike_afni(wf, stdrefvol='middle', fwhm=0, carpet_plot='', **kwargs)[source]
Performs processing of functional (resting-state) images: Images should be already reoriented, e.g. with fsl fslreorient2std (see scripts/ex_pipeline.py) Workflow inputs:
- param func:
The functional image file.
Tamas Spisak tamas.spisak@uk-essen.de 2018
PUMI.pipelines.func.temporal_filtering module
- PUMI.pipelines.func.temporal_filtering.qc_temporal_filtering(wf, **kwargs)[source]
Create quality check images for temporal filtering.
- Inputs:
in_file (str): Temporal filtered data (e. g. result of afni 3dBandpass)
- Outputs:
out_file (str): Path to quality check image
Sinking: - quality check image
- PUMI.pipelines.func.temporal_filtering.temporal_filtering(wf, **kwargs)[source]
Creates a slice time corrected functional image.
- Inputs:
func (str): The reoriented functional file. highpass (str): The highpass filter in Hz (e. g. 0.008) lowpass (str): The lowpass filter in Hz (e. g. 0.08)
- Outputs:
out_file (str): Temporal filtered data
- Acknowledgements:
Adapted from Balint Kincses (2018) Modified version of porcupine generated temporal filtering code.