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
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 -
Constructor Summary
ConstructorsConstructorDescriptionCreates a LookupTableOperation for one lookup table.LookupTableOperation
(int numTables) Creates an object of this class, calling the super constructor with twonull
arguments and allocates space for the argument number of lookup tables. -
Method Summary
Modifier and TypeMethodDescriptionint
Returns the number of tables in this operation.int[]
getTable
(int channelIndex) Returns one of the internalint
lookup tables.void
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
-
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 twonull
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 internalint
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
-
process
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 classOperation
- Throws:
MissingParameterException
- if any mandatory parameter was not given to the operationWrongParameterException
- if at least one of the input parameters was not initialized appropriately (values out of the valid interval, etc.)
-
process
-
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 returnnull
as long as no new table data is provided viasetTable(int, int[])
orsetTables(int[])
.- Parameters:
numberOfTables
- the new number of tables for this operation, must be1
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 least0
and smaller thangetNumTables()
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
-