Class ModelRGB

All Implemented Interfaces:
Serializable, Cloneable

public class ModelRGB extends ModelStorageBase
Model of a RGB Table. 256 length red, green, and blue tables are constructed from the red, green, and blue transfer functions. A 256 indexedRGB integer array is returned by exportIndexedRGB with alpha always equal to 255 in the most significant byte, followed by red, green, and blue in the following bytes with the red, green , and blue values able to vary from 0 to 255.
Version:
1.0
Author:
Matthew J. McAuliffe, Ph.D., William Gandler
See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      Use serialVersionUID for interoperability.
      See Also:
    • blueLine

      private TransferFunction blueLine
      Function that maps the blue function of the LUT.
    • BOn

      private boolean BOn
      Flag indicating whether the blue channel should be displayed.
    • GOn

      private boolean GOn
      Flag indicating whether the green channel should be displayed.
    • greenLine

      private TransferFunction greenLine
      Function that maps the green function of the LUT.
    • indexedRGB

      private int[] indexedRGB
      DOCUMENT ME!
    • nColors

      private int nColors
      Number of colors in the LUT.
    • redLine

      private TransferFunction redLine
      Function that maps the red function of the LUT.
    • ROn

      private boolean ROn
      Flag indicating whether the red channel should be displayed.
    • x

      private float[] x
      The X coordinates of the transfer functions.
  • Constructor Details

    • ModelRGB

      public ModelRGB()
      Default constructor.
    • ModelRGB

      public ModelRGB(int[] dimExtents)
      constructor.
      Parameters:
      dimExtents - array indicating RGB table extent in each dimension (e.g. 4x256)
  • Method Details

    • evenDistributionFunctions

      public void evenDistributionFunctions()
      Creates the R, G, and B transfer functions to produce a gray scale LUT.
    • exportIndexedRGB

      public final int[] exportIndexedRGB()
      This is a method to export a special int array where the alpha is stored in the most significant byte, then red, green and blue.
      Returns:
      indexedRGB location to which the exporting takes place
    • getBlueFunction

      public TransferFunction getBlueFunction()
      Accessor that returns the blue transfer function.
      Returns:
      the transfer function that describes how to map the blue values
    • setBlueFunction

      public void setBlueFunction(TransferFunction fn)
      Accessor that returns the blue transfer function.
    • getBOn

      public final boolean getBOn()
      Returns the boolean indicating if the blue channel should be displayed.
      Returns:
      BOn = true then display the blue channel (default = true)
    • getColor

      public Color getColor(int index)
      Gets a specific index of the RGB table.
      Parameters:
      index - index of the RGB table, normally 0-255
      Returns:
      RGBcolor color at index
    • getGOn

      public final boolean getGOn()
      Returns the boolean indicating if the green channel should be displayed.
      Returns:
      GOn = true then display the green channel (default = true)
    • getGreenFunction

      public TransferFunction getGreenFunction()
      Accessor that returns the green transfer function.
      Returns:
      the transfer function that describes how to map the green values
    • setGreenFunction

      public void setGreenFunction(TransferFunction fn)
      Accessor that returns the green transfer function.
    • getRedFunction

      public TransferFunction getRedFunction()
      Accessor that returns the red transfer function.
      Returns:
      the transfer function that describes how to map the red values
    • setRedFunction

      public void setRedFunction(TransferFunction fn)
      Accessor that returns the red transfer function.
    • getROn

      public final boolean getROn()
      Returns the boolean indicating if the red channel should be displayed.
      Returns:
      RaOn = true then display the red channel (default = true)
    • makeGrayTransferFunctions

      public void makeGrayTransferFunctions()
      Creates the R, G, and B transfer functions to produce a gray scale LUT.
    • makeHorizonTransferFunctions

      public void makeHorizonTransferFunctions()
      Creates the R, G, and B transfer functions to produce a horizontal linear scale LUT.
    • makeIndexedRGB

      public void makeIndexedRGB()
      Special RGB table to be used to display java image. Assumes RGB values that range between (0 and 255) are stored in the RGB table;
    • makeRGB

      public void makeRGB(int _nColors)
      This method uses the R, G, B transfer functions to build the desired RGB tables.
      Parameters:
      _nColors - indicates the number of colors to used in the RGB table.
    • setBOn

      public final void setBOn(boolean blueOn)
      Sets if the blue channel to the boolean value.
      Parameters:
      blueOn - if true blue channel should be displayed.
    • setColor

      public void setColor(int index, Color RGBcolor)
      Sets a specific index of the RGB table with the given color.
      Parameters:
      index - index of the RGB table, normally 0-255
      RGBcolor - color to be placed at the index
    • setGOn

      public final void setGOn(boolean greenOn)
      Sets if the green channel to the boolean value.
      Parameters:
      greenOn - if true green channel should be displayed.
    • setROn

      public final void setROn(boolean redOn)
      Sets if the red channel to the boolean value.
      Parameters:
      redOn - if true red channel should be displayed.
    • calcRGBBand

      private void calcRGBBand(TransferFunction function, float[] band)
      Calculates the color band (i.e. red, green, blue) for the LUT using the the corresponding transfer function
      Parameters:
      function - the band's transfer function
      band - storage location after conversion from transfer function to the band