Class PhotometricInterpreterFloat


  • public class PhotometricInterpreterFloat
    extends PhotometricInterpreter
    Implements a custom photometric interpreter that can be supplied by applications in order to render Java images from real-valued TIFF data products. Most TIFF files include a specification for a "photometric interpreter" that implements logic for transforming the raw data in a TIFF file to a rendered image. But the TIFF standard does not include a specification for a photometric interpreter that can be used for rendering floating-point data. TIFF files are sometimes used to specify non-image data as a floating-point raster. This approach is particularly common in GeoTIFF files (TIFF files that contain tags for supporting geospatial reference metadata for Geographic Information Systems). Because of the limits of the stock photometric interpreters, most floating-point TIFF files to not produce useful images.

    This class allows an Apache Commons implementation to construct and specify a custom photometric interpreter when reading from a TIFF file. Applications may supply their own palette that maps real-valued data to specified colors.

    This class provides two constructors:

    1. A simple constructor to support gray scales
    2. A constructor to support a color palette (with potential interpolation)

    To use this class, an application must access the TIFF file using the low-level, TIFF-specific API provided by the Apache Commons Imaging library.

    • Constructor Summary

      Constructors 
      Constructor Description
      PhotometricInterpreterFloat​(float valueBlack, float valueWhite)
      Constructs a photometric interpreter that will produce a gray scale linearly distributed across the RGB color space for values in the range valueBlack to valueWhite.
      PhotometricInterpreterFloat​(java.util.List<PaletteEntry> paletteEntries)
      Constructs a photometric interpreter that will use the specified palette to assign colors to floating-point values.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float getMaxFound()
      Gets the maximum value found while rendering the image
      int[] getMaxXY()
      Gets the coordinates (x,y) at which the maximum value was identified during processing
      float getMeanFound()
      Get the mean of the values found while processing
      float getMinFound()
      Gets the minimum value found while rendering the image
      int[] getMinXY()
      Gets the coordinates (x,y) at which the minimum value was identified during processing
      void interpretPixel​(ImageBuilder imageBuilder, int[] samples, int x, int y)  
      int mapValueToARGB​(float f)
      Provides a method for mapping a pixel value to an integer (ARGB) value.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • rangePaletteEntries

        java.util.ArrayList<PaletteEntry> rangePaletteEntries
      • singleValuePaletteEntries

        java.util.ArrayList<PaletteEntry> singleValuePaletteEntries
      • minFound

        float minFound
      • maxFound

        float maxFound
      • xMin

        int xMin
      • yMin

        int yMin
      • xMax

        int xMax
      • yMax

        int yMax
      • sumFound

        double sumFound
      • nFound

        int nFound
    • Constructor Detail

      • PhotometricInterpreterFloat

        public PhotometricInterpreterFloat​(float valueBlack,
                                           float valueWhite)
        Constructs a photometric interpreter that will produce a gray scale linearly distributed across the RGB color space for values in the range valueBlack to valueWhite. Note that the two values may be given in either ascending order or descending order, but they must not be equal. Infinite values will not result in proper numerical computations.
        Parameters:
        valueBlack - the value associated with the dark side of the gray scale
        valueWhite - the value associated with the light side of the gray scale
      • PhotometricInterpreterFloat

        public PhotometricInterpreterFloat​(java.util.List<PaletteEntry> paletteEntries)
        Constructs a photometric interpreter that will use the specified palette to assign colors to floating-point values.

        Although there is no prohibition against using palette entries with overlapping ranges, the behavior of such specifications is undefined and subject to change in the future. Therefore, it is not recommended. The exception in in the use of single-value palette entries which may be used to override the specifications for ranges.

        Parameters:
        paletteEntries - a valid, non-empty list of palette entries
    • Method Detail

      • getMinFound

        public float getMinFound()
        Gets the minimum value found while rendering the image
        Returns:
        if data was processed, a valid value; otherwise, Positive Infinity
      • getMaxXY

        public int[] getMaxXY()
        Gets the coordinates (x,y) at which the maximum value was identified during processing
        Returns:
        a valid array of length 2.
      • getMaxFound

        public float getMaxFound()
        Gets the maximum value found while rendering the image
        Returns:
        if data was processed, a valid value; otherwise, Negative Infinity
      • getMinXY

        public int[] getMinXY()
        Gets the coordinates (x,y) at which the minimum value was identified during processing
        Returns:
        a valid array of length 2.
      • getMeanFound

        public float getMeanFound()
        Get the mean of the values found while processing
        Returns:
        if data was processed, a valid mean value; otherwise, a zero.
      • mapValueToARGB

        public int mapValueToARGB​(float f)
        Provides a method for mapping a pixel value to an integer (ARGB) value. This method is not defined for the standard photometric interpreters and is provided as a convenience to applications that are processing data outside the standard TIFF image-reading modules.
        Parameters:
        f - the floating point value to be mapped to an ARGB value
        Returns:
        a valid ARGB value, or zero if no palette specification covers the input value.