The crashing is definately undesirable behaviour. Which version of Matlab are
you using? Matlab Version 7.0.1.24704 (R14) Service Pack 1 crashes out in
Linux with an "Aborted" message when it tries to give an error message from
one of SPMs mex files. In Version 7.1.0.183 (R14) Service Pack 3, it behaves
much better. I never fully figured out the reasons for this (See
http://www.fil.ion.ucl.ac.uk/~john/FAQ/Matlab7.html - which is now a little
out of date).
Your usage appears to be OK (apart from some square brackets missing from the
matrix - and the use of spm_get instead of spm_select if you are using SPM5).
The matrix is essentially a mapping from a pixels in the slice you want to
create, to voxels in the volume you want to sample. The corresponding
locations in the volume is obtained via:
A(1:3,)*[i,j,0,1]'
where i and j are the indices of the image to be created. The i goes from 1
to dim(1), and j goes from 1 to dim(2).
For example, if
A = [1 0 0 0
0 1 0 0
0 0 1 10
0 0 0 1]
then the new coordinates are given by [i,j,10]'
i.e. [1*i + 0*j + 0*0 + 0
0*i + 1*j + 0*0 + 0
0*i + 0*j + 0*0 +10]
Best regards,
-John
> I tried to use spm_slice_vol to read just one slice of SPGR image, but
> cann't quite understand the usage and format of this function. The SPGR is
> 256*256*120, and I tried to read the 10th slice (z = 10).
>
> What I typed:
> V = spm_vol(spm_get);
> A = 1 0 0 0;
> 0 1 0 0;
> 0 0 1 10;
> 0 0 0 1;
> dim = [256 256];
> hold = 0;
> X = spm_slice_vol(V,A,dim,hold);
>
> However, not only spm but matlab abnormally exited. (I tried on two mac
> machine and one linux, the same destiny!)
>
> And I don't know how to design the transformation matrix. For example, I
> want to get the N th slice of the image, what should A be?
>
> Thanks a million to anybody who can help me out!
|