Print

Print


Here's some alternate code which will give you the exact match as defined
by SPM. That is, if you input those MNI coordinates in SPM results, this
will find the data matrix coordinates. it requires you to load am SPMx
file. If you want voxels whuich are not significant, just use a threshold
of 0.99999 uncorrected when generating the xSPM file, and it will give you
pretty much all the voxels in the brain.

Also note that the x,y, and z coordinates in MNI space need to be once
which actually exist in SPM's coordinate system. If you have a 2x2x2
resamples space, then you jsut need to make the voxels an even number,
using code like: "if mod(x,2)==1; x=x+1; end".

function [X Y Z] = translate_spm_mni_coordinates(x,y,z, xSPM)

f = find(xSPM.XYZmm(1,:) == x);
f2 = find(xSPM.XYZmm(2,f) == y);
f3 = find(xSPM.XYZmm(3,f(f2)) == z);

coords = xSPM.XYZ(:,f(f2(f3)));

X = coords(1);
Y = coords(2);
Z = coords(3);



On 2 May 2014 12:27, David Hofmann <[log in to unmask]> wrote:

> ah ok..I understand, found a script which maps between spaces in an older
> thread <https://www.jiscmail.ac.uk/cgi-bin/webadmin?A2=spm;83affe5a.0905>.
> 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/
>> ____________________________________________________
>>
>
>