Class PhotometricInterpreterFloat
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:
- A simple constructor to support gray scales
- 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.
-
Field Summary
Fields inherited from class org.apache.commons.imaging.formats.tiff.photometricinterpreters.AbstractPhotometricInterpreter
height, predictor, samplesPerPixel, width
-
Constructor Summary
ConstructorsConstructorDescriptionPhotometricInterpreterFloat
(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
(List<PaletteEntry> paletteEntries) Constructs a photometric interpreter that will use the specified palette to assign colors to floating-point values. -
Method Summary
Modifier and TypeMethodDescriptionfloat
Gets the maximum value found while rendering the imageint[]
getMaxXY()
Gets the coordinates (x,y) at which the maximum value was identified during processingfloat
Gets the mean of the values found while processingfloat
Gets the minimum value found while rendering the imageint[]
getMinXY()
Gets the coordinates (x,y) at which the minimum value was identified during processingvoid
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 org.apache.commons.imaging.formats.tiff.photometricinterpreters.AbstractPhotometricInterpreter
getBitsPerSample
-
Constructor Details
-
PhotometricInterpreterFloat
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 scalevalueWhite
- the value associated with the light side of the gray scale
-
PhotometricInterpreterFloat
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 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 Details
-
getMaxFound
Gets the maximum value found while rendering the image- Returns:
- if data was processed, a valid value; otherwise, Negative Infinity
-
getMaxXY
Gets the coordinates (x,y) at which the maximum value was identified during processing- Returns:
- a valid array of length 2.
-
getMeanFound
Gets the mean of the values found while processing- Returns:
- if data was processed, a valid mean value; otherwise, a zero.
-
getMinFound
Gets the minimum value found while rendering the image- Returns:
- if data was processed, a valid value; otherwise, Positive Infinity
-
getMinXY
Gets the coordinates (x,y) at which the minimum value was identified during processing- Returns:
- a valid array of length 2.
-
interpretPixel
public void interpretPixel(ImageBuilder imageBuilder, int[] samples, int x, int y) throws ImagingException, IOException - Specified by:
interpretPixel
in classAbstractPhotometricInterpreter
- Throws:
ImagingException
IOException
-
mapValueToArgb
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.
-