Package adams.data.image.transformer
Class BinaryMask
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,ImageTransformer<BufferedImageContainer>
,FlowContextHandler
,Serializable
,Comparable
public class BinaryMask extends AbstractBufferedImageTransformer
Generates a binary image from the input and uses this mask to determine which pixels get replaced by the specified replacement color.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-threshold <int> (property: threshold) The threshold that determines whether a grayscale pixel will become black (below) or white (equal to or above). default: 128 minimum: 0 maximum: 255
-replacement-type <REPLACE_WHITE_PIXELS|REPLACE_BLACK_PIXELS> (property: replacementType) The type of replacement to perform. default: REPLACE_WHITE_PIXELS
-replacement-color <java.awt.Color> (property: replacementColor) The color to replace pixels selected by the replacement type with. default: #ffffff
- Version:
- $Revision: 7706 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
BinaryMask.ReplacementType
Determines what pixels to replace.
-
Field Summary
Fields Modifier and Type Field Description protected Color
m_ReplacementColor
the color to replace the pixels with.protected BinaryMask.ReplacementType
m_ReplacementType
what pixels to replace.protected int
m_Threshold
the (grayscale) threshold to use.-
Fields inherited from class adams.data.image.AbstractImageTransformer
m_FlowContext
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description BinaryMask()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defineOptions()
Adds options to the internal list of options.protected BufferedImageContainer[]
doTransform(BufferedImageContainer img)
Performs no transformation at all, just returns the input.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.Color
getReplacementColor()
Returns the color to replace the selected pixels with.BinaryMask.ReplacementType
getReplacementType()
Returns the type of replacement to perform.int
getThreshold()
Returns the threshold.String
globalInfo()
Returns a string describing the object.String
replacementColorTipText()
Returns the tip text for this property.String
replacementTypeTipText()
Returns the tip text for this property.void
setReplacementColor(Color value)
Sets the color to replace the selected pixels with.void
setReplacementType(BinaryMask.ReplacementType value)
Sets the type of replacement to perform.void
setThreshold(int value)
Sets the threshold.String
thresholdTipText()
Returns the tip text for this property.-
Methods inherited from class adams.data.image.transformer.AbstractBufferedImageTransformer
forCommandLine, forName, getTransformations
-
Methods inherited from class adams.data.image.AbstractImageTransformer
checkImage, cleanUp, compareTo, destroy, equals, getFlowContext, initialize, setFlowContext, shallowCopy, shallowCopy, transform
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_Threshold
protected int m_Threshold
the (grayscale) threshold to use.
-
m_ReplacementType
protected BinaryMask.ReplacementType m_ReplacementType
what pixels to replace.
-
m_ReplacementColor
protected Color m_ReplacementColor
the color to replace the pixels with.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
setThreshold
public void setThreshold(int value)
Sets the threshold.- Parameters:
value
- the threshold
-
getThreshold
public int getThreshold()
Returns the threshold.- Returns:
- the threshold
-
thresholdTipText
public String thresholdTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setReplacementType
public void setReplacementType(BinaryMask.ReplacementType value)
Sets the type of replacement to perform.- Parameters:
value
- the type
-
getReplacementType
public BinaryMask.ReplacementType getReplacementType()
Returns the type of replacement to perform.- Returns:
- the type
-
replacementTypeTipText
public String replacementTypeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setReplacementColor
public void setReplacementColor(Color value)
Sets the color to replace the selected pixels with.- Parameters:
value
- the color
-
getReplacementColor
public Color getReplacementColor()
Returns the color to replace the selected pixels with.- Returns:
- the color
-
replacementColorTipText
public String replacementColorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractImageTransformer<BufferedImageContainer>
- Returns:
- null if no info available, otherwise short string
-
doTransform
protected BufferedImageContainer[] doTransform(BufferedImageContainer img)
Performs no transformation at all, just returns the input.- Specified by:
doTransform
in classAbstractImageTransformer<BufferedImageContainer>
- Parameters:
img
- the image to process (can be modified, since it is a copy)- Returns:
- the copy of the image
-
-