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).
The values in a floating point image are 32-bit single precision float. The images are grayscale, and consequently, RasterImage.BitsPerPixel should be 32
and RasterImage.Order = RasterByteOrder.Gray.
A bitmap has floating point values if it has RasterImage.Float set to true.
To find out if a file has floating point pixels, call RasterCodecs.GetInformation and examine the CodecsImageInfo.IsFloat property.
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.
Note
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.
Help Collections
Raster .NET | C API | C++ Class Library | HTML5 JavaScript
Document .NET | C API | C++ Class Library | HTML5 JavaScript
Medical .NET | C API | C++ Class Library | HTML5 JavaScript
Medical Web Viewer .NET
Multimedia
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Supported Platforms
.NET, Java, Android, and iOS/macOS Assemblies
Imaging, Medical, and Document
C API/C++ Class Libraries
Imaging, Medical, and Document
HTML5 JavaScript Libraries
Imaging, Medical, and Document