Performing confound regression with NiPype or Nilearn

I have preprocessed fMRI files using NiPype workflow and now intend to perform confound regression on them. I know FMRIPrep does it for you and gives an easy-to-handle confound.tsv. I wonder how to manually perform confound regression using NiPype or Nilearn.

I tried using nipype.algorithms.confounds module but they give only a text file. I want it in the format of FMRIPrep so that I could use it to compute functional connectomes.

Hello,

fMRIPrep does not perform confound regression, but does provide the confounds as you mention.

Look at this tutorial which demonstrates how to use Nilearn to extract fMRIPrep confounds and denoise data.

Best,
Steven