function writeimg(filename,img)

mi=min(img(:));
mx=max(img(:));
writeraw(filename,fix((img'-mi)/(mx-mi)*255));
