jjil.algorithm
Class GrayLookup

java.lang.Object
  extended by jjil.core.PipelineStage
      extended by jjil.algorithm.GrayLookup

public class GrayLookup
extends PipelineStage

Pipeline stage applies a lookup table to an image. The lookup table can be supplied through the constructor or by the setTable procedure. This pipeline stage modifies its input.

Author:
webb

Constructor Summary
GrayLookup(byte[] table)
          Creates a new instance of GrayLookup.
 
Method Summary
 byte[] getTable()
          Return the lookup table currently being used.
 void push(Image image)
          Maps input Gray8Image through the lookup table, replacing values in the image.
 void setTable(byte[] table)
          Assign a new lookup table.
 
Methods inherited from class jjil.core.PipelineStage
getFront, isEmpty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GrayLookup

public GrayLookup(byte[] table)
           throws Error
Creates a new instance of GrayLookup.

Parameters:
table - The mapping table. Element i maps gray value Byte.MinValue + i to table[i].
Throws:
Error - when table is not a 256-element array.
Method Detail

getTable

public byte[] getTable()
Return the lookup table currently being used.

Returns:
the lookup table.

push

public void push(Image image)
          throws Error
Maps input Gray8Image through the lookup table, replacing values in the image.

Specified by:
push in class PipelineStage
Parameters:
image - the input image (output replaces input).
Throws:
Error - if image is not a Gray8Image.

setTable

public void setTable(byte[] table)
              throws Error
Assign a new lookup table. Images passed to push() after setTable is called will be mapped by the new image.

Parameters:
table - The lookup table. Input image value g is mapped to table[g + Byte.MinValue]
Throws:
Error - if table is not a 256-element array.