Package adams.data.image
Class AbstractImageTransformer<T extends AbstractImageContainer>
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.image.AbstractImageTransformer<T>
-
- Type Parameters:
T- the type of image to process
- All Implemented Interfaces:
CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,QuickInfoSupporter,SizeOfHandler,ImageTransformer<T>,FlowContextHandler,Serializable,Comparable
- Direct Known Subclasses:
AbstractBoofCVTransformer,AbstractBufferedImageTransformer,AbstractOpenCVTransformer
public abstract class AbstractImageTransformer<T extends AbstractImageContainer> extends AbstractOptionHandler implements ImageTransformer<T>
Abstract base class for AbstractImage transformations.- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Actorm_FlowContextthe flow context.-
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 AbstractImageTransformer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckImage(T img)Optional checks of the image.voidcleanUp()Cleans up data structures, frees up memory.intcompareTo(Object o)Compares this object with the specified object for order.voiddestroy()Frees up memory in a "destructive" non-reversible way.protected abstract T[]doTransform(T img)Performs the actual transforming of the image.booleanequals(Object o)Returns whether the two objects are the same.ActorgetFlowContext()Returns the flow context, if any.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.protected voidinitialize()Initializes the members.voidsetFlowContext(Actor value)Sets the flow context.TshallowCopy()Returns a shallow copy of itself, i.e., based on the commandline options.TshallowCopy(boolean expand)Returns a shallow copy of itself, i.e., based on the commandline options.T[]transform(T img)Transforms the given image.-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, defineOptions, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, 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, defineOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_FlowContext
protected Actor m_FlowContext
the flow context.
-
-
Method Detail
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initializein classAbstractOptionHandler
-
setFlowContext
public void setFlowContext(Actor value)
Sets the flow context.- Specified by:
setFlowContextin interfaceFlowContextHandler- Parameters:
value- the actor
-
getFlowContext
public Actor getFlowContext()
Returns the flow context, if any.- Specified by:
getFlowContextin interfaceFlowContextHandler- Returns:
- the actor, null if none available
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.
Default implementation returns null.- Specified by:
getQuickInfoin interfaceQuickInfoSupporter- Returns:
- null if no info available, otherwise short string
-
checkImage
protected void checkImage(T img)
Optional checks of the image.
Default implementation only checks whether image is null.- Parameters:
img- the image to check
-
doTransform
protected abstract T[] doTransform(T img)
Performs the actual transforming of the image.- Parameters:
img- the image to transform (can be modified, since it is a copy)- Returns:
- the generated image(s)
-
transform
public T[] transform(T img)
Transforms the given image.- Specified by:
transformin interfaceImageTransformer<T extends AbstractImageContainer>- Parameters:
img- the image to transform- Returns:
- the generated image(s)
-
compareTo
public int compareTo(Object o)
Compares this object with the specified object for order. Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
Only compares the commandlines of the two objects.- Specified by:
compareToin interfaceComparable<T extends AbstractImageContainer>- Parameters:
o- the object to be compared.- Returns:
- a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
- Throws:
ClassCastException- if the specified object's type prevents it from being compared to this object.
-
equals
public boolean equals(Object o)
Returns whether the two objects are the same.
Only compares the commandlines of the two objects.
-
shallowCopy
public T shallowCopy()
Returns a shallow copy of itself, i.e., based on the commandline options.- Returns:
- the shallow copy
-
shallowCopy
public T shallowCopy(boolean expand)
Returns a shallow copy of itself, i.e., based on the commandline options.- Parameters:
expand- whether to expand variables to their current values- Returns:
- the shallow copy
-
cleanUp
public void cleanUp()
Cleans up data structures, frees up memory.
The default implementation does nothing.- Specified by:
cleanUpin interfaceCleanUpHandler
-
destroy
public void destroy()
Frees up memory in a "destructive" non-reversible way.
Calls cleanUp() and cleans up the options.- Specified by:
destroyin interfaceDestroyable- Overrides:
destroyin classAbstractOptionHandler- See Also:
AbstractOptionHandler.cleanUpOptions()
-
-