We do this in matlab.  It is not necessary to loop, just use proper matrix 
math.  For example:

newdtseries = dtseries - (demean(regressor) * (pinv(demean(regressor)) * 
dtseries'))’;

Where demean(regressor) removes the mean of each regressor.

Matt.

From: 
<hcp-users-boun...@humanconnectome.org<mailto:hcp-users-boun...@humanconnectome.org>>
 on behalf of Leonardo Tozzi <lto...@stanford.edu<mailto:lto...@stanford.edu>>
Date: Thursday, January 24, 2019 at 2:04 PM
To: "hcp-users@humanconnectome.org<mailto:hcp-users@humanconnectome.org>" 
<hcp-users@humanconnectome.org<mailto:hcp-users@humanconnectome.org>>
Subject: [HCP-Users] Regress confounds out of CIFTIs

Dear Experts,

I have a text file of confound regressors that I would like to regress out of a 
resting state .dtseries.nii file and save the residuals of this procedure as a 
new .dtseries.nii file.
I was wondering if there is a computationally efficient way of doing this, 
possibly using the wb_command. Right now, the only thing I can think about is 
using matlab but it is obviously impractical to loop over the 90k greyordinates.
I have looked into the fsl_glm command, but it doesn’t take in CIFTIs, so I 
would have to then work on the NIFTI and transform it to CIFTI again, for 
example by rerunning the surface preprocessing step.
Would you have any suggestions?
Thank you,


Leonardo Tozzi, MD, PhD
Williams PanLab | Postdoctoral Fellow
Stanford University | 401 Quarry Rd
lto...@stanford.edu<mailto:lto...@stanford.edu> | (650) 5615738


_______________________________________________
HCP-Users mailing list
HCP-Users@humanconnectome.org<mailto:HCP-Users@humanconnectome.org>
http://lists.humanconnectome.org/mailman/listinfo/hcp-users

________________________________
The materials in this message are private and may contain Protected Healthcare 
Information or other information of a sensitive nature. If you are not the 
intended recipient, be advised that any unauthorized use, disclosure, copying 
or the taking of any action in reliance on the contents of this information is 
strictly prohibited. If you have received this email in error, please 
immediately notify the sender via telephone or return mail.

_______________________________________________
HCP-Users mailing list
HCP-Users@humanconnectome.org
http://lists.humanconnectome.org/mailman/listinfo/hcp-users

Reply via email to