Class ObjectAnnotationsReportHandler

  • All Implemented Interfaces:
    Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, SizeOfHandler, ObjectPrefixHandler, ContentHandler, ObjectContentHandler, Serializable

    public class ObjectAnnotationsReportHandler
    extends AbstractObjectContentHandler
    implements ObjectPrefixHandler
    Overlays the annotations onto the image.

    -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-width <int> (property: imageWidth)
        The image width to use; use <= 0 for automatically determining minimal bbox
        around annotations.
        default: -1
        minimum: -1
     
    -image-height <int> (property: imageHeight)
        The image height to use; use <= 0 for automatically determining minimal
        bbox around annotations.
        default: -1
        minimum: -1
     
    -image-background <java.awt.Color> (property: imageBackground)
        The background color to use for the image.
        default: #ffffff
     
    -reader <adams.data.io.input.AbstractReportReader> (property: reader)
        The reader setup to use for reading the object locations from the spreadsheet.
        default: adams.data.io.input.ObjectLocationsSpreadSheetReader -reader \"adams.data.io.input.CsvSpreadSheetReader -data-row-type adams.data.spreadsheet.DenseDataRow -spreadsheet-type adams.data.spreadsheet.DefaultSpreadSheet\" -row-finder adams.data.spreadsheet.rowfinder.AllFinder -col-left x0 -col-top y0 -col-right x1 -col-bottom y1 -col-type label_str
     
    -prefix <java.lang.String> (property: prefix)
        The report field prefix used for objects.
        default: Object.
     
    -cleaner <adams.gui.visualization.object.objectannotations.cleaning.AnnotationCleaner> [-cleaner ...] (property: cleaners)
        The cleaners to apply to the annotations.
        default:
     
    -shape-plotter <adams.gui.visualization.object.objectannotations.shape.ShapePlotter> [-shape-plotter ...] (property: shapePlotters)
        The plotters to use for drawing the shapes.
        default:
     
    -shape-color <adams.gui.visualization.object.objectannotations.colors.AnnotationColors> [-shape-color ...] (property: shapeColors)
        The colorizers for the corresponding shape plotters.
        default:
     
    -outline-plotter <adams.gui.visualization.object.objectannotations.outline.OutlinePlotter> [-outline-plotter ...] (property: outlinePlotters)
        The plotters to use for drawing the outlines.
        default: adams.gui.visualization.object.objectannotations.outline.RectangleOutline
     
    -outline-color <adams.gui.visualization.object.objectannotations.colors.AnnotationColors> [-outline-color ...] (property: outlineColors)
        The colorizers for the corresponding outline plotters.
        default: adams.gui.visualization.object.objectannotations.colors.FixedColor
     
    -label-plotter <adams.gui.visualization.object.objectannotations.label.LabelPlotter> [-label-plotter ...] (property: labelPlotters)
        The plotters to use for drawing the labels.
        default:
     
    -label-color <adams.gui.visualization.object.objectannotations.colors.AnnotationColors> [-label-color ...] (property: labelColors)
        The colorizers for the corresponding label plotters.
        default:
     
    -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
    • Field Detail

      • m_ImageWidth

        protected int m_ImageWidth
        the image width to use.
      • m_ImageHeight

        protected int m_ImageHeight
        the image height to use.
      • m_ImageBackground

        protected Color m_ImageBackground
        the background color to use.
      • m_Prefix

        protected String m_Prefix
        the prefix to use.
      • m_ShapePlotters

        protected ShapePlotter[] m_ShapePlotters
        the shape plotters.
      • m_ShapeColors

        protected AnnotationColors[] m_ShapeColors
        the colorizers for the shape.
      • m_OutlinePlotters

        protected OutlinePlotter[] m_OutlinePlotters
        the outline plotters.
      • m_OutlineColors

        protected AnnotationColors[] m_OutlineColors
        the colorizers for the outline.
      • m_LabelPlotters

        protected LabelPlotter[] m_LabelPlotters
        the label plotters.
      • m_LabelColors

        protected AnnotationColors[] m_LabelColors
        the colorizers for the labels.
      • m_ShowObjectPanel

        protected boolean m_ShowObjectPanel
        whether to show the located object panel.
    • Constructor Detail

      • ObjectAnnotationsReportHandler

        public ObjectAnnotationsReportHandler()
    • Method Detail

      • getDefaultImageWidth

        protected int getDefaultImageWidth()
        Returns the default image width.
        Returns:
        the default
      • setImageWidth

        public void setImageWidth​(int value)
        Sets the image width to use rather than auto determined one (-1).
        Parameters:
        value - the image width (<= 0: auto)
      • getImageWidth

        public int getImageWidth()
        Returns the image width to use rather than auto determined one (-1).
        Returns:
        the image width (<= 0: auto)
      • imageWidthTipText

        public String imageWidthTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getDefaultImageHeight

        protected int getDefaultImageHeight()
        Returns the default image height.
        Returns:
        the default
      • setImageHeight

        public void setImageHeight​(int value)
        Sets the image height to use rather than auto determined one (-1).
        Parameters:
        value - the image height (<= 0: auto)
      • getImageHeight

        public int getImageHeight()
        Returns the image height to use rather than auto determined one (-1).
        Returns:
        the image height (<= 0: auto)
      • imageHeightTipText

        public String imageHeightTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • getDefaultImageBackground

        protected Color getDefaultImageBackground()
        Returns the default background color.
        Returns:
        the default
      • setImageBackground

        public void setImageBackground​(Color value)
        Sets the color to use for the background.
        Parameters:
        value - the color
      • getImageBackground

        public Color getImageBackground()
        Returns the color to use for the background.
        Returns:
        the color
      • imageBackgroundTipText

        public String imageBackgroundTipText()
        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 setup to use for reading the object locations from the spreadsheet.
        Parameters:
        value - the reader
      • getReader

        public AbstractReportReader getReader()
        Returns the reader setup to use for reading the object locations from the spreadsheet.
        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.
      • setPrefix

        public void setPrefix​(String value)
        Sets the field prefix used in the report.
        Specified by:
        setPrefix in interface ObjectPrefixHandler
        Parameters:
        value - the field prefix
      • prefixTipText

        public String prefixTipText()
        Returns the tip text for this property.
        Specified by:
        prefixTipText in interface ObjectPrefixHandler
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setCleaners

        public void setCleaners​(AnnotationCleaner[] value)
        Sets the cleaners for the annotations.
        Parameters:
        value - the cleaners
      • getCleaners

        public AnnotationCleaner[] getCleaners()
        Returns the cleaners for the annotations.
        Returns:
        the cleaners
      • cleanersTipText

        public String cleanersTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setShapeColors

        public void setShapeColors​(AnnotationColors[] value)
        Sets the colorizers for the shape plotters.
        Parameters:
        value - the colorizers
      • getShapeColors

        public AnnotationColors[] getShapeColors()
        Returns the colorizers for the shape plotters.
        Returns:
        the colorizers
      • shapeColorsTipText

        public String shapeColorsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setShapePlotters

        public void setShapePlotters​(ShapePlotter[] value)
        Sets the plotters for the shapes.
        Parameters:
        value - the plotters
      • getShapePlotters

        public ShapePlotter[] getShapePlotters()
        Returns the plotters for the shapes.
        Returns:
        the plotters
      • shapePlottersTipText

        public String shapePlottersTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setOutlineColors

        public void setOutlineColors​(AnnotationColors[] value)
        Sets the colorizers for the outline plotters.
        Parameters:
        value - the colorizers
      • getOutlineColors

        public AnnotationColors[] getOutlineColors()
        Returns the colorizers for the outline plotters.
        Returns:
        the colorizers
      • outlineColorsTipText

        public String outlineColorsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setOutlinePlotters

        public void setOutlinePlotters​(OutlinePlotter[] value)
        Sets the plotters for the outlines.
        Parameters:
        value - the plotters
      • getOutlinePlotters

        public OutlinePlotter[] getOutlinePlotters()
        Returns the plotters for the outlines.
        Returns:
        the plotters
      • outlinePlottersTipText

        public String outlinePlottersTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setLabelColors

        public void setLabelColors​(AnnotationColors[] value)
        Sets the colorizers for the label plotters.
        Parameters:
        value - the colorizers
      • getLabelColors

        public AnnotationColors[] getLabelColors()
        Returns the colorizers for the label plotters.
        Returns:
        the colorizers
      • labelColorsTipText

        public String labelColorsTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setLabelPlotters

        public void setLabelPlotters​(LabelPlotter[] value)
        Sets the plotters for the labels.
        Parameters:
        value - the plotters
      • getLabelPlotters

        public LabelPlotter[] getLabelPlotters()
        Returns the plotters for the labels.
        Returns:
        the plotters
      • labelPlottersTipText

        public String labelPlottersTipText()
        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.
        Specified by:
        getExtensions in interface ContentHandler
        Returns:
        the list of extensions (no dot)
      • loadAnnotations

        protected Report loadAnnotations​(File file)
        Loads the report associated with the image.
        Parameters:
        file - the image file
        Returns:
        the report, null if failed to load report data or none available
      • createImage

        protected BufferedImage createImage​(Report report)
        Creates an empty dummy image that will fit all the annotations. If a dimension cannot be determined (eg no annotations), then default ones are used.
        Parameters:
        report - the report to use
        Returns:
        the dummy image
        See Also:
        MISSING_WIDTH, MISSING_HEIGHT
      • canHandle

        public boolean canHandle​(Class cls)
        Checks whether the class is handled by this content handler.
        Specified by:
        canHandle in interface ObjectContentHandler
        Parameters:
        cls - the class to check
        Returns:
        true if handled