Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use CompCor to get nuisance regressors for wm and csf #338

Open
carolin31 opened this issue Jan 26, 2021 · 4 comments
Open

How to use CompCor to get nuisance regressors for wm and csf #338

carolin31 opened this issue Jan 26, 2021 · 4 comments

Comments

@carolin31
Copy link

Hello,

I am analyzing a resting state data set. And I would like to use CompCor to obtain a file that includes 5 principal component regressors for the wm tissue and 5 principal components for csf. And I would like to use this file afterwards in afni for nuisance regression.
I have an EPI time series, and wm and ventricle masks (created based on Freesurfer segmentation) that I brought into EPI space using antsRegistration.

So far I have only used ants but I read on source forge that CompCor is not maintained in ants anymore and is moved to antsR. So I am trying to figure out how to use CompCor in antsR. I checked https://antsx.github.io/ANTsR/articles/RestingBOLD.html and https://antsx.github.io/ANTsR/reference/compcor.html but it is still not clear to me what CompCor in antsR exactly outputs. And how I make sure that it calculates the principal components for wm and then csf.

Can somebody help me with how to use CompCor to do what I described above?

I am grateful for any thoughts! That you very much in advance!
Carolin

@stnava
Copy link
Member

stnava commented Jan 26, 2021

here is pseudo code

csfmat = timeSeries2Matrix( boldImage,  csfMask )
csfcompcor = compcor( csfmat, 5 )
wmat = timeSeries2Matrix( boldImage,  wmMask )
wmcompcor = compcor( wmat, 5 )
joined = cbind( ... what's above ... )

then run regression for instance with the ilr function.

@carolin31
Copy link
Author

Hello Brian,

thank you very much for your response! The following question is, I am sure, a very stupid question but again I have never used antsR before. I installed everything according to the 'from command line' section. I installed only itkR and ANTsRCore and not the whole R package. And now I am wondering how I can start to use this code? I see that it says for usage: load the package: library (antsR). Do I have to type this into R studio meaning that I do need the R package? I stupidly typed it into my bash terminal and it was complaining about the brackets so I know that this is not the right way ;)

Is there any document that describes for beginners how to use antsR or do I just need to learn how to use R studio?

Thank you very much
Carolin

@muschellij2
Copy link
Collaborator

muschellij2 commented Jan 29, 2021 via email

@carolin31
Copy link
Author

Hello antsR experts!

I finally learnt some R and succeeded in running CompCor using antsR. Thank you John for the helpful links!
I have another question in regards to aCompCor.
Does it automatically remove linear trends from the data before estimating the principal components or is this something I need to do beforehand?

Thank you very much in advance
Carolin

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants