> how to flip image in changing left and right hemisphere while my mapping is
> suceeded?
> because i want to group data between different dominant hands.
The following piece of code may do what you want. I haven't tested it, so
there may be bugs....
V=spm_vol(spm_get(Inf,'*.img'));
for i=1:length(V),
VI = V(i);
VO = VI;
[pth,nm,xt,vr] = fileparts(deblank(VO.fname));
VO.fname = fullfile(pth,['flipped_' nm xt vr]);
VO.descrip = [VO.descrip ' - flipped'];
VO = spm_create_image(VO);
for j=1:VI.dim(3),
M = spm_matrix([0 0 j]);
img = spm_slice_vol(VI,M,VI.dim(1:2),0);
img = flipud(img);
VO = spm_write_plane(VO,img,j);
end;
end;
Best regards,
-John
--
Dr John Ashburner.
Wellcome Department of Cognitive Neurology.
12 Queen Square, London WC1N 3BG, UK.
tel: +44 (0)20 78337491 or +44 (0)20 78373611 x4381
fax: +44 (0)20 78131420
http://www.fil.ion.ucl.ac.uk/~john
mail: [log in to unmask]
|