Class SingleBandedSampleModel


  • public class SingleBandedSampleModel
    extends javax.media.jai.ComponentSampleModelJAI
    This class represents image data which is composed of a single band so that (a pixel comprises a single sample and occupies one data element of the DataBuffer). It subclasses ComponentSampleModelJAI but provides a more efficent implementation for accessing pixel interleaved image data than is provided by ComponentSampleModelJAI. This class stores sample data in a single bank of the DataBuffer. Accessor methods are provided so that image data can be manipulated directly. This class supports TYPE_BYTE, TYPE_USHORT, TYPE_SHORT, TYPE_INT, TYPE_FLOAT and TYPE_DOUBLE datatypes.
    • Constructor Detail

      • SingleBandedSampleModel

        public SingleBandedSampleModel​(int dataType,
                                       int w,
                                       int h)
        Constructs a SingleBandSampleModel with the specified parameters. The number of bands will be given by the length of the bandOffsets array.
        Parameters:
        dataType - The data type for storing samples.
        w - The width (in pixels) of the region of image data described.
        h - The height (in pixels) of the region of image data described.
        Throws:
        IllegalArgumentException - if w or h is not greater than 0 or if dataType is not one of the supported data types
    • Method Detail

      • createCompatibleSampleModel

        public SampleModel createCompatibleSampleModel​(int w,
                                                       int h)
        Creates a new SingleBandSampleModel with the specified width and height. The new SingleBandSampleModel will have the same storage data type as this SingleBandSampleModel.
        Overrides:
        createCompatibleSampleModel in class javax.media.jai.ComponentSampleModelJAI
        Parameters:
        w - the width of the resulting SampleModel
        h - the height of the resulting SampleModel
        Returns:
        a new SampleModel with the specified width and height.
        Throws:
        IllegalArgumentException - if w or h is not greater than 0
      • createSubsetSampleModel

        public SampleModel createSubsetSampleModel​(int[] bands)
        Overrides:
        createSubsetSampleModel in class javax.media.jai.ComponentSampleModelJAI
        Parameters:
        bands - Ignored.
        Returns:
        a new org.esa.snap.jai.SingleBandSampleModel.
      • getDataElements

        public Object getDataElements​(int x,
                                      int y,
                                      int w,
                                      int h,
                                      Object obj,
                                      DataBuffer data)
        Overrides:
        getDataElements in class javax.media.jai.ComponentSampleModelJAI
      • setDataElements

        public void setDataElements​(int x,
                                    int y,
                                    int w,
                                    int h,
                                    Object obj,
                                    DataBuffer data)
        Overrides:
        setDataElements in class javax.media.jai.ComponentSampleModelJAI
      • getPixels

        public float[] getPixels​(int x,
                                 int y,
                                 int w,
                                 int h,
                                 float[] array,
                                 DataBuffer data)
        Overrides:
        getPixels in class SampleModel
      • getPixels

        public double[] getPixels​(int x,
                                  int y,
                                  int w,
                                  int h,
                                  double[] array,
                                  DataBuffer data)
        Overrides:
        getPixels in class javax.media.jai.ComponentSampleModelJAI
      • getSamples

        public float[] getSamples​(int x,
                                  int y,
                                  int w,
                                  int h,
                                  int b,
                                  float[] array,
                                  DataBuffer data)
        Overrides:
        getSamples in class SampleModel
      • getSamples

        public double[] getSamples​(int x,
                                   int y,
                                   int w,
                                   int h,
                                   int b,
                                   double[] array,
                                   DataBuffer data)
        Overrides:
        getSamples in class SampleModel
      • setSamples

        public void setSamples​(int x,
                               int y,
                               int w,
                               int h,
                               int b,
                               float[] array,
                               DataBuffer data)
        Overrides:
        setSamples in class SampleModel
      • setSamples

        public void setSamples​(int x,
                               int y,
                               int w,
                               int h,
                               int b,
                               double[] array,
                               DataBuffer data)
        Overrides:
        setSamples in class SampleModel
      • getSampleFloat

        public float getSampleFloat​(int x,
                                    int y,
                                    int b,
                                    DataBuffer data)
        Overrides:
        getSampleFloat in class javax.media.jai.ComponentSampleModelJAI
      • getSampleDouble

        public double getSampleDouble​(int x,
                                      int y,
                                      int b,
                                      DataBuffer data)
        Overrides:
        getSampleDouble in class javax.media.jai.ComponentSampleModelJAI
      • setSample

        public void setSample​(int x,
                              int y,
                              int b,
                              float s,
                              DataBuffer data)
        Overrides:
        setSample in class javax.media.jai.ComponentSampleModelJAI
      • setSample

        public void setSample​(int x,
                              int y,
                              int b,
                              double s,
                              DataBuffer data)
        Overrides:
        setSample in class javax.media.jai.ComponentSampleModelJAI