Class RGBBuffer

  • All Implemented Interfaces:
    java.io.Serializable
    Direct Known Subclasses:
    RGBAIntBuffer, RGBIntBuffer

    public class RGBBuffer
    extends java.lang.Object
    implements java.io.Serializable
    Holds the data of an RGB image. The image data is stored in three byte arrays, one for each color band.
    Since:
    OME2.2
    See Also:
    Serialized Form
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static int B_BAND
      Index of the blue band in the image's data buffer.
      static int G_BAND
      Index of the green band in the image's data buffer.
      static int R_BAND
      Index of the red band in the image's data buffer.
    • Constructor Summary

      Constructors 
      Modifier Constructor Description
      protected RGBBuffer()
      Simple constructor to avoid memory allocations.
        RGBBuffer​(int sizeX1, int sizeX2)
      Creates a new 3-band buffer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      byte[] getBlueBand()
      Returns the data buffer for the blue band.
      byte getBlueValue​(int index)
      Retrieves the Blue value for a particular pixel index.
      byte[] getGreenBand()
      Returns the data buffer for the green band.
      byte getGreenValue​(int index)
      Retrieves the Green value for a particular pixel index.
      byte[] getRedBand()
      Returns the data buffer for the red band.
      byte getRedValue​(int index)
      Retrieves the Red value for a particular pixel index.
      int getSizeX1()
      Returns the number of pixels on the X1-axis.
      int getSizeX2()
      Returns the number of pixels on the X2-axis.
      void setBlueValue​(int index, int value)
      Sets the Blue value for a particular pixel index.
      void setGreenValue​(int index, int value)
      Sets the Green value for a particular pixel index.
      void setRedValue​(int index, int value)
      Sets the Red value for a particular pixel index.
      void zero()
      Zeros out (sets every pixel offset to zero) each band.
      • Methods inherited from class java.lang.Object

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

      • R_BAND

        public static final int R_BAND
        Index of the red band in the image's data buffer.
        See Also:
        Constant Field Values
      • G_BAND

        public static final int G_BAND
        Index of the green band in the image's data buffer.
        See Also:
        Constant Field Values
      • B_BAND

        public static final int B_BAND
        Index of the blue band in the image's data buffer.
        See Also:
        Constant Field Values
    • Constructor Detail

      • RGBBuffer

        protected RGBBuffer()
        Simple constructor to avoid memory allocations.
      • RGBBuffer

        public RGBBuffer​(int sizeX1,
                         int sizeX2)
        Creates a new 3-band buffer.
        Parameters:
        sizeX1 - The number of pixels on the X1-axis. This is the X-axis in the case of an XY-plane or XZ-plane. Otherwise it is the Z-axis — ZY-plane.
        sizeX2 - The number of pixels on the X2-axis. This is the Y-axis in the case of an XY-plane or ZY-plane. Otherwise it is the Z-axis — XZ-plane.
        See Also:
        bands
    • Method Detail

      • getRedBand

        public byte[] getRedBand()
        Returns the data buffer for the red band.
        Returns:
        See above.
      • getGreenBand

        public byte[] getGreenBand()
        Returns the data buffer for the green band.
        Returns:
        See above.
      • getBlueBand

        public byte[] getBlueBand()
        Returns the data buffer for the blue band.
        Returns:
        See above.
      • getSizeX1

        public int getSizeX1()
        Returns the number of pixels on the X1-axis. This is the X-axis in the case of an XY-plane or XZ-plane. Otherwise it is the Z-axis — ZY-plane.
        Returns:
        The number of pixels on the X1-axis.
      • getSizeX2

        public int getSizeX2()
        Returns the number of pixels on the X2-axis. This is the Y-axis in the case of an XY-plane or ZY-plane. Otherwise it is the Z-axis — XZ-plane.
        Returns:
        The number of pixels on the X2-axis.
      • setRedValue

        public void setRedValue​(int index,
                                int value)
        Sets the Red value for a particular pixel index.
        Parameters:
        index - The index in the band array.
        value - The pixel value to set.
      • setGreenValue

        public void setGreenValue​(int index,
                                  int value)
        Sets the Green value for a particular pixel index.
        Parameters:
        index - The index in the band array.
        value - The pixel value to set.
      • setBlueValue

        public void setBlueValue​(int index,
                                 int value)
        Sets the Blue value for a particular pixel index.
        Parameters:
        index - The index in the band array.
        value - The pixel value to set.
      • getRedValue

        public byte getRedValue​(int index)
        Retrieves the Red value for a particular pixel index.
        Parameters:
        index - The index in the band array.
        Returns:
        The pixel value at the index.
      • getGreenValue

        public byte getGreenValue​(int index)
        Retrieves the Green value for a particular pixel index.
        Parameters:
        index - The index in the band array.
        Returns:
        The pixel value at the index.
      • getBlueValue

        public byte getBlueValue​(int index)
        Retrieves the Blue value for a particular pixel index.
        Parameters:
        index - The index in the band array.
        Returns:
        The pixel value at the index.
      • zero

        public void zero()
        Zeros out (sets every pixel offset to zero) each band.