Class ImageInterleaved<T extends ImageInterleaved<T>>

All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
InterleavedF32, InterleavedF64, InterleavedInteger, InterleavedS64

public abstract class ImageInterleaved<T extends ImageInterleaved<T>> extends ImageMultiBand<T>

Base class for images that contain multiple interleaved bands. Typically each band represents a different color or frequency of light detected in the imaging sensor.

Each pixel is composed of N bands. In an RGB image each pixel would be composed of 3 elements, [red][green][blue]. The index of the green band at pixel (3,10) would be:
index of green at (3,10) = startIndex + 10*stride + 3*numBands + 1

See Also:
  • Field Details

    • numBands

      public int numBands
      How many color bands are contained in each pixel
  • Constructor Details

    • ImageInterleaved

      protected ImageInterleaved(int width, int height, int numBands)
      Creates a new image with all of its parameters initialized, including the data array.
      width - Image's width.
      height - Image's height.
      numBands - Number of bands/colors.
    • ImageInterleaved

      protected ImageInterleaved()
  • Method Details

    • subimage

      public T subimage(int x0, int y0, int x1, int y1, @Nullable T subimage)
      Creates a sub-image from 'this' image. The subimage will share the same internal array that stores each pixel's value, but will only pertain to an axis-aligned rectangular segment of the original.
      Specified by:
      subimage in class ImageBase<T extends ImageInterleaved<T>>
      x0 - x-coordinate of top-left corner of the sub-image.
      y0 - y-coordinate of top-left corner of the sub-image.
      x1 - x-coordinate of bottom-right corner of the sub-image.
      y1 - y-coordinate of bottom-right corner of the sub-image.
      subimage - Optional storage for the subimage. Nullable.
      A sub-image of this image.
    • reshape

      public void reshape(int width, int height)
      Description copied from class: ImageBase
      Changes the width and height of the image. If the image data array isn't large enough to hold an image of this size then a new array is declared. Otherwise the image data array is left unchanged and only the width and height variables are modified.
      Specified by:
      reshape in class ImageBase<T extends ImageInterleaved<T>>
      width - Desired image width
      height - Desired image height
    • reshape

      public void reshape(int width, int height, int numberOfBands)
      Description copied from class: ImageMultiBand
      Reshape for MultiBand images which allows the number of bands to be changed a the same time too
      reshape in class ImageMultiBand<T extends ImageInterleaved<T>>
      width - Desired image width
      height - Desired image height
      numberOfBands - Desired number of bands
    • getIndex

      public int getIndex(int x, int y)
      getIndex in class ImageBase<T extends ImageInterleaved<T>>
    • getIndex

      public int getIndex(int x, int y, int band)
    • setTo

      public T setTo(T orig)
      Sets this image equal to the specified image. Automatically resized to match the input image.
      Specified by:
      setTo in class ImageBase<T extends ImageInterleaved<T>>
      orig - The original image whose value is to be copied into this one
      Instance of 'this' to allow chaining.
    • getNumBands

      public int getNumBands()
      Description copied from class: ImageMultiBand
      Returns the number of bands or colors stored in this image.
      Specified by:
      getNumBands in class ImageMultiBand<T extends ImageInterleaved<T>>
      Number of bands in the image.
    • setNumberOfBands

      public final void setNumberOfBands(int numBands)
      Description copied from class: ImageMultiBand
      Changes the number of bands in the image while keeping the width and height the same. A simple reshape is done if possible, if not then new internal data is defined
      Specified by:
      setNumberOfBands in class ImageMultiBand<T extends ImageInterleaved<T>>
      numBands - number of bands
    • getDataType

      public abstract ImageDataType getDataType()
      Returns image type information
      The type of image.
    • _getData

      protected abstract Object _getData()
      Returns the data array the image is stored in.
      data array;
    • getPrimitiveDataType

      protected abstract Class getPrimitiveDataType()
    • _setData

      protected abstract void _setData(Object data)
      Sets the image's internal data array.
      data - data array
    • createSameShape

      public <B extends ImageInterleaved<B>> B createSameShape(Class<B> type)
      Creates an interleaved image of the specified type that will have the same shape
    • create

      public static <B extends ImageInterleaved<B>> B create(Class<B> type, int width, int height, int numBands)
    • copyRow

      public void copyRow(int row, int col0, int col1, int offset, Object array)
      Description copied from class: ImageBase
      Copies the row into the array.
      Specified by:
      copyRow in class ImageBase<T extends ImageInterleaved<T>>
      row - Which row to copy.
      col0 - First column. Inclusive.
      col1 - Last column. Exclusive.
      offset - First index in output array
      array - Output array
    • toString

      public String toString()
      toString in class Object
    • toString_element

      public abstract String toString_element(int index)
      Convert an individual data element into a string