Class GrayI<T extends GrayI<T>>

All Implemented Interfaces:
Serializable, Cloneable
Direct Known Subclasses:
GrayI16, GrayI8, GrayS32

public abstract class GrayI<T extends GrayI<T>> extends ImageGray<T>

Base class for all integer images. An integer image can either be signed or unsigned. Since all integers in Java are signed (which is really f*ing annoying) a boolean variable is used to differentiate these image types.

DESIGN NOTE: No performance or generality is lost by using the 'int' type for setters and getters. At a low level the JavaVM converts all integer types into an int when not in an array.

DESIGN NOTE: Java does not support unsigned data. If an image is unsigned this is only directly enforced by the get() function. When directly accessing the data array the data's unsigned nature must be enforced manually using the bitwise and operator.

See Also:
  • Constructor Details

    • GrayI

      protected GrayI(int width, int height)
    • GrayI

      protected GrayI()
  • Method Details

    • get

      public int get(int x, int y)
      Returns the value of the specified pixel.
      Parameters:
      x - pixel coordinate.
      y - pixel coordinate.
      Returns:
      an intensity value.
    • set

      public abstract void set(int x, int y, int value)
      Sets the value of the specified pixel.
      Parameters:
      x - pixel coordinate.
      y - pixel coordinate.
      value - The pixel's new value.
    • unsafe_set

      public abstract void unsafe_set(int x, int y, int value)
      Set function which does not perform bounds checking.
      Parameters:
      x - pixel coordinate.
      y - pixel coordinate.
      value - The pixel's new value.
    • unsafe_get

      public abstract int unsafe_get(int x, int y)
      Get function which does not perform bounds checking.
      Parameters:
      x - pixel coordinate.
      y - pixel coordinate.
      Returns:
      an intensity value.
    • forEachPixel

      public void forEachPixel(GrayI.EachPixel function)
      Passes in the coordinate and value of each pixel in the image.
      Parameters:
      function - (Input) The function
    • getDataType

      public ImageDataType getDataType()
      Description copied from class: ImageGray
      Returns image type information
      Specified by:
      getDataType in class ImageGray<T extends GrayI<T>>
      Returns:
      The type of image.
    • print

      public void print()
      Description copied from class: ImageGray
      Prints the image to standard out
      Specified by:
      print in class ImageGray<T extends GrayI<T>>
    • printBinary

      public void printBinary()
    • printNotZero

      public void printNotZero()