processing-scripts > Nuisance signal regression and resting epochs
Showing 1-12 of 12 posts
Display:
Results per page:
Jun 8, 2010  04:06 PM | Lisa Eyler
Nuisance signal regression and resting epochs
Hi,

Your scripts continue to work well for me (I'm running a big batch of subjects as I write). The one part of the analysis pathway that it not crystal clear to me is the nuisance signal regression step. My problem is that I am an AFNI user and the main work of regressing out the nuisance variables is done using FSL programs. It appears that you are savvy in both AFNI and FSL, so I wondered why you preferred to use FSL for this part of the pathway? Would it work just as well to use 3dREMLfit in AFNI with the global.1D, csf.1D, wm.1D, and motion parameters as regressors and then write out the residuals?

My other question is whether you think that your pathway would also work for analysis of multiple resting epochs (20-30secs each) within the context of a task? Could one simply include a task-related EV in the model and proceed as usual otherwise? Or could one ignore the task epochs by using a -censor option within 3dREMLfit or 3dDeconvolve (don't know if a similar option exists for FSL)? I would appreciate your thoughts about this.

Lisa
Jun 13, 2010  08:06 PM | Xi-Nian Zuo
RE: Nuisance signal regression and resting epochs
Hey Lisa,

Regarding to the first question, my answer would be 'yes', it should work for the usage of 3dREMLfit or 3dDeconvolve. Actually, I tested for using the latter.

For the second question, the logic of regressing out task-related regressors should be the same for both AFNI and FSL. Please refer to the papers of investigating a similar question (Fair et al., 2008: A method for using blocked and event-related fMRI data to study "resting state" functional connectivity).

Best,
Xi-Nian
Jun 14, 2010  05:06 AM | Maarten Mennes
RE: Nuisance signal regression and resting ep
Hi Lisa,

to add to Xinian's answer, yes, it is a good idea to include your task variables when you regress out the other nuisance parameters (global, wm, csf).

Best,
Maarten
Jun 14, 2010  09:06 AM | Lisa Eyler
RE: Nuisance signal regression and resting ep
Great, thanks for the feedback! I have tested the following set of AFNI commands and it gives very similar, but not identical results to the FSL commands. One difference seems to be that there are more negative values of the residuals when using AFNI. I noticed that there is a variable called minVal that is passed to the FSL command. Could you explain what this is doing and say whether you think this might be causing the subtle difference in results?

Also, as you can see, I chose to use -polort 0, meaning that the baseline is not modeled and neither is the linear trend or any higher order polynomials. I did so because it seemed that these would already be accounted for in the other nuisance variables. Does this make sense and is it consistent with how the FSL command is set up?


## 6. Generate mat file (for use later)
echo "Running 3dDeconvolve to get matrix"
3dDeconvolve -input ${func_dir}/${rest}_pp.nii.gz -nfirst 0 -nlast 150 \
-mask ${func_dir}/${rest}_pp_mask.nii.gz \
-num_stimts 9 -polort 0 \
-stim_file 1 ${nuisance_dir}/mc1.1D \
-stim_file 2 ${nuisance_dir}/mc2.1D \
-stim_file 3 ${nuisance_dir}/mc3.1D \
-stim_file 4 ${nuisance_dir}/mc4.1D \
-stim_file 5 ${nuisance_dir}/mc5.1D \
-stim_file 6 ${nuisance_dir}/mc6.1D \
-stim_file 7 ${nuisance_dir}/global.1D \
-stim_file 8 ${nuisance_dir}/csf.1D \
-stim_file 9 ${nuisance_dir}/wm.1D \
-x1D ${nuisance_dir}/nuisance \
-x1D_stop


## 7. Get residuals
rm -fr ${nuisance_dir}/stats_afni
mkdir ${nuisance_dir}/stats_afni
echo "Running 3dREMLfit to get residuals"
3dREMLfit -input ${func_dir}/${rest}_pp.nii.gz \
-matrix ${nuisance_dir}/nuisance.xmat.1D \
-mask ${func_dir}/${rest}_pp_mask.nii.gz \
-Rerrts ${nuisance_dir}/stats_afni/res4d.nii.gz \
-GOFORIT



Thanks,
Lisa
Jun 16, 2010  01:06 AM | Clare Kelly
RE: Nuisance signal regression and resting ep
Hi Lisa,

Sorry for our delay in replying - we're all out of the lab at the moment after OHBM. I will return next week and will be able to deal with your question in more detail then.
I am not surprised that there are some differences between the results produced by the two programs but I can't say for sure what exactly the source of the differences is until I have a look at some data myself. Your commands look reasonable to me.
You're right about using polort 0 as linear and quadratic trends are removed during preprocessing.
Rather than looking at the residuals, I would have a look at some correlation maps generated using the two different residuals files - are these notably different?

I will try to get back to you as soon as I can!

Clare

Aug 8, 2011  09:08 PM | Zarrar Shehzad
RE: Nuisance signal regression and resting ep
I just saw this post while google searching something different...and thought I might chime in.

The minVal thing just specifies a threshold for the smallest positive value in the image. I don't think it should be cause for any difference between FSL and AFNI based scripts. The current FSL (film_gls) command used employs a -noest option wherein autocorrelations are not estimated so you might want to use the -Oerrts output option instead of -Rerrts. I don't know enough to explain why this was done with the FSL command. Also not sure about setting -polort 0.

Cheers
Zarrar
Nov 1, 2011  12:11 AM | cirong liu
RE: Nuisance signal regression and resting epochs
Does  -polort 0 mean using 1 phase linear regresssion for the x1?
Nov 1, 2011  06:11 AM | Maarten Mennes
RE: Nuisance signal regression and resting epochs
Hi Cirong,

yes, 3dDetrend -polort 0 means that you are removing any linear trend from the data.

Maarten
Aug 4, 2012  09:08 AM | veena nair
RE: Nuisance signal regression and resting ep
Hi all, thanks for this forum and all the helpful posts!
I was looking up afni commands to compute the nuisance matrix and residuals for doing resting fc-MRI and found this thread; just wondered if somebody had actually followed up on whether the 3dDeconvolve + 3dREMLfit steps shown below produce results similar to the ones produced using the nitrc script #5? Below are commands from my script:($file is the preprocessed resting func file, $cor is the type of correction with or w/out motion, wm/csf/glob etc); wonder if anyone has used something similar?

3dDeconvolve \
     -input $file+orig -polort 0 \
     -mask Mask.Brain.$file+orig \
     -num_stimts $n \
     -stim_file 1 $nuisance/dm.0.$MotionFile -stim_label 1 mot0    -stim_base 1 \
     -stim_file 2 $nuisance/dm.1.$MotionFile -stim_label 2 mot1    -stim_base 2 \
     -stim_file 3 $nuisance/dm.2.$MotionFile -stim_label 3 mot2    -stim_base 3 \
     -stim_file 4 $nuisance/dm.3.$MotionFile -stim_label 4 mot3    -stim_base 4 \
     -stim_file 5 $nuisance/dm.4.$MotionFile -stim_label 5 mot4    -stim_base 5 \
     -stim_file 6 $nuisance/dm.5.$MotionFile -stim_label 6 mot5    -stim_base 6 \
     -stim_file 7 $nuisance/ts.WM.$sid.rest.oxrtfsd.1D -stim_label 7 WM -stim_base 7 \
     -stim_file 8 $nuisance/ts.CSF.$sid.rest.oxrtfsd.1D -stim_label 8 CSF -stim_base 8 \
    # -stim_file 9 $nuisance/ts.global.$sid.rest.oxrtfsd.1D -stim_label 10 global -stim_base 9 \
     -x1D $nuisance/nuisance.$cor.$file \
     -x1D_stop

echo "Running 3dREMlfit to get residuals"
3dREMLfit -input $file+orig \
    -matrix $nuisance/nuisance.$cor.$file.xmat.1D \
    -mask Mask.Brain.$file+orig \
    -Rerrts $nuisance/res4d.$cor.nii.gz \
    -GOFORIT

echo "Demeaning residuals and adding 100"
3dTstat -mean -prefix $nuisance/res4d_mean.$cor.nii.gz $nuisance/res4d.$cor.nii.gz
3dcalc -a $nuisance/res4d.$cor.nii.gz -b $nuisance/res4d_mean.$cor.nii.gz -expr '(a-b)+100' -prefix $file.$cor.nii

echo "Resampling residuals to TLRC space"
@auto_tlrc -apar $sid.brain+tlrc -suffix res2std -input $file.$cor.nii

-thanks,
veena
Aug 8, 2012  05:08 AM | veena nair
RE: Nuisance signal regression- 3dDecon/3dREM
Hi, I was hoping somebody with expertise in afni and fsl could respond-
I tried running afni commands 3dDeconvolve and 3dREMLfit(shown below in previous post) to get nuisance matrix and get the residuals. Then I demean and add 100, similar to nitrc script #5. For the most part these work fine; however for some subjects and for certain rois, my output file from 3dREMLfit seems to have little or no data such that when using 3dROIstats to extract time-series, I get mostly values clustered around 100 (99.999 or 100.xx etc). I checked the rois and they lie within the brain and nothing looks weird.Not sure how to fix this.


Appreciate any thoughts/suggestions,

-thanks
Veena.



Originally posted by veena nair:
Hi all, thanks for this forum and all the helpful posts!
I was looking up afni commands to compute the nuisance matrix and residuals for doing resting fc-MRI and found this thread; just wondered if somebody had actually followed up on whether the 3dDeconvolve + 3dREMLfit steps shown below produce results similar to the ones produced using the nitrc script #5? Below are commands from my script:($file is the preprocessed resting func file, $cor is the type of correction with or w/out motion, wm/csf/glob etc); wonder if anyone has used something similar?

3dDeconvolve \
     -input $file+orig -polort 0 \
     -mask Mask.Brain.$file+orig \
     -num_stimts $n \
     -stim_file 1 $nuisance/dm.0.$MotionFile -stim_label 1 mot0    -stim_base 1 \
     -stim_file 2 $nuisance/dm.1.$MotionFile -stim_label 2 mot1    -stim_base 2 \
     -stim_file 3 $nuisance/dm.2.$MotionFile -stim_label 3 mot2    -stim_base 3 \
     -stim_file 4 $nuisance/dm.3.$MotionFile -stim_label 4 mot3    -stim_base 4 \
     -stim_file 5 $nuisance/dm.4.$MotionFile -stim_label 5 mot4    -stim_base 5 \
     -stim_file 6 $nuisance/dm.5.$MotionFile -stim_label 6 mot5    -stim_base 6 \
     -stim_file 7 $nuisance/ts.WM.$sid.rest.oxrtfsd.1D -stim_label 7 WM -stim_base 7 \
     -stim_file 8 $nuisance/ts.CSF.$sid.rest.oxrtfsd.1D -stim_label 8 CSF -stim_base 8 \
    # -stim_file 9 $nuisance/ts.global.$sid.rest.oxrtfsd.1D -stim_label 10 global -stim_base 9 \
     -x1D $nuisance/nuisance.$cor.$file \
     -x1D_stop

echo "Running 3dREMlfit to get residuals"
3dREMLfit -input $file+orig \
    -matrix $nuisance/nuisance.$cor.$file.xmat.1D \
    -mask Mask.Brain.$file+orig \
    -Rerrts $nuisance/res4d.$cor.nii.gz \
    -GOFORIT

echo "Demeaning residuals and adding 100"
3dTstat -mean -prefix $nuisance/res4d_mean.$cor.nii.gz $nuisance/res4d.$cor.nii.gz
3dcalc -a $nuisance/res4d.$cor.nii.gz -b $nuisance/res4d_mean.$cor.nii.gz -expr '(a-b)+100' -prefix $file.$cor.nii

echo "Resampling residuals to TLRC space"
@auto_tlrc -apar $sid.brain+tlrc -suffix res2std -input $file.$cor.nii

-thanks,
veena
Aug 8, 2012  12:08 PM | Maarten Mennes
RE: Nuisance signal regression- 3dDecon/3dREM
Hi Veena,

not sure if I can be of much help. How do the timeseries of those voxels look in the first place? Can you figure out where there timeseries starts to look weird? After 3dDeconvolve? After 3dREMlfit? 

Maybe you're better of asking your question directly on the AFNI message boards. http://afni.nimh.nih.gov/afni/community/board/

Best,
Maarten
Aug 8, 2012  03:08 PM | veena nair
RE: Nuisance signal regression- 3dDecon/3dREM
Hello Maarten

I ran about 82 subjects using a roilist with 6 seed regions = 492 time-series files and had issues with 29 files; after some trouble-shooting, the problem seems to have been with the file provided in -mask option in 3dDecon; changing that fixed the time-series files.

Thanks for responding!

Veena.