Images with floating point pixel values, usually GeoTIFF or TIFF, store float pixel values as 32-bit single precision float. LEADTOOLS supports loading and creating bitmaps with floating point pixel values.
They can be converted to grayscale integer for access to all the other LEADTOOLS functionality. However, this conversion causes the floating point data to be rescaled to a range between 0 and the value for white of the target bits per pixel (255 for 8-bit, 65535 for 16-bit, etc).
A bitmap has floating point values if it has RasterImage.Float set to true.
Load or create a bitmap with floating point values as follows:
To load a file which contains floating point pixel data, set the CodecsLoadOptions.NoImageDataConversion = true prior to loading the file.
To create a file which contains floating point pixel data, set RasterImage.Float flag to true after creating it, and RasterImage.BitsPerPixel = RasterByteOrder.Gray. After that, fill the bitmap data using RasterImage.SetRow, or RasterImage.SetRowColumn.
/* This sample code creates a floating point image */
using (RasterImage image = RasterImage.Create(200, 100, 32, 150, new RasterColor(0, 0, 0)))
image.Order = RasterByteOrder.Gray;
image.Float = true;
/* Set the image data and do something with this image */
The following formats support bitmap floating point data to load and save:
The supported operations below are guaranteed to work as specified. Besides those, other operations might work or fail and may return an error code or produce incorrect results.
The convertion of floating points to integer has side effects that need to be carefully considered before applying the operation.
- This operation will convert and rescale the floating point values to unsigned integers.
- The floating point values are rescaled so the maximum value for the bitmap is converted to white, the minimum values to black and the others to grayscale values. The maximum value will be converted to: 0xFF (8-bit bitmaps), 0xFFF (12-bit bitmaps), 0xFFFF (16-bit bitmaps), 0xFFFFFFFF (32-bit bitmaps).
For an example, refer to CodecsLoadOptions.NoImageDataConversion.
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries