The data is actually loaded from the file on-the-fly, and accessed by either
spm_sample_vol or spm_slice_vol. I'll explain how to use spm_sample_vol:
% Create a handle to the image volume.
V = spm_vol('filename.img');
% Define which voxels you want to get at. e.g., plane 20...
[x,y] = ndgrid(1:V.dim(1),1:V.dim(2));
z = ones(size(x))*20;
% sample the data...
data = spm_sample_vol(V,x,y,z,0);
The same could be done with spm_slice_vol by:
M = spm_matrix([0 0 20]);
data = spm_slice_vol(V,M,V.dim(1:2),0);
For more help, you can type:
help spm_sample_vol
help spm_slice_vol
help spm_vol
Best regards,
-John
On Tuesday 01 May 2001 17:25, A Sayeed wrote:
> How can I gain access to the volume data stored in SPM when
> image data is loaded from a file and displayed. ?
> ie the matrix which holds all the intensity values for each
> pixels.
>
>
> I'm using Analyse format data, of PET scans.
>
> Many thanks.
>
> Ab
--
Dr John Ashburner.
Wellcome Department of Cognitive Neurology.
12 Queen Square, London WC1N 3BG, UK.
tel: +44 (0)20 78337491 or +44 (0)20 78373611 x4381
fax: +44 (0)20 78131420
http://www.fil.ion.ucl.ac.uk/~john
mail: [log in to unmask]
|