[img, dims,scales,bpp,endian] = READ_AVW_COMPLEX(fname) Read in a complex analyse file into either a 3D or 4D array (depending on the header information) Uses avwcomplex to make temporary files for reading Ouput coordinates are in MEDx convention except that all dimensions start at 1 rather than 0 Note: automatically detects char, short, long or double formats Extracts the 4 dimensions (dims), 4 scales (scales) and bytes per pixel (bpp) for voxels contained in the Analyse header file (fname) Also returns endian = 'l' for little-endian or 'b' for big-endian See also: READ_AVW_HDR, READ_AVW_IMG, SAVE_AVW, SAVE_AVW_HDR, SAVE_AVW_IMG, SAVE_AVW_COMPLEX
0001 function [img,dims,scales,bpp,endian] = read_avw_complex(fname) 0002 % [img, dims,scales,bpp,endian] = READ_AVW_COMPLEX(fname) 0003 % 0004 % Read in a complex analyse file into either a 3D or 4D 0005 % array (depending on the header information) 0006 % Uses avwcomplex to make temporary files for reading 0007 % Ouput coordinates are in MEDx convention 0008 % except that all dimensions start at 1 rather than 0 0009 % Note: automatically detects char, short, long or double formats 0010 % Extracts the 4 dimensions (dims), 0011 % 4 scales (scales) and bytes per pixel (bpp) for voxels 0012 % contained in the Analyse header file (fname) 0013 % Also returns endian = 'l' for little-endian or 'b' for big-endian 0014 % 0015 % See also: READ_AVW_HDR, READ_AVW_IMG, SAVE_AVW, SAVE_AVW_HDR, 0016 % SAVE_AVW_IMG, SAVE_AVW_COMPLEX 0017 % 0018 0019 command=sprintf('! avwcomplex -realcartesian %s %s %s \n',fname,[fname,'R'],[fname,'I']); 0020 eval(command); 0021 0022 [imgr,dims,scales,bpp,endian]=read_avw([fname,'R']); 0023 [imgi,dims,scales,bpp,endian]=read_avw([fname,'I']); 0024 0025 img = imgr + j * imgi; 0026 0027 command=sprintf('! rm %s.hdr %s.img %s.hdr %s.img \n',[fname,'R'],[fname,'R'],[fname,'I'],[fname,'I']); 0028 eval(command);