-----Original Message-----
Here however, is where I would use spm_sample_vol, rather than
spm_slice_vol. As I said, I find the latter very confusing, so I'm
afraid you will have to rely on someone else on the list (e.g. John,
if he's around?) to help you with that
---------------------------
spm_slice_vol was originally written back in the days when MATLAB could
only handle a maximum of 2 dimensions (scalars, vectors and matrices).
The intention was to pull out a 2D array of data from an image volume -
in an arbitrary orientation.
img = spm_slice_vol(V,M,d,h);
is the same as:
[x,y,z] = ndgrid(1:d(1),1:d(2),1);
x1 = M(1,1)*x + M(1,2)*y + M(1,3)*z + M*(1,4);
y1 = M(2,1)*x + M(2,2)*y + M(2,3)*z + M*(2,4);
z1 = M(3,1)*x + M(3,2)*y + M(3,3)*z + M*(3,4);
img = spm_sample_vol(V,x1,y1,z1,h);
Best regards,
-John
|