Class TiffRasterData


  • public class TiffRasterData
    extends java.lang.Object
    Provides a simple container for floating-point data. Some TIFF files are used to store floating-point data rather than images. This class is intended to support access to those TIFF files.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      private float[] data  
      private int height  
      private int width  
    • Constructor Summary

      Constructors 
      Constructor Description
      TiffRasterData​(int width, int height)
      Construct an instance allocating memory for the specified dimensions.
      TiffRasterData​(int width, int height, float[] data)
      Construct an instance allocating memory for the specified dimensions.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      float[] getData()
      Returns a reference to the data array stored in this instance.
      int getHeight()
      Gets the height (number of rows) of the raster.
      TiffRasterStatistics getSimpleStatistics()
      Tabulates simple statistics for the raster and returns an instance containing general metadata.
      TiffRasterStatistics getSimpleStatistics​(float valueToExclude)
      Tabulates simple statistics for the raster excluding the specified value and returns an instance containing general metadata.
      float getValue​(int x, int y)
      Gets the value stored at the specified raster coordinates.
      int getWidth()
      Gets the width (number of columns) of the raster.
      void setValue​(int x, int y, float value)
      Sets the value stored at the specified raster coordinates.
      • Methods inherited from class java.lang.Object

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

      • width

        private final int width
      • height

        private final int height
      • data

        private final float[] data
    • Constructor Detail

      • TiffRasterData

        public TiffRasterData​(int width,
                              int height)
        Construct an instance allocating memory for the specified dimensions.
        Parameters:
        width - a value of 1 or greater
        height - a value of 1 or greater
      • TiffRasterData

        public TiffRasterData​(int width,
                              int height,
                              float[] data)
        Construct an instance allocating memory for the specified dimensions.
        Parameters:
        width - a value of 1 or greater
        height - a value of 1 or greater
        data - the data to be stored in the raster.
    • Method Detail

      • setValue

        public void setValue​(int x,
                             int y,
                             float value)
        Sets the value stored at the specified raster coordinates.
        Parameters:
        x - integer coordinate in the columnar direction
        y - integer coordinate in the row direction
        value - the value to be stored at the specified location; potentially a Float.NaN.
      • getValue

        public float getValue​(int x,
                              int y)
        Gets the value stored at the specified raster coordinates.
        Parameters:
        x - integer coordinate in the columnar direction
        y - integer coordinate in the row direction
        Returns:
        the value stored at the specified location; potentially a Float.NaN.
      • getSimpleStatistics

        public TiffRasterStatistics getSimpleStatistics()
        Tabulates simple statistics for the raster and returns an instance containing general metadata.
        Returns:
        a valid instance containing a safe copy of the current simple statistics for the raster.
      • getSimpleStatistics

        public TiffRasterStatistics getSimpleStatistics​(float valueToExclude)
        Tabulates simple statistics for the raster excluding the specified value and returns an instance containing general metadata.
        Parameters:
        valueToExclude - exclude samples with this specified value.
        Returns:
        a valid instance.
      • getWidth

        public int getWidth()
        Gets the width (number of columns) of the raster.
        Returns:
        the width of the raster
      • getHeight

        public int getHeight()
        Gets the height (number of rows) of the raster.
        Returns:
        the height of the raster.
      • getData

        public float[] getData()
        Returns a reference to the data array stored in this instance. Note that value is not a safe copy and that modifying it would directly affect the content of the instance. While this design approach carries some risk in terms of data security, it was chosen for reasons of performance and memory conservation. TIFF images that contain floating-point data are often quite large. Sizes of 100 million raster cells are common. Making a redundant copy of such a large in-memory object might exceed the resources available to a Java application.
        Returns:
        a direct reference to the data array stored in this instance.