MATLAB: Reading in a 32bit tif

32bitgreyscaleimage processingpicturetiftiff

Hi there,
I am trying to read in a 32bit tif image that was taken with a x ray detector. The dynamic range on this detector is huge and it saves the pixels with intensities from 0 all the way up to 11,000,000 hence the 32 bits required. The image won't display with a normal image viewing software and will appear totally black as the vast majority of pixels have low values. But if you would like to see the picture I've uploaded it here http://www.2shared.com/photo/c_ElAUtM/fix.html
What I would like to do it read in the file to an array, do a little value changing and save it again as a 32 bit tif.
So far I've got this but I get a few errors when I run it from command prompt .
any help would be very much appreciated , thanks
imgdata = imread('fix.tif');
t = Tiff('myfile9.tif','w');
tagstruct.ImageLength = size(imgdata,1)
tagstruct.ImageWidth = size(imgdata,2)
tagstruct.Photometric = Tiff.Photometric.LinearRaw
tagstruct.BitsPerSample = 32
%tagstruct.SamplesPerPixel = 1
%tagstruct.RowsPerStrip = 16
tagstruct.PlanarConfiguration = Tiff.PlanarConfiguration.Chunky
tagstruct.Software = 'MATLAB'
t.setTag(tagstruct)
t.write(imgdata);
t.close();
imagesc(imread('myfile9.tif'));

Best Answer

The SampleFormat for your existing TIFF is signed integer. The tiff class is erroring out because you set the SampleFormat to UInt instead. Try settting it to Tiff.SampleFormat.Int instead.