Package net.sourceforge.jiu.ops

# Class LookupTableOperation

java.lang.Object
net.sourceforge.jiu.ops.Operation
net.sourceforge.jiu.ops.ImageToImageOperation
net.sourceforge.jiu.ops.LookupTableOperation

Direct Known Subclasses:
  `Brightness`, `Contrast`, `EqualizeHistogram`, `GammaCorrection`, `NormalizeHistogram`

public abstract class LookupTableOperation extends ImageToImageOperation
An operation that replaces samples with values taken from a lookup table. Operations where each pixel is treated independently from its neighbors and where a pixel value is always mapped to the same new pixel value can be implemented this way.

Since:
  0.6.0
Author:
  Marco Schmidt

## Field Summary

Fields
Modifier and Type
Field
Description
`private int[][]`
`intTables`
`private int`
`numTables`

## Constructor Summary

Constructors
Constructor
Description
`LookupTableOperation()`
Creates a LookupTableOperation for one lookup table.
`LookupTableOperation(int numTables)`
Creates an object of this class, calling the super constructor with two `null` arguments and allocates space for the argument number of lookup tables.

## Method Summary

Modifier and Type
Method
Description
`int`
`getNumTables()`
Returns the number of tables in this operation.
`int[]`
`getTable(int channelIndex)`
Returns one of the internal `int` lookup tables.
`void`
`prepareImages()`
`void`
`process()`
This method does the actual work of the operation.
`private void`
`process(IntegerImage in, IntegerImage out)`
`private void`
`process(IntegerImage in, IntegerImage out, int CHANNEL_INDEX, int tableIndex, int processedItems, int TOTAL_ITEMS)`
`void`
`setNumTables(int numberOfTables)`
Resets the number of tables to be used in this operation to the argument and drops all actual table data initialized so far.
`void`
`setTable(int channelIndex, int[] tableData)`
Provides a new lookup table for one of the channels.
`void`
`setTables(int[] tableData)`
Sets the tables for all channels to the argument table.

### Methods inherited from class net.sourceforge.jiu.ops.ImageToImageOperation

`canInputAndOutputBeEqual, ensureImagesHaveSameResolution, ensureInputImageIsAvailable, ensureOutputImageResolution, getInputImage, getOutputImage, setCanInputAndOutputBeEqual, setInputImage, setOutputImage`

### Methods inherited from class net.sourceforge.jiu.ops.Operation

`addProgressListener, addProgressListeners, getAbort, removeProgressListener, setAbort, setProgress, setProgress`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Field Details

### intTables

private int[][] intTables

### numTables

private int numTables

## Constructor Details

### LookupTableOperation

public LookupTableOperation()
Creates a LookupTableOperation for one lookup table.

### LookupTableOperation

public LookupTableOperation(int numTables)
Creates an object of this class, calling the super constructor with two `null` arguments and allocates space for the argument number of lookup tables.

Parameters:
  `numTables` - number of tables to be used in this operation

## Method Details

### getNumTables

public int getNumTables()
Returns the number of tables in this operation.

Returns:
  number of tables

### getTable

public int[] getTable(int channelIndex)
Returns one of the internal `int` lookup tables.

Parameters:
  `channelIndex` - the zero-based index of the table to be returned; from 0 to getNumTables() - 1
Returns:
  the channelIndex'th table

### prepareImages

public void prepareImages() throws MissingParameterException, WrongParameterException

Throws:
  `MissingParameterException`
  `WrongParameterException`

### process

public void process() throws MissingParameterException, WrongParameterException
Description copied from class: `Operation`
This method does the actual work of the operation. It must be called after all parameters have been given to the operation object.

Overrides:
  `process` in class `Operation`
Throws:
  `MissingParameterException` - if any mandatory parameter was not given to the operation
  `WrongParameterException` - if at least one of the input parameters was not initialized appropriately (values out of the valid interval, etc.)

### process

private void process(IntegerImage in, IntegerImage out)

### process

private void process(IntegerImage in, IntegerImage out, int CHANNEL_INDEX, int tableIndex, int processedItems, int TOTAL_ITEMS)

### setNumTables

public void setNumTables(int numberOfTables)
Resets the number of tables to be used in this operation to the argument and drops all actual table data initialized so far. After a call to this method, `getTable(int)` will return `null` as long as no new table data is provided via `setTable(int, int[])` or `setTables(int[])`.

Parameters:
  `numberOfTables` - the new number of tables for this operation, must be `1` or larger
Throws:
  `IllegalArgumentException` - if the number is zero or smaller

### setTable

public void setTable(int channelIndex, int[] tableData)
Provides a new lookup table for one of the channels.

Parameters:
  `channelIndex` - the index of the channel for which a table is provided; must be at least `0` and smaller than `getNumTables()`
  `tableData` - the actual table to be used for lookup
Throws:
  `IllegalArgumentException` - if the channel index is not in the valid interval (see above)

### setTables

public void setTables(int[] tableData)
Sets the tables for all channels to the argument table. Useful when the same table can be used for all channels.

Parameters:
  `tableData` - the data that will be used as lookup table for all channels