Hi everyone,
I use nilearn.interfaces.fmriprep.load_confound
to scrub the points after fmriPrep preprocessing,however, whatever the FD threshold value
and std_dvars_threshold
value are set,it don’t change in the fourth dimension of fmri data.
Why does this happen?
my script:
import nilearn
from nilearn.image import clean_img
from nilearn.interfaces.fmriprep import load_confounds
import nibabel as nb
from nilearn.image import get_data
import numpy as np
from nilearn.maskers import NiftiMasker
from nilearn.datasets import load_mni152_brain_mask
img = "/mnt/sda1/fhao/fmriPrep/preprocessing_pipeline/drivatives/fmriprep/sub-042/func/sub-042_task-restingstate_space-MNI152NLin6Asym_res-2_desc-preproc_bold.nii.gz"
mask = "/mnt/sda1/fhao/fmriPrep/preprocessing_pipeline/drivatives/fmriprep/sub-042/func/sub-042_task-restingstate_space-MNI152NLin6Asym_res-2_desc-brain_mask.nii.gz"
img_data = get_data(img)
print(img_data.shape)
# mask_img = load_mni152_brain_mask(resolution=2)
# regress 36P
confounds,sample_mask =load_confounds(img, strategy=('motion', 'high_pass', 'wm_csf',"global_signal"),
motion='full', scrub=5, fd_threshold=0.5, std_dvars_threshold=1.5, wm_csf='full',
global_signal='full',demean=True)
#sample_data = get_data(sample_mask)
print(sample_mask)
masker = NiftiMasker(mask_img=mask, memory="nilearn_cache", memory_level=1)
regression_img = masker.fit_transform(img,sample_mask=sample_mask)
print(regression_img.shape)
terminal command result
(91, 109, 91, 120)
None
(120, 221655)
confounds,sample_mask =load_confounds(img, strategy=('motion', 'high_pass', 'wm_csf',"global_signal"),
motion='full', scrub=5, fd_threshold=0.001, std_dvars_threshold=0.1, wm_csf='full',
global_signal='full',demean=True)
(91, 109, 91, 120)
None
(120, 221655)
fmriprep command
fmriprep-docker $bids $bids/derivatives/fmriprep participant \
--participant_label sub-042 \
--output-spaces MNI152NLin6Asym \
--fs-license-file /mnt/sda1/Tian/Application/freesurfer/license.txt \
--fs-no-reconall \
--nthreads 40 \
--omp-nthreads 20 \
--clean-workdir \
-w ./work/