Package adams.data.opencv.transformer
Class AbstractScriptedTransformer
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.image.AbstractImageTransformer<OpenCVImageContainer>
-
- adams.data.opencv.transformer.AbstractOpenCVTransformer
-
- adams.data.opencv.transformer.AbstractScriptedTransformer
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,FileBasedScripting
,FileBasedScriptingWithOptions
,SizeOfHandler
,ImageTransformer<OpenCVImageContainer>
,FlowContextHandler
,Serializable
,Comparable
- Direct Known Subclasses:
Scripted
public abstract class AbstractScriptedTransformer extends AbstractOpenCVTransformer implements FileBasedScriptingWithOptions
Abstract ancestor for transformers that execute external scripts.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected PlaceholderFile
m_ScriptFile
the script.protected Object
m_ScriptObject
the loaded script object.protected String
m_ScriptOptions
the options for the script.-
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 AbstractScriptedTransformer()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
checkImage(OpenCVImageContainer img)
Optional checks of the image.protected abstract String
checkScriptObject()
Checks the script object.void
defineOptions()
Adds options to the internal list of options.void
destroy()
Frees up memory in a "destructive" non-reversible way.PlaceholderFile
getScriptFile()
Gets the script file.BaseText
getScriptOptions()
Gets the script options.protected String
initScriptObject()
Tries to initialize the scripts object, sets its options and performs some checks.protected abstract String
loadScriptObject()
Loads the scripts object and sets its options.void
reset()
Resets the conversion.String
scriptFileTipText()
Returns the tip text for this property.String
scriptOptionsTipText()
Returns the tip text for this property.void
setScriptFile(PlaceholderFile value)
Sets the script file.void
setScriptOptions(BaseText value)
Sets the script options.-
Methods inherited from class adams.data.opencv.transformer.AbstractOpenCVTransformer
forCommandLine, forName, getTransformations
-
Methods inherited from class adams.data.image.AbstractImageTransformer
cleanUp, compareTo, doTransform, equals, getFlowContext, getQuickInfo, initialize, setFlowContext, shallowCopy, shallowCopy, transform
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, loggingLevelTipText, newOptionManager, 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_ScriptFile
protected PlaceholderFile m_ScriptFile
the script.
-
m_ScriptOptions
protected String m_ScriptOptions
the options for the script.
-
m_ScriptObject
protected transient Object m_ScriptObject
the loaded script object.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
reset
public void reset()
Resets the conversion.- Overrides:
reset
in classAbstractOptionHandler
-
setScriptFile
public void setScriptFile(PlaceholderFile value)
Sets the script file.- Specified by:
setScriptFile
in interfaceFileBasedScripting
- Parameters:
value
- the script
-
getScriptFile
public PlaceholderFile getScriptFile()
Gets the script file.- Specified by:
getScriptFile
in interfaceFileBasedScripting
- Returns:
- the script
-
scriptFileTipText
public String scriptFileTipText()
Returns the tip text for this property.- Specified by:
scriptFileTipText
in interfaceFileBasedScripting
- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setScriptOptions
public void setScriptOptions(BaseText value)
Sets the script options.- Specified by:
setScriptOptions
in interfaceFileBasedScriptingWithOptions
- Parameters:
value
- the options
-
getScriptOptions
public BaseText getScriptOptions()
Gets the script options.- Specified by:
getScriptOptions
in interfaceFileBasedScriptingWithOptions
- Returns:
- the options
-
scriptOptionsTipText
public String scriptOptionsTipText()
Returns the tip text for this property.- Specified by:
scriptOptionsTipText
in interfaceFileBasedScriptingWithOptions
- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
loadScriptObject
protected abstract String loadScriptObject()
Loads the scripts object and sets its options.- Returns:
- null if OK, otherwise the error message
-
checkScriptObject
protected abstract String checkScriptObject()
Checks the script object.- Returns:
- null if OK, otherwise the error message
-
initScriptObject
protected String initScriptObject()
Tries to initialize the scripts object, sets its options and performs some checks.- Returns:
- null if OK, otherwise the error message
-
checkImage
protected void checkImage(OpenCVImageContainer img)
Optional checks of the image.- Overrides:
checkImage
in classAbstractImageTransformer<OpenCVImageContainer>
- Parameters:
img
- the image to check
-
destroy
public void destroy()
Frees up memory in a "destructive" non-reversible way.- Specified by:
destroy
in interfaceDestroyable
- Overrides:
destroy
in classAbstractImageTransformer<OpenCVImageContainer>
- See Also:
AbstractOptionHandler.cleanUpOptions()
-
-