%
%	function im2osirix(im,fname)
%
%	Function writes the image as signed 16-bit little-endian
%	integers to a file for import by Osirix.
%

function im2osirix(im,fname)

immax = max(abs(im(:)));
if (immax > 32766)
	disp('Warning, data > 32766');
end;

fip = fopen(fname,'w','l');	% Open file, little-endian.
fwrite(fip,floor(abs(im(:))),'int16');
fclose(fip);


