method saves matrix as image and returns spm_vol $Id$
0001 function v = do_write_image(o, fname) 0002 % method saves matrix as image and returns spm_vol 0003 % 0004 % $Id$ 0005 0006 v = mars_vol_utils('def_vol'); 0007 v.fname = fname; 0008 v.mat = o.mat; 0009 v.dim = size(o.dat); 0010 0011 if binarize(o) 0012 v = mars_vol_utils('set_type', v, 'uint8'); 0013 else 0014 v = mars_vol_utils('set_type', v, 'float'); 0015 end 0016 0017 v = spm_create_vol(v); 0018 v = spm_write_vol(v, o.dat);