Package adams.data.io.input
Class PascalVOCObjectLocationsReader
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.io.input.AbstractReportReader<Report>
-
- adams.data.io.input.PascalVOCObjectLocationsReader
-
- All Implemented Interfaces:
CleanUpHandler,Destroyable,GlobalInfoSupporter,FileFormatHandler,LoggingLevelHandler,LoggingSupporter,OptionHandler,ShallowCopySupporter<AbstractReportReader>,SizeOfHandler,Stoppable,StoppableWithFeedback,ReportReader<Report>,ObjectPrefixHandler,Serializable,Comparable
public class PascalVOCObjectLocationsReader extends AbstractReportReader<Report> implements ObjectPrefixHandler
Reads object locations in Pascal VOC format.
See more:
https://github.com/WaikatoLink2020/objdet-predictions-exchange-format
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-input <adams.core.io.PlaceholderFile> (property: input) The file to read and turn into a report. default: ${CWD}-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]
-prefix <java.lang.String> (property: prefix) The report field prefix used in the report for the objects. default: Object.
-label-suffix <java.lang.String> (property: labelSuffix) The suffix to use in the report for labels. default: type
-meta-prefix <java.lang.String> (property: metaPrefix) The report field prefix used in the report for the meta-data. default: Meta.
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected Fieldm_IDthe field to use for the ID.protected Stringm_LabelSuffixthe label suffix to use.protected Stringm_MetaPrefixthe prefix for the meta-data.protected Stringm_Prefixthe prefix to use for objects.protected Fieldm_Timestampthe field to use for the timestamp.-
Fields inherited from class adams.data.io.input.AbstractReportReader
m_Input, m_Stopped
-
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 PascalVOCObjectLocationsReader()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanaddBoolean(Report report, String name, Boolean value)Adds the boolean value to the report.protected booleanaddNumeric(Report report, String name, String value)Adds the numeric value to the report.protected booleanaddString(Report report, String name, String value)Adds the string value to the report.voiddefineOptions()Adds options to the internal list of options.protected intdetermineParentID(Report report)Tries to determine the parent ID for the current report.StringgetFormatDescription()Returns a string describing the format (used in the file chooser).String[]getFormatExtensions()Returns the extension(s) of the format.FieldgetID()Returns the field to use for the ID.StringgetLabelSuffix()Returns the field suffix used in the report for labels.StringgetMetaPrefix()Returns the field prefix used in the report for the meta-data.protected ElementgetNode(Document dom, String tag)Returns the (first) node.protected StringgetNodeText(Document dom, String tag)Returns the node's text.StringgetPrefix()Returns the field prefix used in the report for the objects.protected ElementgetSubNode(Element parent, String tag)Returns the node from the specified sub-node.protected StringgetSubNodeText(Element parent, String tag)Returns the node text from the specified sub-node.FieldgetTimestamp()Returns the field to use for the timestamp.StringglobalInfo()Returns a string describing the object.StringIDTipText()Returns the tip text for this property.StringlabelSuffixTipText()Returns the tip text for this property.StringmetaPrefixTipText()Returns the tip text for this property.ReportnewInstance()Returns a new instance of the report class in use.StringprefixTipText()Returns the tip text for this property.protected List<Report>readData()Performs the actual reading.voidsetID(Field value)Sets the field to use for the ID.voidsetLabelSuffix(String value)Sets the field suffix used in the report for labels.voidsetMetaPrefix(String value)Sets the field prefix used in the report for the meta-data.voidsetPrefix(String value)Sets the field prefix used in the report for the objects.voidsetTimestamp(Field value)Sets the field to use for the timestamp.StringtimestampTipText()Returns the tip text for this property.-
Methods inherited from class adams.data.io.input.AbstractReportReader
checkData, cleanUp, compareTo, destroy, equals, forCommandLine, forName, getDefaultFormatExtension, getInput, getReaders, inputTipText, isStopped, postRead, read, reset, setInput, shallowCopy, shallowCopy, stopExecution
-
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_ID
protected Field m_ID
the field to use for the ID.
-
m_Timestamp
protected Field m_Timestamp
the field to use for the timestamp.
-
m_Prefix
protected String m_Prefix
the prefix to use for objects.
-
m_LabelSuffix
protected String m_LabelSuffix
the label suffix to use.
-
m_MetaPrefix
protected String m_MetaPrefix
the prefix for the meta-data.
-
-
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 classAbstractReportReader<Report>
-
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.
-
setPrefix
public void setPrefix(String value)
Sets the field prefix used in the report for the objects.- Specified by:
setPrefixin interfaceObjectPrefixHandler- Parameters:
value- the field prefix
-
getPrefix
public String getPrefix()
Returns the field prefix used in the report for the objects.- Specified by:
getPrefixin interfaceObjectPrefixHandler- Returns:
- the field prefix
-
prefixTipText
public String prefixTipText()
Returns the tip text for this property.- Specified by:
prefixTipTextin interfaceObjectPrefixHandler- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabelSuffix
public void setLabelSuffix(String value)
Sets the field suffix used in the report for labels.- Parameters:
value- the field suffix
-
getLabelSuffix
public String getLabelSuffix()
Returns the field suffix used in the report for labels.- Returns:
- the field suffix
-
labelSuffixTipText
public String labelSuffixTipText()
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.
-
getFormatDescription
public String getFormatDescription()
Returns a string describing the format (used in the file chooser).- Specified by:
getFormatDescriptionin interfaceFileFormatHandler- Specified by:
getFormatDescriptionin classAbstractReportReader<Report>- Returns:
- a description suitable for displaying in the file chooser
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the extension(s) of the format.- Specified by:
getFormatExtensionsin interfaceFileFormatHandler- Specified by:
getFormatExtensionsin classAbstractReportReader<Report>- Returns:
- the extension(s) (without the dot!)
-
determineParentID
protected int determineParentID(Report report)
Tries to determine the parent ID for the current report.- Specified by:
determineParentIDin classAbstractReportReader<Report>- Parameters:
report- the report to determine the ID for- Returns:
- the parent database ID, -1 if it cannot be determined
-
newInstance
public Report newInstance()
Returns a new instance of the report class in use.- Specified by:
newInstancein classAbstractReportReader<Report>- Returns:
- the new (empty) report
-
getNode
protected Element getNode(Document dom, String tag)
Returns the (first) node.- Parameters:
dom- the document to look for tag (picks first)tag- the tag name- Returns:
- the node, null if not found
-
getNodeText
protected String getNodeText(Document dom, String tag)
Returns the node's text.- Parameters:
dom- the document to look for tag (picks first)tag- the tag name- Returns:
- the text, null if not found
-
getSubNode
protected Element getSubNode(Element parent, String tag)
Returns the node from the specified sub-node.- Parameters:
parent- the node to start fromtag- the sub-node tag to look for- Returns:
- the sub-node, null if not found
-
getSubNodeText
protected String getSubNodeText(Element parent, String tag)
Returns the node text from the specified sub-node.- Parameters:
parent- the node to start fromtag- the sub-node tag to look for- Returns:
- the text, null if not found
-
addString
protected boolean addString(Report report, String name, String value)
Adds the string value to the report.- Parameters:
report- the report to updatename- the name of the fieldvalue- the string value- Returns:
- whether successfully added
-
addNumeric
protected boolean addNumeric(Report report, String name, String value)
Adds the numeric value to the report.- Parameters:
report- the report to updatename- the name of the fieldvalue- the numeric value- Returns:
- whether successfully added
-
addBoolean
protected boolean addBoolean(Report report, String name, Boolean value)
Adds the boolean value to the report.- Parameters:
report- the report to updatename- the name of the fieldvalue- the numeric value- Returns:
- whether successfully added
-
readData
protected List<Report> readData()
Performs the actual reading.- Specified by:
readDatain classAbstractReportReader<Report>- Returns:
- the reports that were read
-
-