MATLAB: How to write 32-bit floating point TIFs with NaNs

32-bitfloating pointimrotateimwritemultibandwritenantiftiff floating point

I'm able to use IMREAD to read 32-bit floating point TIFs with NaNs for dead pixels.
After this, I do an image rotation with IMTRANSFORM with 'FillValue' of NaN (IMROTATE only fills with zeros).
Now, I'd like to save 32-bit floating point TIFs with NaNs in tact for later.
How can I do this? I've tried IMWRITE and MULTIBANDWRITE, but they don't seem to work.
I'm using MATLAB 7.11.0 (R2010b).
Thanks,
Kevin Crosby

Best Answer

I suggest using the Tiff class and specifying RGB for the Photometric and specifying 32 bits per channel and writing single precision values.
This is based upon the assumption that you want the channel values themselves to be NaN, rather than setting the Alpha value to be NaN for the dead pixels.