V=spm_vol('mybetafile.nii');
[Data,XYZ]=spm_read_vols(V);
Then 'XYZ' is an 3xN matrix holding the MNI space coordinates of all N
voxels in your image (i.e. beta values), as stored in the 3D tensor
'Data', when you concatenate them in one big row.
When for example the i-th column in XYZ is the MNI coordinate you are
interested in, you can get the associated beta value as follows:
Dc=Data(:);
beta=Dc(i);
double check the code, I didn't test this code right now.
There are other ways such as spm_sample_vol, read the associated help
text for the correct syntax. Be warned that that function involves
interpolation, the above code does not.
NaN's are not numbers so you can safely ignore them when you are
interested in numbers.
Good luck,
Bas
On 04/05/2012 08:24 AM, Ce Mo wrote:
> Dear all,
>
> I want to extract the individual voxel-wise beta values within a pre-defined ROI, let's say a sphere centered at some point (x0,y0,z0). I understand that Marsbar is able to extract the ROI-mean beta value (I assume the avearge of all the betas in that particular region) but I want to obtain the voxel-wise betas of that region.
>
> The first thought is to read the beta.img and get whatever I want but the problem is that I cannot find the correspondence between the MNI coordinates and the matrix subscripts. Besides, the beta matrix contains NaNs (Not a number) I do not know how to interprete.
>
> So my questions are as follows:
>
> 1) How can I obtain the voxel-wise betas in a pre-defined ROI?
> 2) Can I regard the NaNs simple as zeros?
>
> Any comments and advice will be greatly appreciated.
>
> Many thanks and best regards,
> Ce
>
>
>
>
--
--------------------------------------------------
Dr. S.F.W. Neggers
Division of Brain Research
Rudolf Magnus Institute for Neuroscience
Utrecht University Medical Center
Visiting : Heidelberglaan 100, 3584 CX Utrecht
Room B.01.1.03
Mail : Huispost B01.206, P.O. Box 85500
3508 GA Utrecht, the Netherlands
Tel : +31 (0)88 7559609
Fax : +31 (0)88 7555443
E-mail : [log in to unmask]
Web : http://www.neuromri.nl/people/bas-neggers
: http://www.brainsciencetools.com (CEO)
--------------------------------------------------
------------------------------------------------------------------------------
De informatie opgenomen in dit bericht kan vertrouwelijk zijn en is
uitsluitend bestemd voor de geadresseerde. Indien u dit bericht onterecht
ontvangt, wordt u verzocht de inhoud niet te gebruiken en de afzender direct
te informeren door het bericht te retourneren. Het Universitair Medisch
Centrum Utrecht is een publiekrechtelijke rechtspersoon in de zin van de W.H.W.
(Wet Hoger Onderwijs en Wetenschappelijk Onderzoek) en staat geregistreerd bij
de Kamer van Koophandel voor Midden-Nederland onder nr. 30244197.
Denk s.v.p aan het milieu voor u deze e-mail afdrukt.
------------------------------------------------------------------------------
This message may contain confidential information and is intended exclusively
for the addressee. If you receive this message unintentionally, please do not
use the contents but notify the sender immediately by return e-mail. University
Medical Center Utrecht is a legal person by public law and is registered at
the Chamber of Commerce for Midden-Nederland under no. 30244197.
Please consider the environment before printing this e-mail.
|