Package adams.data.io.output
Class OpexObjectLocationsWriter
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.io.output.AbstractReportWriter<Report>
-
- adams.data.io.output.OpexObjectLocationsWriter
-
- All Implemented Interfaces:
CleanUpHandler
,Destroyable
,GlobalInfoSupporter
,FileFormatHandler
,PrettyPrintingSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,ShallowCopySupporter<AbstractReportWriter>
,SizeOfHandler
,ReportWriter<Report>
,StringReportWriter<Report>
,Serializable
,Comparable
public class OpexObjectLocationsWriter extends AbstractReportWriter<Report> implements PrettyPrintingSupporter, StringReportWriter<Report>
Writes polygon annotations in VGG Image Annotator JSON format.
For more information, see:
http://www.robots.ox.ac.uk/~vgg/software/via/
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-output <adams.core.io.PlaceholderFile> (property: output) The file to write the report to. default: ${TMP}/out.json
-finder <adams.data.objectfinder.ObjectFinder> (property: finder) The object finder to use. default: adams.data.objectfinder.AllFinder
-id <adams.data.report.Field> (property: ID) The field to use for storing the ID. default: ID[S]
-timestamp <adams.data.report.Field> (property: timestamp) The field to use for storing the timestamp. default: Timestamp[S]
-label-key <java.lang.String> (property: labelKey) The key in the meta-data containing the label, ignored if empty. default: type
-score-key <java.lang.String> (property: scoreKey) The key in the meta-data containing the sore, ignored if empty. default: score
-meta-prefix <java.lang.String> (property: metaPrefix) The report field prefix used in the report for the meta-data. default: Meta.
-pretty-printing <boolean> (property: prettyPrinting) If enabled, the output is printed in a 'pretty' format. default: false
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected ObjectFinder
m_Finder
the object finder to use.protected Field
m_ID
the meta-data key with the ID.protected String
m_LabelKey
the meta-data key with the label.protected String
m_MetaPrefix
the prefix for the meta-data.protected boolean
m_PrettyPrinting
whether to use pretty-printing.protected String
m_ScoreKey
the meta-data key with the score.protected Field
m_Timestamp
the field with the timestamp.-
Fields inherited from class adams.data.io.output.AbstractReportWriter
m_Output
-
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 OpexObjectLocationsWriter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected opex4j.ObjectPredictions
convert(Report data)
Converts the report into OPEX format.void
defineOptions()
Adds options to the internal list of options.String
finderTipText()
Returns the tip text for this property.ObjectFinder
getFinder()
Returns the finder to use for locating the objects.String
getFormatDescription()
Returns a string describing the format (used in the file chooser).String[]
getFormatExtensions()
Returns the extension of the format.Field
getID()
Returns the field to use for the ID.String
getLabelKey()
Returns the key in the meta-data containing the label.String
getMetaPrefix()
Returns the field prefix used in the report for the meta-data.boolean
getPrettyPrinting()
Returns whether pretty-printing is used or not.String
getScoreKey()
Returns the key in the meta-data containing the score.Field
getTimestamp()
Returns the field to use for the timestamp.String
globalInfo()
Returns a string describing the object.String
IDTipText()
Returns the tip text for this property.String
labelKeyTipText()
Returns the tip text for this property.String
metaPrefixTipText()
Returns the tip text for this property.String
prettyPrintingTipText()
Returns the tip text for this property.String
scoreKeyTipText()
Returns the tip text for this property.void
setFinder(ObjectFinder value)
Sets the finder to use for locating the objects.void
setID(Field value)
Sets the field to use for the ID.void
setLabelKey(String value)
Sets the key in the meta-data containing the label.void
setMetaPrefix(String value)
Sets the field prefix used in the report for the meta-data.void
setPrettyPrinting(boolean value)
Sets whether to use pretty-printing or not.void
setScoreKey(String value)
Sets the key in the meta-data containing the score.void
setTimestamp(Field value)
Sets the field to use for the timestamp.String
timestampTipText()
Returns the tip text for this property.String
write(Report data, MessageCollection errors)
Performs checks and converts the report to a string.protected boolean
writeData(Report data)
Performs the actual writing.-
Methods inherited from class adams.data.io.output.AbstractReportWriter
checkData, cleanUp, compareTo, destroy, equals, forCommandLine, forName, getDefaultFormatExtension, getOutput, getWriters, outputTipText, reset, setOutput, shallowCopy, shallowCopy, write
-
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
-
Methods inherited from interface adams.data.io.output.ReportWriter
getOutput, outputTipText, setOutput, write
-
-
-
-
Field Detail
-
m_Finder
protected ObjectFinder m_Finder
the object finder to use.
-
m_Timestamp
protected Field m_Timestamp
the field with the timestamp.
-
m_ID
protected Field m_ID
the meta-data key with the ID.
-
m_LabelKey
protected String m_LabelKey
the meta-data key with the label.
-
m_ScoreKey
protected String m_ScoreKey
the meta-data key with the score.
-
m_MetaPrefix
protected String m_MetaPrefix
the prefix for the meta-data.
-
m_PrettyPrinting
protected boolean m_PrettyPrinting
whether to use pretty-printing.
-
-
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 classAbstractReportWriter<Report>
-
setFinder
public void setFinder(ObjectFinder value)
Sets the finder to use for locating the objects.- Parameters:
value
- the finder
-
getFinder
public ObjectFinder getFinder()
Returns the finder to use for locating the objects.- Returns:
- the finder
-
finderTipText
public String finderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setID
public void setID(Field value)
Sets the field to use for the ID.- Parameters:
value
- the field
-
getID
public Field getID()
Returns the field to use for the ID.- Returns:
- the field
-
IDTipText
public String IDTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setTimestamp
public void setTimestamp(Field value)
Sets the field to use for the timestamp.- Parameters:
value
- the field
-
getTimestamp
public Field getTimestamp()
Returns the field to use for the timestamp.- Returns:
- the field
-
timestampTipText
public String timestampTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabelKey
public void setLabelKey(String value)
Sets the key in the meta-data containing the label.- Parameters:
value
- the key
-
getLabelKey
public String getLabelKey()
Returns the key in the meta-data containing the label.- Returns:
- the key
-
labelKeyTipText
public String labelKeyTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setScoreKey
public void setScoreKey(String value)
Sets the key in the meta-data containing the score.- Parameters:
value
- the key
-
getScoreKey
public String getScoreKey()
Returns the key in the meta-data containing the score.- Returns:
- the key
-
scoreKeyTipText
public String scoreKeyTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMetaPrefix
public void setMetaPrefix(String value)
Sets the field prefix used in the report for the meta-data.- Parameters:
value
- the field prefix
-
getMetaPrefix
public String getMetaPrefix()
Returns the field prefix used in the report for the meta-data.- Returns:
- the field prefix
-
metaPrefixTipText
public String metaPrefixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setPrettyPrinting
public void setPrettyPrinting(boolean value)
Sets whether to use pretty-printing or not.- Specified by:
setPrettyPrinting
in interfacePrettyPrintingSupporter
- Parameters:
value
- true if to use pretty-printing
-
getPrettyPrinting
public boolean getPrettyPrinting()
Returns whether pretty-printing is used or not.- Specified by:
getPrettyPrinting
in interfacePrettyPrintingSupporter
- Returns:
- true if to use pretty-printing
-
prettyPrintingTipText
public String prettyPrintingTipText()
Returns the tip text for this property.- Specified by:
prettyPrintingTipText
in interfacePrettyPrintingSupporter
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getFormatDescription
public String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescription
in interfaceFileFormatHandler
- Specified by:
getFormatDescription
in classAbstractReportWriter<Report>
- Returns:
- a description suitable for displaying in the file chooser
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the extension of the format.- Specified by:
getFormatExtensions
in interfaceFileFormatHandler
- Specified by:
getFormatExtensions
in classAbstractReportWriter<Report>
- Returns:
- the extension (without the dot!)
-
convert
protected opex4j.ObjectPredictions convert(Report data)
Converts the report into OPEX format.- Parameters:
data
- the report to convert- Returns:
- the generated OPEX data
-
writeData
protected boolean writeData(Report data)
Performs the actual writing.- Specified by:
writeData
in classAbstractReportWriter<Report>
- Parameters:
data
- the data to write- Returns:
- true if successfully written
-
write
public String write(Report data, MessageCollection errors)
Performs checks and converts the report to a string.- Specified by:
write
in interfaceStringReportWriter<Report>
- Parameters:
data
- the data to writeerrors
- for collecting errors- Returns:
- the generated data, null in case of failure
-
-