Home > bioelectromagnetism > avw_converter_script.m

avw_converter_script

PURPOSE ^

avw_converter_script - convert byte order of .img files

SYNOPSIS ^

This is a script file.

DESCRIPTION ^

 avw_converter_script - convert byte order of .img files

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 % avw_converter_script - convert byte order of .img files
0002 
0003 % This function will convert byte order of Analyze files
0004 % This example uses SPM example data, so
0005 % cd to that data directory before calling this script
0006 
0007 stat = mkdir(pwd,'tmp');
0008 if stat,
0009     files = {'T1' 'T2'}; % list of file prefixes
0010     Ibyte = 'ieee-be';
0011     Obyte = 'ieee-le';
0012     Iorient = []; % auto determine orientation
0013     Oorient = 0;  % output axial unflipped
0014     for f = 1:length(files),
0015         avw = avw_img_read(files{f},Iorient,Ibyte);
0016         % create new file in tmp subdirectory
0017         newfile = [pwd filesep 'tmp' filesep files{f}];
0018         % to write out header and image...
0019         avw_img_write(avw,newfile,Oorient,Obyte);
0020         % to write image only...
0021         % avw.hdr = [];
0022         % avw_img_write(avw,newfile,Oorient,Obyte);
0023         % to write header only, see avw_hdr_write
0024     end
0025 end

Generated on Mon 15-Aug-2005 15:36:19 by m2html © 2003