@ALDAOperator(genericExecutionMode=ALL, level=STANDARD) public class GrayscaleToGrayscaleMapping extends MTBOperator
The map must be provided in a file where each line contains a pair of tab-separated values. The first value is the value in the given image and the second value is the new value to which the first one is to be mapped in the output image.
Image values not being present in the map will be ignored, i.e. either
mapped to zero or left untouched depending on the value of the parameter
ignoredValuesMode
.
Note that in single image mode the map file has to be specified explicitly while in directory mode it is assumed that the map files are located in the directory which is to be processed. For each image named 'X.tif' the corresponding map file should be named 'X-map.txt'.
Modifier and Type | Class and Description |
---|---|
static class |
GrayscaleToGrayscaleMapping.IgnoredValuesHandlingMode
Available modes how to handle ignored values.
|
static class |
GrayscaleToGrayscaleMapping.OperationMode
Operation mode of the operator.
|
Modifier and Type | Field and Description |
---|---|
private static String |
classID
Class identifier.
|
protected de.unihalle.informatik.Alida.datatypes.ALDFileString |
filePath
Textfile with mapping.
|
protected GrayscaleToGrayscaleMapping.IgnoredValuesHandlingMode |
ignoredValuesMode
Mode how to handle ignored values.
|
protected MTBImageByte |
ignoreMask
Optional binary mask of additional pixels to ignore.
|
private de.unihalle.informatik.Alida.datatypes.ALDDirectoryString |
inDir
Input directory.
|
protected MTBImage |
inputImg
Input image.
|
private HashMap<Double,Double> |
map
Map for value mappings.
|
GrayscaleToGrayscaleMapping.OperationMode |
opMode
Mode of operation of the operator.
|
private MTBImage |
resultImg
Generated result image.
|
Constructor and Description |
---|
GrayscaleToGrayscaleMapping()
Default constructor.
|
Modifier and Type | Method and Description |
---|---|
MTBImage |
getResultImage()
Returns the result image.
|
protected void |
operate()
This method does the actual work.
|
protected MTBImage |
processImage(MTBImage img)
Convert a single image.
|
void |
setIgnoreMask(MTBImageByte bImg)
Specfiy additional mask of pixels to ignore.
|
void |
setInputImage(MTBImage inimg)
Set input image.
|
void |
setMappingFile(String s)
Specify mapping file.
|
private void |
switchOpModeParameters()
Callback routine to change operator mode parameters.
|
void |
validateCustom() |
readResolve
addOperatorExecutionProgressEventListener, addParameter, addParameter, addParameterUnconditioned, fieldContained, fireOperatorExecutionProgressEvent, getALDPortHashAccessKey, getConstructionMode, getDocumentation, getHidingMode, getInactiveParameterNames, getInInoutNames, getInInoutNames, getInNames, getInOutNames, getMissingRequiredInputs, getName, getNumParameters, getOutInoutNames, getOutNames, getParameter, getParameterDescriptor, getParameterDescriptorUnconditioned, getParameterNames, getParameterUnconditioned, getSupplementalNames, getVerbose, getVersion, handleOperatorExecutionProgressEvent, hasInOutParameters, hasParameter, isAnnotatedParameter, isConfigured, print, print, print, printInterface, printInterface, readHistory, reinitializeParameterDescriptors, removeOperatorExecutionProgressEventListener, removeParameter, runOp, runOp, runOp, setConstructionMode, setConstructionMode, setConstructionMode, setHidingMode, setName, setParameter, setParameterUnconditioned, setVerbose, toStringVerbose, unconfiguredItems, validate, validateGeneric, writeHistory, writeHistory, writeHistory
private static final String classID
@Parameter(label="Operation Mode", required=true, direction=IN, dataIOOrder=-5, description="Operation mode of the operator.", callback="switchOpModeParameters", paramModificationMode=MODIFIES_INTERFACE) public GrayscaleToGrayscaleMapping.OperationMode opMode
@Parameter(label="Input Image", required=true, dataIOOrder=1, direction=IN, description="Input image.") protected MTBImage inputImg
@Parameter(label="Input Directory", required=true, direction=IN, description="Input directory.", dataIOOrder=1) private de.unihalle.informatik.Alida.datatypes.ALDDirectoryString inDir
@Parameter(label="Map file", required=true, dataIOOrder=2, direction=IN, description="File with mapping information.") protected de.unihalle.informatik.Alida.datatypes.ALDFileString filePath
@Parameter(label="Ignore mask?", required=false, dataIOOrder=5, direction=IN, description="Ignore mask, pixels with values > 0 are ignored.") protected MTBImageByte ignoreMask
Pixels marked white are ignored, i.e. mapped to black or left untouched.
@Parameter(label="How to handle ignored values?", required=false, dataIOOrder=6, direction=IN, description="Mode how ignored values are treated.") protected GrayscaleToGrayscaleMapping.IgnoredValuesHandlingMode ignoredValuesMode
@Parameter(label="Result Image", dataIOOrder=0, direction=OUT, description="Resulting image.") private transient MTBImage resultImg
public GrayscaleToGrayscaleMapping() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.private void switchOpModeParameters()
public MTBImage getResultImage()
public void setInputImage(MTBImage inimg)
inimg
- Input grayscale image.public void setMappingFile(String s)
s
- File path.public void setIgnoreMask(MTBImageByte bImg)
bImg
- Binary mask.public void validateCustom() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException
validateCustom
in class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
protected void operate() throws de.unihalle.informatik.Alida.exceptions.ALDOperatorException, de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
operate
in class de.unihalle.informatik.Alida.operator.ALDOperator
de.unihalle.informatik.Alida.exceptions.ALDOperatorException
- Thrown in case of failure.de.unihalle.informatik.Alida.exceptions.ALDProcessingDAGException
- Thrown in case of failure.Copyright © 2010–2020 Martin Luther University Halle-Wittenberg, Institute of Computer Science, Pattern Recognition and Bioinformatics. All rights reserved.