Print

Print


Dear Mark,

The easiest way is to use spm_read_vols (I love that routine). It
determines the size of the image by itself so you don't have to provide
a sampling grid.
If you use d=spm_read_vols(V(i)) you can extract the voxels you need
from the 3D array d. If you do d4=spm_read_vols(V) you get a 4D array
with all the images (the 4th dimension being the image index).

Regards,
Alle Meije Wink

On Tue, 2005-01-04 at 10:24 +0000, Mark Daglish wrote:
> Dear Experts,
>
> I am trying to update a program which used to use spm_sample_vol from
> SPM96 to use the SPM2 equivalent routine.  I am getting the error "Bad
> Image Dimensions" from spm_sample_vol and can't see where I'm going
> wrong.  The following will illustrate what I am doing:
>
> I='dynamic PET image name';
> for i=1:num_frames
>     P(i)=strcat(I,',',num2str(i));
> end;
> V=spm_vol(P);
> % therefore V = 18x1 struct array created with spm_vol from an 18 frame
> dynamic PET image
> X=ones(1:V(1).dim(2));
> Y=1:V(1).dim(2);
> Z=X;
> d=spm_sample_vol(V(1),X,Y,Z,0);
>
> Can anyone else spot the obvious mistake?
>
> Many thanks for any help.
>
> Mark
>
> --
> ===============================
> Dr. Mark Daglish
> Clinical Lecturer in Psychiatry
> Psychopharmacology Unit
> University of Bristol
> UK
> ===============================