Home > phiwave > @phiw_wvimg > write_wtimg.m

write_wtimg

PURPOSE ^

saves wvimg object as .img / .mat combination

SYNOPSIS ^

function [obj, wvol] = write_wtimg(obj, fname)

DESCRIPTION ^

 saves wvimg object as .img / .mat combination
 
 Input
 obj         - wvimg object
 fname       - output filename
 
 Output
 obj         - returned object
 wvol        - output vol struct

 $Id: write_wtimg.m,v 1.3 2005/06/05 04:42:22 matthewbrett Exp $

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [obj, wvol] = write_wtimg(obj, fname)
0002 % saves wvimg object as .img / .mat combination
0003 %
0004 % Input
0005 % obj         - wvimg object
0006 % fname       - output filename
0007 %
0008 % Output
0009 % obj         - returned object
0010 % wvol        - output vol struct
0011 %
0012 % $Id: write_wtimg.m,v 1.3 2005/06/05 04:42:22 matthewbrett Exp $
0013 
0014 if nargin < 2
0015   fname = [];
0016 end
0017 
0018 if isstruct(fname),fname = fname.fname;end
0019 if isempty(fname), fname = wvfname(obj);end
0020 
0021 % set up wvvol
0022 obj = doproc(obj);
0023 dim = size(obj.img);
0024 dim(4) = spm_type(obj.options.datatype);
0025 obj.wvol.dim = dim;
0026 obj.wvol.fname = fname;
0027 obj.wvol = mars_struct('fillafromb', obj.wvol,obj.ovol);
0028 obj.wvol.descrip = obj.descrip;
0029 
0030 % save (might have to do something about complex images here)
0031 obj.wvol = spm_write_vol(obj.wvol, obj.img);
0032 
0033 % set changef
0034 obj.changef = 0;
0035 
0036 % dump matrix data and write object information
0037 putwave(obj.wvol, thin(obj));
0038 
0039 wvol = obj.wvol;

Generated on Wed 06-Jul-2005 18:07:21 by m2html © 2003