Dear Romain,
Hi ! Remember me - we used to work together at Imperial College.
Hope all is well.
spm_slice_vol is used to get a 2D slice/plane of data from a 3D image eg.
img = spm_slice_vol(V,C,DIM,0);
where V is a volume and DIM are its dimensions.
% To figure out the appropriate C matrix to use in spm_slice_vol
% use the fact that
%
% [x,y,z,1]' = C [a,b,0,1]
%
% where [a,b] define coordinates in your plane of interest.
% A voxel in the volume v=[x,y,z,1]' which corresponds to
% a pixel in this slice is then
% a linear combination of [a,b]. For example, to
% get a transverse slice the z-value is always fixed at p.
% So the 3rd row of C is [0 0 1 p].
See the attached .m files for example usage (these get transverse,
coronal and saggital slices - it is possible though to get
any slice orientation using spm_slice_vol).
But i'm not sure whether its slices you are after.
Is it that you want to resample the whole image at a lower
spatial resolution ? If this is the case then you could use
the image processing toolbox function 'imresize' (though this
only works on 2D data, so you'd have to call it twice).
I'm actually no expert in these matters so others may know better ....
Look forward to meeting up again sometime (are you going to HBM this year ?)
With very best wishes,
Will.
rvalabre wrote:
> Hello
>
> I would like to get from a 3D volume (256,256,124) the mean slices corresponding to
> the
> functional resolution (64*64*10).
>
> I trie to use spm_slice_vol but I don(t know if it's possible.
> Any way I get some problem to understand what does spm_slice_vol exactly does
>
> if Vol is the structure given by spm_vol for the anatomic volume
>
> if M = 1 0 0 0
> 0 1 0 0
> 0 0 1 30
> 0 0 0 1
>
> slice = spm_slice_vol(Vol,M,[256 256,0)
> gives me the slice 30. That's ok.
>
> if M = 4 0 0 0
> 0 4 0 0
> 0 0 1 30
> 0 0 0 1
>
> spm_slice_vol(Vol,M,[64 64],0)
> gives me something which loocks likes the anatomical images with a 64*64 resolution
>
> But it is sligthly different from the 64*64 matrix obtain from the 256*256 matrix
> where I do a 4*4 block mean . Why ?
>
> (I used a function from image toolbox s = blkproc(slice,[4 4],'mean(x(:))'); )
>
> if M = 1 0 0 0
> 0 1 0 0
> 0 0 5 30
> 0 0 0 1
>
> slice = spm_slice_vol(Vol,M,[256 256,0)
> gives me exactly the slice 30
>
> Is it normal ?
>
> Thank you very much for your help
>
> Romain
--
William D. Penny
Wellcome Department of Cognitive Neurology
University College London
12 Queen Square
London WC1N 3BG
Tel: 020 7833 7478
FAX: 020 7813 1420
Email: [log in to unmask]
URL: http://www.fil.ion.ucl.ac.uk/~wpenny/
|