Nuisance Regression OUTPUT

Hi,
I applied nuisance regression to my dataset (see code)

fsl_glm -i "{rest_output_dir}/fMRI_coreg.nii.gz" \
             -d "{rest_output_dir}/fMRI_realigned.par" \
             -o "{rest_output_dir}/fMRI_nuisance_regressed.nii.gz" \
             --out_res="{rest_output_dir}/fMRI_nuisance_residuals.nii.gz" \
             --demean

This is how my input look like:

However, the residuals obtained look very different from the original input data:

Is this expected output, or could it indicate an issue with my regression model? I’d appreciate any insights or suggestions !

Hii @stebo85

SORRY for interrupting you
Please, since you have an idea about my pipeline, could you please see if the output residual (cleaned data) looks correct? Also, the file size is 4GB—is that normal?

THANK YOU SOO MUCH !

Hi @Oumayma, your output has been de-meaned - you may want to use fsl_regfilt instead, as it is essentially a version of fsl_glm which is customised for nuisance regression, and will handle de-/re-meaning for you.

1 Like

Thank you so much @paulmccarthy
it was solved using fsl_regfilt. However, I encountered the same issue with the Band-Pass Filtering (0.008–0.1 Hz)( TR= 2), output.
This is the command I used:

!fslmaths "{rest_output_dir}/fMRI_nuisance_regressed.nii.gz" \
         -bptf 31.25 2.5 \
         "{rest_output_dir}/fMRI_bandpass.nii.gz" \

am I using it incorrectly?

The image’s statistics:

!fslstats "{rest_output_dir}/fMRI_nuisance_regressed.nii.gz" -R -m -s
!fslstats "{rest_output_dir}/fMRI_bandpass.nii.gz" -R -m -s

Output:

-13.133170 2058.899658 77.846829 208.480478 
-170.027344 221.632034 -0.000578 1.390407 

Hi @Oumayma, yes the -bptf option will cause the data to be de-meaned. You will need to add it back in, e.g. run fslmaths <image> -Tmean mean.nii.gz before-hand, then run fslmaths <image> -bptf 31.25 2.5 -add mean.nii.gz <out>

1 Like

Hi @paulmccarthy

yes i added the mean too, thank u so much :pray:

# ------------------------------------------------------------------------------
    # Step 9: Band-Pass Filtering (0.008–0.1 Hz)
    # ------------------------------------------------------------------------------
    #TR=1.7s

    if os.path.exists(f"{rest_output_dir}/fMRI_nuisance_regressed.nii.gz"):
        print("Running band-pass filtering...")
        !fslmaths "{rest_output_dir}/fMRI_nuisance_regressed.nii.gz" -Tmean "{rest_output_dir}/fMRI_mean.nii.gz"
        !fslmaths "{rest_output_dir}/fMRI_nuisance_regressed.nii.gz" -bptf 9.37 0.94 -add "{rest_output_dir}/fMRI_mean.nii.gz" "{rest_output_dir}/fMRI_bandpass.nii.gz" -odt float
    else:
        print(" ERROR: Required files for band-pass filtering missing.")