I’ve attached a wrapper that I use for extracting data (Atlas_ROI_extraction). Here are some brief instructions:

(1) Download the mrtools package: http://mrtools.mgh.harvard.edu/index.php/Downloads

(2) Download the attached files, add them and the mrtools to the MATLAB path

(3) Atlas_ROI_extraction(files,atlasfile,filetosaveextracteddata.mat)

(3a) files —> the following code can create the files variable:
    files=dir_wfp(['filestoextract’])

(3b) atlasfile —> this is the atlas file with ROIs labelled (e.g. aal_MNI_V4.img)

(4) Look at the data (e.g filetosaveextracteddata.mat):
D.(seedregion).ts —> time series from all voxels
D.(seedregion).tsm —> meant time series across voxels

Where seed region is Region_1, Region_2, etc.

If you want to use the significant clusters from your own data or portions of an atlas label, then you'll need to create your own image with each ROI labeled with a different value. New new image file can be used instead of the Atlas image. 


Best Regards, Donald McLaren
=================
D.G. McLaren, Ph.D.
Research Fellow, Department of Neurology, Massachusetts General Hospital and
Harvard Medical School
Postdoctoral Research Fellow, GRECC, Bedford VA
Website: http://www.martinos.org/~mclaren
Office: (773) 406-2464
=====================
This e-mail contains CONFIDENTIAL INFORMATION which may contain PROTECTED
HEALTHCARE INFORMATION and may also be LEGALLY PRIVILEGED and which is
intended only for the use of the individual or entity named above. If the
reader of the e-mail is not the intended recipient or the employee or agent
responsible for delivering it to the intended recipient, you are hereby
notified that you are in possession of confidential and privileged
information. Any unauthorized use, disclosure, copying or the taking of any
action in reliance on the contents of this information is strictly
prohibited and may be unlawful. If you have received this e-mail
unintentionally, please immediately notify the sender via telephone at (773)
406-2464 or email.


On Fri, May 2, 2014 at 12:27 PM, David Hofmann <[log in to unmask]> wrote:
ah ok..I understand, found a script which maps between spaces in an older thread. Now I only need to find the coordinates within an area of high probability in Anatomy Toolbox, but I will ask this seperately. Thanks for the help :) 

greetings

David


2014-05-01 17:03 GMT+02:00 Watson, Christopher <[log in to unmask]>:

That's right, the array index can't be negative. To convert from MNI to voxel index, I think you can use spm_get_coords, or something like that.
________________________________________
From: SPM (Statistical Parametric Mapping) [[log in to unmask]] on behalf of David Hofmann [[log in to unmask]]
Sent: Thursday, May 01, 2014 6:34 AM
To: [log in to unmask]
Subject: Re: [SPM] Extracting timecourse for every volume

Hey,

thanks for the help, still getting used to SPM. I used the script on the normalized data and could extract the timecourse.

But I'm a little confused now, because when I choose a MNI-coordinate say -12 -36 48 I get an error message, because I can't select negative entries from the vols-matrix. I assumed I can just select the MNI-coordinates from an ROI, but it seems not to be the case? If not, how to find a coordinate in your example corresponding to a specific MNI-coordinate? Maybe I didn't understand you correctly :-/.

With Anatomy Toolbox for example I want to select the timecourses for some coordinates with high probabilities within a ROI .

hope it is clear, why I'm confused..or I just don't get it right now ;)

greetings

David



2014-04-30 17:23 GMT+02:00 Marko Wilke <[log in to unmask]<mailto:[log in to unmask]>>:
Hello David,


I'm trying to extract the mean timecourse (or the voxel timecourse
respectively) of an ROI of the Anatomy Toolbox from a dataset for every
volume of the dataset. In this case, I'm using the MoAE Dataset from
your website. What I essentially want is a mean value for every volume
of the data for some ROIs which I chose from the Anatomy Toolbox or any
other ROI for that matter. Up to now I only managed to extract the
timecourses of significant clusters after calculating the GLM. What I
essentially want is the timecourses of ROIs/clusters no matter if they
are significant or not.

what you want is easily accomplished using spm functionality, using functions such as spm_select, spm_vol, and spm_read_vols, in that order. This will, if you select all images in a time series, give you a 4D matrix where time is the fourth dimension (note that this will only proceed without errors if the images you select are in voxelwise alignment, i.e., untouched, resliced, or normalized). You can then get the timecourse from any voxel you are interested in (say, the one at voxel location 30/30/30) by selecting it from the matrix:

vols = spm_read_vols(spm_vol(spm_select(Inf, 'image', 'Select time series images')));
vx = [30 30 30];
tc = squeeze(vols(vx(1), vx(2), vx(3), :));
figure; plot(tc);

You can then generalize that to search over a specific region you are interested in. For easy determination of voxel coordinates, I recommend findn from the Mathworks file exchange. One thing to keep in mind, though, is that this will be a little bit less easy if your ROI has different dimensions than your fMRI data.


I hope you can help me out :)

I hope so, too :)

Cheers,
Marko


PS: Beware of the fact that what spm provides via the interface is not necessarily the mean, but may be the first eigenvariate. See the list archives for some more details.

--
____________________________________________________
PD Dr. med. Marko Wilke
 Facharzt für Kinder- und Jugendmedizin
 Leiter, Experimentelle Pädiatrische Neurobildgebung
 Universitäts-Kinderklinik
 Abt. III (Neuropädiatrie)

Marko Wilke, MD, PhD
 Pediatrician
 Head, Experimental Pediatric Neuroimaging
 University Children's Hospital
 Dept. III (Pediatric Neurology)

Hoppe-Seyler-Str. 1
 D - 72076 Tübingen, Germany
 Tel. +49 7071 29-83416<tel:%2B49%207071%2029-83416>
 Fax  +49 7071 29-5473<tel:%2B49%207071%2029-5473>
 [log in to unmask]<mailto:[log in to unmask]>

 http://www.medizin.uni-tuebingen.de/kinder/epn/
____________________________________________________