Package adams.data.image.features
Class Scripted
-
- All Implemented Interfaces:
CleanUpHandler,Destroyable,GlobalInfoSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,FileBasedScripting,FileBasedScriptingWithOptions,ShallowCopySupporter<AbstractImageFeatureGenerator>,SizeOfHandler,Serializable,Comparable
public class Scripted extends AbstractScriptedFeatureGenerator
A feature generator that uses any scripting handler for processing the data with a script located in the specified file.
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-converter <adams.data.featureconverter.AbstractFeatureConverter> (property: converter) The feature converter to use to produce the output data. default: adams.data.featureconverter.SpreadSheetFeatureConverter -data-row-type adams.data.spreadsheet.DenseDataRow -spreadsheet-type adams.data.spreadsheet.SpreadSheet
-field <adams.data.report.Field> [-field ...] (property: fields) The fields to add to the output. default:
-notes <adams.core.base.BaseString> [-notes ...] (property: notes) The notes to add as attributes to the generated data, eg 'PROCESS INFORMATION' . default:
-script <adams.core.io.PlaceholderFile> (property: scriptFile) The script file to load and execute. default: ${CWD}-options <adams.core.base.BaseText> (property: scriptOptions) The options for the script; must consist of 'key=value' pairs separated by blanks; the value of 'key' can be accessed via the 'getAdditionalOptions ().getXYZ("key")' method in the script actor. default:-handler <adams.core.scripting.AbstractScriptingHandler> (property: handler) The handler to use for scripting. default: adams.core.scripting.Dummy
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AbstractBufferedImageFeatureGeneratorm_FeatureGeneratorObjectthe loaded script object.protected AbstractScriptingHandlerm_Handlerthe scripting handler to use.-
Fields inherited from class adams.data.image.features.AbstractScriptedFeatureGenerator
m_ScriptFile, m_ScriptObject, m_ScriptOptions
-
Fields inherited from class adams.data.image.AbstractImageFeatureGenerator
m_Converter, m_Fields, m_Notes, m_Prefix
-
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 Scripted()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcheckData(BufferedImageContainer img)Optional checks of the image.protected StringcheckScriptObject()Checks the script object.HeaderDefinitioncreateHeader(BufferedImageContainer img)Creates the header from a template image.voiddefineOptions()Adds options to the internal list of options.voiddestroy()Frees up memory in a "destructive" non-reversible way.List<Object>[]generateRows(BufferedImageContainer img)Performs the actual feature generation.AbstractScriptingHandlergetHandler()Gets the handler to use for scripting.StringglobalInfo()Returns a string describing the object.StringhandlerTipText()Returns the tip text for this property.protected StringloadScriptObject()Loads the scripts object and sets its options.StringscriptOptionsTipText()Returns the tip text for this property.voidsetHandler(AbstractScriptingHandler value)Sets the handler to use for scripting.-
Methods inherited from class adams.data.image.features.AbstractScriptedFeatureGenerator
getScriptFile, getScriptOptions, initScriptObject, reset, scriptFileTipText, setScriptFile, setScriptOptions
-
Methods inherited from class adams.data.image.AbstractImageFeatureGenerator
cleanUp, compareTo, converterTipText, equals, fieldsTipText, generate, getConverter, getDatasetFormat, getFields, getNotes, getPrefix, getRowFormat, notesTipText, postProcessHeader, postProcessRow, postProcessRows, prefixTipText, setConverter, setFields, setNotes, setPrefix, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, 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
-
-
-
-
Field Detail
-
m_FeatureGeneratorObject
protected transient AbstractBufferedImageFeatureGenerator m_FeatureGeneratorObject
the loaded script object.
-
m_Handler
protected AbstractScriptingHandler m_Handler
the scripting handler to use.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractScriptedFeatureGenerator
-
scriptOptionsTipText
public String scriptOptionsTipText()
Returns the tip text for this property.- Specified by:
scriptOptionsTipTextin interfaceFileBasedScriptingWithOptions- Overrides:
scriptOptionsTipTextin classAbstractScriptedFeatureGenerator- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setHandler
public void setHandler(AbstractScriptingHandler value)
Sets the handler to use for scripting.- Parameters:
value- the handler
-
getHandler
public AbstractScriptingHandler getHandler()
Gets the handler to use for scripting.- Returns:
- the handler
-
handlerTipText
public String handlerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
loadScriptObject
protected String loadScriptObject()
Loads the scripts object and sets its options.- Specified by:
loadScriptObjectin classAbstractScriptedFeatureGenerator- Returns:
- null if OK, otherwise the error message
-
checkScriptObject
protected String checkScriptObject()
Checks the script object.- Specified by:
checkScriptObjectin classAbstractScriptedFeatureGenerator- Returns:
- null if OK, otherwise the error message
-
checkData
protected void checkData(BufferedImageContainer img)
Optional checks of the image.- Overrides:
checkDatain classAbstractScriptedFeatureGenerator- Parameters:
img- the image to check
-
createHeader
public HeaderDefinition createHeader(BufferedImageContainer img)
Creates the header from a template image.- Specified by:
createHeaderin classAbstractImageFeatureGenerator<BufferedImageContainer>- Parameters:
img- the image to act as a template- Returns:
- the generated header
-
generateRows
public List<Object>[] generateRows(BufferedImageContainer img)
Performs the actual feature generation.- Specified by:
generateRowsin classAbstractImageFeatureGenerator<BufferedImageContainer>- Parameters:
img- the image to process- Returns:
- the generated features
-
destroy
public void destroy()
Frees up memory in a "destructive" non-reversible way.- Specified by:
destroyin interfaceDestroyable- Overrides:
destroyin classAbstractScriptedFeatureGenerator- See Also:
AbstractOptionHandler.cleanUpOptions()
-
-