Package mil.nga.tiff

Class Rasters


  • public class Rasters
    extends Object
    Raster image values
    Author:
    osbornb
    • Constructor Summary

      Constructors 
      Constructor Description
      Rasters​(int width, int height, int[] bitsPerSamples, int[] sampleFormats)
      Constructor Creates Rasters object where one bits per sample and sample format is provided for each sample
      Rasters​(int width, int height, int[] bitsPerSamples, int[] sampleFormats, ByteOrder order)
      Constructor Creates Rasters object where one bits per sample and sample format is provided for each sample
      Rasters​(int width, int height, int samplesPerPixel, int bitsPerSample, int sampleFormat)
      Constructor Creates Rasters object where given bits per sample and sample format is used for each sample
      Rasters​(int width, int height, int samplesPerPixel, int bitsPerSample, int sampleFormat, ByteOrder order)
      Constructor Creates Rasters object where given bits per sample and sample format is used for each sample
      Rasters​(int width, int height, int samplesPerPixel, FieldType fieldType)
      Constructor Creates Rasters object where given field type used for each sample.
      Rasters​(int width, int height, int samplesPerPixel, FieldType fieldType, ByteOrder order)
      Constructor Creates Rasters object where given field type used for each sample.
      Rasters​(int width, int height, FieldType[] fieldTypes)
      Constructor
      Rasters​(int width, int height, FieldType[] fieldTypes, ByteBuffer interleaveValues)
      Constructor
      Rasters​(int width, int height, FieldType[] fieldTypes, ByteBuffer[] sampleValues)
      Constructor
      Rasters​(int width, int height, FieldType[] fieldTypes, ByteBuffer[] sampleValues, ByteBuffer interleaveValues)
      Constructor
      Rasters​(int width, int height, FieldType[] fieldTypes, ByteOrder order)
      Constructor
    • Constructor Detail

      • Rasters

        public Rasters​(int width,
                       int height,
                       FieldType[] fieldTypes,
                       ByteBuffer[] sampleValues)
        Constructor
        Parameters:
        width - width of pixels
        height - height of pixels
        fieldTypes - field type for each sample
        sampleValues - empty sample values buffer array
        Since:
        2.0.0
      • Rasters

        public Rasters​(int width,
                       int height,
                       FieldType[] fieldTypes,
                       ByteBuffer interleaveValues)
        Constructor
        Parameters:
        width - width of pixels
        height - height of pixels
        fieldTypes - field type for each sample
        interleaveValues - empty interleaved values buffer
        Since:
        2.0.0
      • Rasters

        public Rasters​(int width,
                       int height,
                       FieldType[] fieldTypes,
                       ByteBuffer[] sampleValues,
                       ByteBuffer interleaveValues)
        Constructor
        Parameters:
        width - width of pixels
        height - height of pixels
        fieldTypes - Field type for each sample
        sampleValues - empty sample values buffer array
        interleaveValues - empty interleaved values buffer
        Since:
        2.0.0
      • Rasters

        public Rasters​(int width,
                       int height,
                       int samplesPerPixel,
                       FieldType fieldType)
        Constructor Creates Rasters object where given field type used for each sample.
        Parameters:
        width - width of pixels
        height - height of pixels
        samplesPerPixel - number of samples per pixel
        fieldType - type of field for each sample
        Since:
        2.0.0
      • Rasters

        public Rasters​(int width,
                       int height,
                       int samplesPerPixel,
                       FieldType fieldType,
                       ByteOrder order)
        Constructor Creates Rasters object where given field type used for each sample.
        Parameters:
        width - width of pixels
        height - height of pixels
        samplesPerPixel - number of samples per pixel
        fieldType - type of field for each sample
        order - byte order
        Since:
        2.0.0
      • Rasters

        public Rasters​(int width,
                       int height,
                       int[] bitsPerSamples,
                       int[] sampleFormats)
        Constructor Creates Rasters object where one bits per sample and sample format is provided for each sample
        Parameters:
        width - width of pixels
        height - height of pixels
        bitsPerSamples - bits per samples
        sampleFormats - sample formats
        Since:
        2.0.0
      • Rasters

        public Rasters​(int width,
                       int height,
                       int[] bitsPerSamples,
                       int[] sampleFormats,
                       ByteOrder order)
        Constructor Creates Rasters object where one bits per sample and sample format is provided for each sample
        Parameters:
        width - width of pixels
        height - height of pixels
        bitsPerSamples - bits per samples
        sampleFormats - sample formats
        order - byte order
        Since:
        2.0.0
      • Rasters

        public Rasters​(int width,
                       int height,
                       int samplesPerPixel,
                       int bitsPerSample,
                       int sampleFormat)
        Constructor Creates Rasters object where given bits per sample and sample format is used for each sample
        Parameters:
        width - width of pixels
        height - height of pixels
        samplesPerPixel - number of samples per pixel
        bitsPerSample - bits per each sample
        sampleFormat - format for each sample
        Since:
        2.0.0
      • Rasters

        public Rasters​(int width,
                       int height,
                       int samplesPerPixel,
                       int bitsPerSample,
                       int sampleFormat,
                       ByteOrder order)
        Constructor Creates Rasters object where given bits per sample and sample format is used for each sample
        Parameters:
        width - width of pixels
        height - height of pixels
        samplesPerPixel - number of samples per pixel
        bitsPerSample - bits per each sample
        sampleFormat - format for each sample
        order - byte order
        Since:
        2.0.0
      • Rasters

        public Rasters​(int width,
                       int height,
                       FieldType[] fieldTypes)
        Constructor
        Parameters:
        width - width of pixels
        height - height of pixels
        fieldTypes - field types per sample
        Since:
        2.0.0
      • Rasters

        public Rasters​(int width,
                       int height,
                       FieldType[] fieldTypes,
                       ByteOrder order)
        Constructor
        Parameters:
        width - width of pixels
        height - height of pixels
        fieldTypes - field types per sample
        order - byte order
        Since:
        2.0.0
    • Method Detail

      • hasSampleValues

        public boolean hasSampleValues()
        True if the results are stored by samples
        Returns:
        true if results exist
      • hasInterleaveValues

        public boolean hasInterleaveValues()
        True if the results are stored interleaved
        Returns:
        true if results exist
      • addToSample

        public void addToSample​(int sampleIndex,
                                int coordinate,
                                Number value)
        Add a value to the sample results
        Parameters:
        sampleIndex - sample index
        coordinate - coordinate location
        value - value
      • addToInterleave

        public void addToInterleave​(int sampleIndex,
                                    int coordinate,
                                    Number value)
        Add a value to the interleaved results
        Parameters:
        sampleIndex - sample index
        coordinate - coordinate location
        value - value
        Since:
        2.0.0
      • getWidth

        public int getWidth()
        Get the width of pixels
        Returns:
        width
      • getHeight

        public int getHeight()
        Get the height of pixels
        Returns:
        height
      • getNumPixels

        public int getNumPixels()
        Return the number of pixels
        Returns:
        number of pixels
      • getSamplesPerPixel

        public int getSamplesPerPixel()
        Get the number of samples per pixel
        Returns:
        samples per pixel
      • getBitsPerSample

        public List<Integer> getBitsPerSample()
        Get the bits per sample
        Returns:
        bits per sample
      • getSampleFormat

        public List<Integer> getSampleFormat()
        Returns list of sample types constants Returns list of sample types constants (SAMPLE_FORMAT_UNSIGNED_INT, SAMPLE_FORMAT_SIGNED_INT or SAMPLE_FORMAT_FLOAT) for each sample in sample list @see getFieldTypes(). @see TiffConstants
        Returns:
        list of sample type constants
        Since:
        2.0.0
      • getSampleValues

        public ByteBuffer[] getSampleValues()
        Get the results stored by samples
        Returns:
        sample values
        Since:
        2.0.0
      • setSampleValues

        public void setSampleValues​(ByteBuffer[] sampleValues)
        Set the results stored by samples
        Parameters:
        sampleValues - sample values
        Since:
        2.0.0
      • getInterleaveValues

        public ByteBuffer getInterleaveValues()
        Get the results stored as interleaved pixel samples
        Returns:
        interleaved values
        Since:
        2.0.0
      • setInterleaveValues

        public void setInterleaveValues​(ByteBuffer interleaveValues)
        Set the results stored as interleaved pixel samples
        Parameters:
        interleaveValues - interleaved values
        Since:
        2.0.0
      • getPixel

        public Number[] getPixel​(int x,
                                 int y)
        Get the pixel sample values
        Parameters:
        x - x coordinate (>= 0 && < getWidth())
        y - y coordinate (>= 0 && < getHeight())
        Returns:
        pixel sample values
      • setPixel

        public void setPixel​(int x,
                             int y,
                             Number[] values)
        Set the pixel sample values
        Parameters:
        x - x coordinate (>= 0 && < getWidth())
        y - y coordinate (>= 0 && < getHeight())
        values - pixel values
      • getPixelRow

        public byte[] getPixelRow​(int y,
                                  ByteOrder newOrder)
        Returns byte array of pixel row.
        Parameters:
        y - Row index
        newOrder - Desired byte order of result byte array
        Returns:
        Byte array of pixel row
        Since:
        2.0.0
      • getSampleRow

        public byte[] getSampleRow​(int y,
                                   int sample,
                                   ByteOrder newOrder)
        Returns byte array of sample row.
        Parameters:
        y - Row index
        sample - Sample index
        newOrder - Desired byte order of resulting byte array
        Returns:
        Byte array of sample row
        Since:
        2.0.0
      • getPixelSample

        public Number getPixelSample​(int sample,
                                     int x,
                                     int y)
        Get a pixel sample value
        Parameters:
        sample - sample index (>= 0 && < getSamplesPerPixel())
        x - x coordinate (>= 0 && < getWidth())
        y - y coordinate (>= 0 && < getHeight())
        Returns:
        pixel sample
      • setPixelSample

        public void setPixelSample​(int sample,
                                   int x,
                                   int y,
                                   Number value)
        Set a pixel sample value
        Parameters:
        sample - sample index (>= 0 && < getSamplesPerPixel())
        x - x coordinate (>= 0 && < getWidth())
        y - y coordinate (>= 0 && < getHeight())
        value - pixel value
      • getFirstPixelSample

        public Number getFirstPixelSample​(int x,
                                          int y)
        Get the first pixel sample value, useful for single sample pixels (grayscale)
        Parameters:
        x - x coordinate (>= 0 && < getWidth())
        y - y coordinate (>= 0 && < getHeight())
        Returns:
        first pixel sample
      • setFirstPixelSample

        public void setFirstPixelSample​(int x,
                                        int y,
                                        Number value)
        Set the first pixel sample value, useful for single sample pixels (grayscale)
        Parameters:
        x - x coordinate (>= 0 && < getWidth())
        y - y coordinate (>= 0 && < getHeight())
        value - pixel value
      • getSampleIndex

        public int getSampleIndex​(int x,
                                  int y)
        Get the sample index location
        Parameters:
        x - x coordinate
        y - y coordinate
        Returns:
        sample index
      • getInterleaveIndex

        public int getInterleaveIndex​(int x,
                                      int y)
        Get the interleave index location
        Parameters:
        x - x coordinate
        y - y coordinate
        Returns:
        interleave index
      • size

        public int size()
        Size in bytes of the image
        Returns:
        bytes
      • sizePixel

        public int sizePixel()
        Size in bytes of a pixel
        Returns:
        bytes
      • calculateRowsPerStrip

        public int calculateRowsPerStrip​(int planarConfiguration)
        Calculate the rows per strip to write
        Parameters:
        planarConfiguration - chunky or planar
        Returns:
        rows per strip
      • calculateRowsPerStrip

        public int calculateRowsPerStrip​(int planarConfiguration,
                                         int maxBytesPerStrip)
        Calculate the rows per strip to write
        Parameters:
        planarConfiguration - chunky or planar
        maxBytesPerStrip - attempted max bytes per strip
        Returns:
        rows per strip
      • getFieldTypes

        public FieldType[] getFieldTypes()
        Returns field types
        Returns:
        field types
        Since:
        2.0.0