function amiraCTWriter(data,filename,dx,dy,dz,M,N,P,FOV,zFOV) fid = fopen([filename],'w'); fprintf(fid,'# AmiraMesh 3D BINARY 2.0\n\n'); fprintf(fid,['# CreationDate: ' datestr(now,'ddd mmm') datestr(now,' dd HH:MM:SS yyyy') '\n\n']); fprintf(fid,'define Lattice %g %g %g\n\n',M,N,P); fprintf(fid,'Parameters {\n'); fprintf(fid,' Content "%gx%gx%g %s, uniform coordinates",',M,N,P,'float'); fprintf(fid,' BoundingBox %g %g %g %g %g %g,\n',0,FOV-dx,0,FOV-dy,0,zFOV-dz); fprintf(fid,' CoordType "uniform"\n'); fprintf(fid,'}\n\n'); fprintf(fid,'Lattice { %s Data } @1\n\n','float'); fprintf(fid,'# Data section follows\n'); fprintf(fid,'@1\n'); fclose(fid); % close the text part of the file fid = fopen([filename],'ab','ieee-b'); fwrite(fid,data(:,:,:),'float'); fclose(fid);