Hi Mark,
>
> 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));
I think this is your problem. Let us say dim(2) is 5 (small image), then
this statement will create a 5-dimensional array with size 1x2x3x4x5,
which I suspect is not what you want. The statement
X = ones(1,V(1).dim(2)) on the other hand would create the vector
[1 1 1 1 1]
which I think is what you were after.
> Y=1:V(1).dim(2);
> Z=X;
> d=spm_sample_vol(V(1),X,Y,Z,0);
>
Good luck Jesper
|