Hi i’m using denoise my fMRIprep data, it seems that masker.fit_transform
outputs a timeseries ndarray object. How can i write this ndarray object into a .nii.gz file?
from nilearn.maskers import NiftiMasker
from nilearn.interfaces.fmriprep import load_confounds
masker = NiftiMasker(standardize=True, low_pass=0.1, t_r=1.97)
conf, sample_mask= load_confounds("sub-1003_task-rest_space-MNI152NLin6Asym_desc-preproc_bold.nii.gz",strategy=("high_pass", "motion", "wm_csf","global_signal"), motion="full", wm_csf="full",global_signal="full")
time_series = masker.fit_transform("sub-1003_task-rest_space-MNI152NLin6Asym_desc-preproc_bold.nii.gz",confounds=conf)