Dear SPM users,
I am using the 'spm_read_vols' function to extract time-series information for my fMRI data but I keep getting certain errors and I'm not sure what I need to do.
I have preprocessed my data, ran a group ICA on it, applied a specific mask to look at a specific region of interest, and now I'm trying to extract the time series of the voxels left after the mask. I do this on SPM using the following commands:
imgs=spm_select(Inf, 'image', 'get timeseries data');
V=spm_vol(imgs);
[Y,XYZ]=spm_read_vols(V);
I understand that the XYZ coordinates is the coordinates corresponding to that voxel and the Y is supposed to be my time series. However, after running this code. I do get my XYZ coordinates. But, when I try to open my Y variable, it gives me the error of " Cannot display summaries of variables with more than 524288 elements".
So then I run the code,
index=sub2ind(size(Y(:,:,:,1)),Xvox,Yvox,Zvox);
This should give me the column number in the ‘Y’ matrix where the time-series is present for the specified coordinate (Xvox,Yvox,Zvox). When I applied my mask on the SPM toolbox, I know which voxels have crossed my threshold. So I use that specific coordinate. Thus, I use that coordinate to get my index. For example, 2.0,6.0,52.0. This gives me an index of 383152. Then I extract that specific column by
A = Y(:,[383152]);
And it gives me the error of " Index exceeds matrix dimensions". So I'm not sure what exactly I'm doing wrong and how I should go about to extract the time series.
Thank you in advance,
Shubhi
|