Package adams.gui.tools.previewbrowser
Class ObjectCentersFromReport
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.tools.previewbrowser.AbstractContentHandler
-
- adams.gui.tools.previewbrowser.ObjectCentersFromReport
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,ContentHandler
,Serializable
public class ObjectCentersFromReport extends AbstractContentHandler
Displays the following image types with an overlay for the objects stored in the report with the same name (using object prefix 'Object.'): jpg,tif,tiff,bmp,gif,png,wbmp,jpeg
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING min-user-mode: Expert
-image-reader <adams.data.io.input.ImageReader> (property: imageReader) The image reader to use. default: adams.data.io.input.JAIImageReader
-reader <adams.data.io.input.AbstractReportReader> (property: reader) The reader to use for reading the report. default: adams.data.io.input.DefaultSimpleReportReader
-alternative-file-suffix <java.lang.String> (property: alternativeFileSuffix) The alternative file suffix to use for locating the associated spreadsheet, excluding the extension (eg '-rois'). default:
-prefix <java.lang.String> (property: prefix) The prefix of fields in the report to identify as object location, eg 'Object. '. default: Object.
-diameter <int> (property: diameter) The diameter of the circle that is drawn; < 1 to use the rectangle's dimensions to draw an ellipse. default: 10 minimum: -1
-color <java.awt.Color> (property: color) The color to use for the objects. default: #ff0000
-use-colors-per-type <boolean> (property: useColorsPerType) If enabled, individual colors per type are used. default: true
-type-color-provider <adams.gui.visualization.core.ColorProvider> (property: typeColorProvider) The color provider to use for the various types. default: adams.gui.visualization.core.DefaultColorProvider
-type-suffix <java.lang.String> (property: typeSuffix) The suffix of fields in the report to identify the type. default: .type
-type-regexp <adams.core.base.BaseRegExp> (property: typeRegExp) The regular expression that the types must match in order to get drawn ( eg only plotting a subset). default: .* more: https://docs.oracle.com/javase/tutorial/essential/regex/ https://docs.oracle.com/en/java/javase/11/docs/api/java.base/java/util/regex/Pattern.html
-label-format <java.lang.String> (property: labelFormat) The label format string to use for the rectangles; '#' for index, '@' for type and '$' for short type (type suffix must be defined for '@' and '$' ); for instance: '# @'. default: $
-label-font <java.awt.Font> (property: labelFont) The font to use for the labels. default: Display-PLAIN-14
-vary-shape-color <boolean> (property: varyShapeColor) If enabled, the shape colors get varied. default: false
-shape-color-provider <adams.gui.visualization.core.ColorProvider> (property: shapeColorProvider) The color provider to use when varying the shape colors. default: adams.gui.visualization.core.TranslucentColorProvider -provider adams.gui.visualization.core.DefaultColorProvider
-finder <adams.data.objectfinder.ObjectFinder> (property: finder) The object finder to use. default: adams.data.objectfinder.AllFinder
-use-alternative-location <boolean> (property: useAlternativeLocation) If enabled, the alternative location is used to locate the associated report rather than the directory with the image. default: false
-alternative-location <adams.core.io.PlaceholderDirectory> (property: alternativeLocation) The alternative location to use look for associated reports. default: ${CWD}
-show-object-panel <boolean> (property: showObjectPanel) If enabled, the panel for selecting located objects is being displayed. default: false
- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
ObjectCentersFromReport.CombinedPanel
The panel for displaying the image.
-
Field Summary
Fields Modifier and Type Field Description protected String
m_AlternativeFileSuffix
the alternative file suffix to use.protected PlaceholderDirectory
m_AlternativeLocation
the alternative location.protected Color
m_Color
the color for the objects.protected double
m_Diameter
the diameter of the circle.protected ObjectFinder
m_Finder
the object finder to use.protected ImageReader
m_ImageReader
the image reader to use.protected Font
m_LabelFont
the label font.protected String
m_LabelFormat
the label for the rectangles.protected String
m_Prefix
the prefix for the objects in the report.protected AbstractReportReader
m_Reader
the report reader to use.protected ColorProvider
m_ShapeColorProvider
the color provider to use when varying the shape colors.protected boolean
m_ShowObjectPanel
whether to show the located object panel.protected ColorProvider
m_TypeColorProvider
the color provider to use.protected BaseRegExp
m_TypeRegExp
the regular expression for the types to draw.protected String
m_TypeSuffix
the suffix for the type.protected boolean
m_UseAlternativeLocation
whether to use an alternative location for the reports.protected boolean
m_UseColorsPerType
whether to use colors per type.protected boolean
m_VaryShapeColor
whether to vary the shape color.-
Fields inherited from class adams.gui.tools.previewbrowser.AbstractContentHandler
m_Relation
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
Fields inherited from interface adams.gui.tools.previewbrowser.ContentHandler
MATCH_ALL
-
-
Constructor Summary
Constructors Constructor Description ObjectCentersFromReport()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
alternativeFileSuffixTipText()
Returns the tip text for this property.String
alternativeLocationTipText()
Returns the tip text for this property.String
colorTipText()
Returns the tip text for this property.PreviewPanel
createPreview(File file)
Creates the actual view.void
defineOptions()
Adds options to the internal list of options.String
diameterTipText()
Returns the tip text for this property.protected Report
filterReport(Report report)
Filters the objects in the report, if necessary.String
finderTipText()
Returns the tip text for this property.String
getAlternativeFileSuffix()
Returns the alternative file suffix to use for locating the associated spreadsheet, excluding the extension (eg '-rois').PlaceholderDirectory
getAlternativeLocation()
Returns the alternative location to use for the reports.Color
getColor()
Returns the color to use for the objects.protected ImageReader
getDefaultImageReader()
Returns the default image reader.protected AbstractReportReader
getDefaultReader()
Returns the default reader.double
getDiameter()
Returns the diameter to use for drawing the circleString[]
getExtensions()
Returns the list of extensions (without dot) that this handler can take care of.ObjectFinder
getFinder()
Returns the finder to use for locating the objects.ImageReader
getImageReader()
Returns the image reader to use.Font
getLabelFont()
Returns the label font.String
getLabelFormat()
Returns the label format.String
getPrefix()
Returns the prefix to use for the objects in the report.AbstractReportReader
getReader()
Returns the reader to use for reading the report.ColorProvider
getShapeColorProvider()
Returns the color provider to use when varying the shape colors.boolean
getShowObjectPanel()
Returns whether to show the panel with the located objects.ColorProvider
getTypeColorProvider()
Returns the color provider to use for the types.BaseRegExp
getTypeRegExp()
Returns the regular expression that the types must match in order to get drawn.String
getTypeSuffix()
Returns the suffix to use for the types.boolean
getUseAlternativeLocation()
Returns whether to use an alternative location for the reports.boolean
getUseColorsPerType()
Returns whether to use colors per type.boolean
getVaryShapeColor()
Returns whether to vary the colors of the shapes.String
globalInfo()
Returns a string describing the object.String
imageReaderTipText()
Returns the tip text for this property.String
labelFontTipText()
Returns the tip text for this property.String
labelFormatTipText()
Returns the tip text for this property.protected Report
loadReport(ObjectCentersFromReport.CombinedPanel panel, File file)
Loads the report associated with the image file.String
prefixTipText()
Returns the tip text for this property.String
readerTipText()
Returns the tip text for this property.PreviewPanel
reusePreview(File file, PreviewPanel previewPanel)
Reuses the last preview, if possible.void
setAlternativeFileSuffix(String value)
Sets the alternative file suffix to use for locating the associated spreadsheet, excluding the extension (eg '-rois').void
setAlternativeLocation(PlaceholderDirectory value)
Sets the alternative location to use for the reports.void
setColor(Color value)
Sets the color to use for the objects.void
setDiameter(double value)
Sets the diameter to use for drawing the circlevoid
setFinder(ObjectFinder value)
Sets the finder to use for locating the objects.void
setImageReader(ImageReader value)
Sets the image reader to use.void
setLabelFont(Font value)
Sets the label font.void
setLabelFormat(String value)
Sets the label format.void
setPrefix(String value)
Sets the prefix to use for the objects in the report.void
setReader(AbstractReportReader value)
Sets the reader to use for reading the report.void
setShapeColorProvider(ColorProvider value)
Sets the color provider to use when varying the shape colors.void
setShowObjectPanel(boolean value)
Sets whether to show the panel with the located panels.void
setTypeColorProvider(ColorProvider value)
Sets the color provider to use for the types.void
setTypeRegExp(BaseRegExp value)
Sets the regular expression that the types must match in order to get drawn.void
setTypeSuffix(String value)
Sets the suffix to use for the types.void
setUseAlternativeLocation(boolean value)
Sets whether to use an alternative location for the reports.void
setUseColorsPerType(boolean value)
Sets whether to use colors per type.void
setVaryShapeColor(boolean value)
Sets whether to vary the colors of the shapes.String
shapeColorProviderTipText()
Returns the tip text for this property.String
showObjectPanelTipText()
Returns the tip text for this property.String
typeColorProviderTipText()
Returns the tip text for this property.String
typeRegExpTipText()
Returns the tip text for this property.String
typeSuffixTipText()
Returns the tip text for this property.String
useAlternativeLocationTipText()
Returns the tip text for this property.String
useColorsPerTypeTipText()
Returns the tip text for this property.String
varyShapeColorTipText()
Returns the tip text for this property.-
Methods inherited from class adams.gui.tools.previewbrowser.AbstractContentHandler
checkFile, getHandlers, getHandlersForFile, getHandlersForFile, getPreview, getRelation, hasHandler, hasHandler
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, initialize, 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, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.Destroyable
destroy
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_ImageReader
protected ImageReader m_ImageReader
the image reader to use.
-
m_Reader
protected AbstractReportReader m_Reader
the report reader to use.
-
m_AlternativeFileSuffix
protected String m_AlternativeFileSuffix
the alternative file suffix to use.
-
m_Prefix
protected String m_Prefix
the prefix for the objects in the report.
-
m_Diameter
protected double m_Diameter
the diameter of the circle.
-
m_Color
protected Color m_Color
the color for the objects.
-
m_UseColorsPerType
protected boolean m_UseColorsPerType
whether to use colors per type.
-
m_TypeColorProvider
protected ColorProvider m_TypeColorProvider
the color provider to use.
-
m_TypeSuffix
protected String m_TypeSuffix
the suffix for the type.
-
m_TypeRegExp
protected BaseRegExp m_TypeRegExp
the regular expression for the types to draw.
-
m_LabelFormat
protected String m_LabelFormat
the label for the rectangles.
-
m_LabelFont
protected Font m_LabelFont
the label font.
-
m_VaryShapeColor
protected boolean m_VaryShapeColor
whether to vary the shape color.
-
m_ShapeColorProvider
protected ColorProvider m_ShapeColorProvider
the color provider to use when varying the shape colors.
-
m_Finder
protected ObjectFinder m_Finder
the object finder to use.
-
m_UseAlternativeLocation
protected boolean m_UseAlternativeLocation
whether to use an alternative location for the reports.
-
m_AlternativeLocation
protected PlaceholderDirectory m_AlternativeLocation
the alternative location.
-
m_ShowObjectPanel
protected boolean m_ShowObjectPanel
whether to show the located object panel.
-
-
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 classAbstractOptionHandler
-
getDefaultImageReader
protected ImageReader getDefaultImageReader()
Returns the default image reader.- Returns:
- the default
-
setImageReader
public void setImageReader(ImageReader value)
Sets the image reader to use.- Parameters:
value
- the reader
-
getImageReader
public ImageReader getImageReader()
Returns the image reader to use.- Returns:
- the reader
-
imageReaderTipText
public String imageReaderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getDefaultReader
protected AbstractReportReader getDefaultReader()
Returns the default reader.- Returns:
- the reader
-
setReader
public void setReader(AbstractReportReader value)
Sets the reader to use for reading the report.- Parameters:
value
- the reader
-
getReader
public AbstractReportReader getReader()
Returns the reader to use for reading the report.- Returns:
- the reader
-
readerTipText
public String readerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAlternativeFileSuffix
public void setAlternativeFileSuffix(String value)
Sets the alternative file suffix to use for locating the associated spreadsheet, excluding the extension (eg '-rois').- Parameters:
value
- the suffix
-
getAlternativeFileSuffix
public String getAlternativeFileSuffix()
Returns the alternative file suffix to use for locating the associated spreadsheet, excluding the extension (eg '-rois').- Returns:
- the suffix
-
alternativeFileSuffixTipText
public String alternativeFileSuffixTipText()
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 prefix to use for the objects in the report.- Parameters:
value
- the prefix
-
getPrefix
public String getPrefix()
Returns the prefix to use for the objects in the report.- Returns:
- the prefix
-
prefixTipText
public String prefixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setDiameter
public void setDiameter(double value)
Sets the diameter to use for drawing the circle- Parameters:
value
- the diameter, -1 if using the rectangle's dimensions, (0-1) for fraction of bbox width
-
getDiameter
public double getDiameter()
Returns the diameter to use for drawing the circle- Returns:
- the diameter, -1 if using the rectangle's dimensions, (0-1) for fraction of bbox width
-
diameterTipText
public String diameterTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setColor
public void setColor(Color value)
Sets the color to use for the objects.- Parameters:
value
- the color
-
getColor
public Color getColor()
Returns the color to use for the objects.- Returns:
- the color
-
colorTipText
public String colorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUseColorsPerType
public void setUseColorsPerType(boolean value)
Sets whether to use colors per type.- Parameters:
value
- true if to use colors per type
-
getUseColorsPerType
public boolean getUseColorsPerType()
Returns whether to use colors per type.- Returns:
- true if to use colors per type
-
useColorsPerTypeTipText
public String useColorsPerTypeTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setTypeColorProvider
public void setTypeColorProvider(ColorProvider value)
Sets the color provider to use for the types.- Parameters:
value
- the provider
-
getTypeColorProvider
public ColorProvider getTypeColorProvider()
Returns the color provider to use for the types.- Returns:
- the provider
-
typeColorProviderTipText
public String typeColorProviderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setTypeSuffix
public void setTypeSuffix(String value)
Sets the suffix to use for the types.- Parameters:
value
- the suffix
-
getTypeSuffix
public String getTypeSuffix()
Returns the suffix to use for the types.- Returns:
- the suffix
-
typeSuffixTipText
public String typeSuffixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setTypeRegExp
public void setTypeRegExp(BaseRegExp value)
Sets the regular expression that the types must match in order to get drawn.- Parameters:
value
- the expression
-
getTypeRegExp
public BaseRegExp getTypeRegExp()
Returns the regular expression that the types must match in order to get drawn.- Returns:
- the expression
-
typeRegExpTipText
public String typeRegExpTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabelFormat
public void setLabelFormat(String value)
Sets the label format.- Parameters:
value
- the label format
-
getLabelFormat
public String getLabelFormat()
Returns the label format.- Returns:
- the label format
-
labelFormatTipText
public String labelFormatTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabelFont
public void setLabelFont(Font value)
Sets the label font.- Parameters:
value
- the label font
-
getLabelFont
public Font getLabelFont()
Returns the label font.- Returns:
- the label font
-
labelFontTipText
public String labelFontTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setVaryShapeColor
public void setVaryShapeColor(boolean value)
Sets whether to vary the colors of the shapes.- Parameters:
value
- true if to vary
-
getVaryShapeColor
public boolean getVaryShapeColor()
Returns whether to vary the colors of the shapes.- Returns:
- true if to vary
-
varyShapeColorTipText
public String varyShapeColorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShapeColorProvider
public void setShapeColorProvider(ColorProvider value)
Sets the color provider to use when varying the shape colors.- Parameters:
value
- the provider
-
getShapeColorProvider
public ColorProvider getShapeColorProvider()
Returns the color provider to use when varying the shape colors.- Returns:
- the provider
-
shapeColorProviderTipText
public String shapeColorProviderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
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.
-
setUseAlternativeLocation
public void setUseAlternativeLocation(boolean value)
Sets whether to use an alternative location for the reports.- Parameters:
value
- true if to use
-
getUseAlternativeLocation
public boolean getUseAlternativeLocation()
Returns whether to use an alternative location for the reports.- Returns:
- true if to use
-
useAlternativeLocationTipText
public String useAlternativeLocationTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setAlternativeLocation
public void setAlternativeLocation(PlaceholderDirectory value)
Sets the alternative location to use for the reports.- Parameters:
value
- the location
-
getAlternativeLocation
public PlaceholderDirectory getAlternativeLocation()
Returns the alternative location to use for the reports.- Returns:
- the location
-
alternativeLocationTipText
public String alternativeLocationTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setShowObjectPanel
public void setShowObjectPanel(boolean value)
Sets whether to show the panel with the located panels.- Parameters:
value
- true if to show
-
getShowObjectPanel
public boolean getShowObjectPanel()
Returns whether to show the panel with the located objects.- Returns:
- true if to show
-
showObjectPanelTipText
public String showObjectPanelTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getExtensions
public String[] getExtensions()
Returns the list of extensions (without dot) that this handler can take care of.- Returns:
- the list of extensions (no dot)
-
filterReport
protected Report filterReport(Report report)
Filters the objects in the report, if necessary.- Parameters:
report
- the report to filter- Returns:
- the filtered report (copy, in case filtering occurred)
-
loadReport
protected Report loadReport(ObjectCentersFromReport.CombinedPanel panel, File file)
Loads the report associated with the image file.- Parameters:
panel
- the context panelfile
- the image file- Returns:
- the report, null if not present or failed to load
-
createPreview
public PreviewPanel createPreview(File file)
Creates the actual view.- Specified by:
createPreview
in interfaceContentHandler
- Specified by:
createPreview
in classAbstractContentHandler
- Parameters:
file
- the file to create the view for- Returns:
- the view
-
reusePreview
public PreviewPanel reusePreview(File file, PreviewPanel previewPanel)
Reuses the last preview, if possible.- Specified by:
reusePreview
in interfaceContentHandler
- Overrides:
reusePreview
in classAbstractContentHandler
- Parameters:
file
- the file to create the view for- Returns:
- the view
-
-