Home > fmri > fsl > save_avw.m

save_avw

PURPOSE ^

SAVE_AVW(img,fname,vtype,vsize)

SYNOPSIS ^

function save_avw(img,fname,vtype,vsize)

DESCRIPTION ^

 SAVE_AVW(img,fname,vtype,vsize) 

  Create and save an analyse header (.hdr) and image (.img) file
   for either a 2D or 3D or 4D array (automatically determined).
  fname is the filename (must be inside single quotes)
   
  vtype is 1 character: 'b'=unsigned byte, 's'=short, 'i'=int, 'f'=float
                        'd'=double or 'c'=complex
  vsize is a vector [x y z tr] containing the voxel sizes in mm and
  the tr in seconds  (defaults: [1 1 1 3])

  See also: READ_AVW

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function save_avw(img,fname,vtype,vsize)
0002 % SAVE_AVW(img,fname,vtype,vsize)
0003 %
0004 %  Create and save an analyse header (.hdr) and image (.img) file
0005 %   for either a 2D or 3D or 4D array (automatically determined).
0006 %  fname is the filename (must be inside single quotes)
0007 %
0008 %  vtype is 1 character: 'b'=unsigned byte, 's'=short, 'i'=int, 'f'=float
0009 %                        'd'=double or 'c'=complex
0010 %  vsize is a vector [x y z tr] containing the voxel sizes in mm and
0011 %  the tr in seconds  (defaults: [1 1 1 3])
0012 %
0013 %  See also: READ_AVW
0014 %
0015 
0016 %% Save a temp volume in Analyze format
0017 tmpname = tempname;
0018 
0019    if ((~isreal(img)) & (vtype~='c')),
0020      disp('WARNING:: Overwriting type - saving as complex');
0021      save_avw_complex(img,tmpname,vsize);
0022    else
0023      if (vtype=='c'),
0024        save_avw_complex(img,tmpname,vsize);
0025      else
0026        save_avw_hdr(img,tmpname,vtype,vsize);
0027        save_avw_img(img,tmpname,vtype);
0028      end
0029    end
0030          
0031 %% Convert volume from Analyze format to user's default
0032 tmp=sprintf('! $FSLDIR/bin/avwmaths %s %s\n',tmpname,fname);
0033 eval(tmp);
0034 
0035 tmp=sprintf('! /bin/rm %s.hdr %s.img \n',tmpname,tmpname);
0036 eval(tmp);
0037

Generated on Wed 20-Sep-2023 04:00:50 by m2html © 2003