Package adams.gui.tools.previewbrowser
Class AnnotateImage
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.tools.previewbrowser.AbstractContentHandler
-
- adams.gui.tools.previewbrowser.AnnotateImage
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,ObjectPrefixHandler
,ContentHandler
,Serializable
public class AnnotateImage extends AbstractContentHandler implements ObjectPrefixHandler
Allows annotating images and/or modifying their meta-data.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
AnnotateImage.CombinedPanel
Panel to combine the other panels and allow setting of current file name.
-
Field Summary
Fields Modifier and Type Field Description protected String
m_AlternativeFileSuffix
the alternative file suffix to use.protected BaseString[]
m_Labels
the labels.protected ImageOverlay
m_Overlay
the overlay to use for highlighting the objects.protected String
m_Prefix
the prefix to use in the report.protected AbstractReportReader
m_Reader
the reader to use.protected SelectionProcessor
m_SelectionProcessor
the selection processor to apply.protected SelectionShapePainter
m_SelectionShapePainter
the painter for the selection shape.protected String
m_Suffix
the suffix to use for the labels.protected AbstractReportWriter
m_Writer
the report writer for updating the file.protected double
m_Zoom
the zoom level.-
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 AnnotateImage()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
alternativeFileSuffixTipText()
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.protected File
determineReportFile(File file, boolean mustExist, boolean reader)
Determines the report file file for the image.String
getAlternativeFileSuffix()
Returns the alternative file suffix to use for locating the associated spreadsheet (eg '-rois').String[]
getExtensions()
Returns the list of extensions (without dot) that this handler can take care of.BaseString[]
getLabels()
Returns the labels to use.ImageOverlay
getOverlay()
Returns the overlay to use for highlighting the objects.String
getPrefix()
Returns the field prefix to use for the located objects.AbstractReportReader
getReader()
Returns the reader setup to use for reading the object locations from the spreadsheet.SelectionProcessor
getSelectionProcessor()
Returns the selection processor in use.SelectionShapePainter
getSelectionShapePainter()
Returns the painter for the selection shape.String
getSuffix()
Returns the field suffix to use for the labels.AbstractReportWriter
getWriter()
Returns the report writer to use for updating the report on disk.double
getZoom()
Returns the zoom level in percent.String
globalInfo()
Returns a string describing the object.String
labelsTipText()
Returns the tip text for this property.protected BufferedImageContainer
loadContainer(File file)
Reads the image and any associated report.protected Report
loadReport(File file)
Loads the report associated with the image file.String
overlayTipText()
Returns the tip text for this property.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.protected void
saveReport(ImageAnnotator.AnnotatorPanel panel, File file)
Saves the report of the panel to disk.String
selectionProcessorTipText()
Returns the tip text for this property.String
selectionShapePainterTipText()
Returns the tip text for this property.void
setAlternativeFileSuffix(String value)
Sets the alternative file suffix to use for locating the associated spreadsheet (eg '-rois').void
setLabels(BaseString[] value)
Sets the labels to use.void
setOverlay(ImageOverlay value)
Sets the overlay to use for highlighting the objects.void
setPrefix(String value)
Sets the field prefix to use for the located objects.void
setReader(AbstractReportReader value)
Sets the reader setup to use for reading the object locations from the spreadsheet.void
setSelectionProcessor(SelectionProcessor value)
Sets the selection processor to use.void
setSelectionShapePainter(SelectionShapePainter value)
Sets the painter for the selection shape.void
setSuffix(String value)
Sets the field suffix to use for the labels.void
setWriter(AbstractReportWriter value)
Sets the report writer to use for updating the report on disk.void
setZoom(double value)
Sets the zoom level in percent (0-1600).String
suffixTipText()
Returns the tip text for this property.String
writerTipText()
Returns the tip text for this property.String
zoomTipText()
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_Reader
protected AbstractReportReader m_Reader
the reader to use.
-
m_AlternativeFileSuffix
protected String m_AlternativeFileSuffix
the alternative file suffix to use.
-
m_Writer
protected AbstractReportWriter m_Writer
the report writer for updating the file.
-
m_Prefix
protected String m_Prefix
the prefix to use in the report.
-
m_Suffix
protected String m_Suffix
the suffix to use for the labels.
-
m_Labels
protected BaseString[] m_Labels
the labels.
-
m_SelectionProcessor
protected SelectionProcessor m_SelectionProcessor
the selection processor to apply.
-
m_SelectionShapePainter
protected SelectionShapePainter m_SelectionShapePainter
the painter for the selection shape.
-
m_Overlay
protected ImageOverlay m_Overlay
the overlay to use for highlighting the objects.
-
m_Zoom
protected double m_Zoom
the zoom level.
-
-
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
-
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.
-
setAlternativeFileSuffix
public void setAlternativeFileSuffix(String value)
Sets the alternative file suffix to use for locating the associated spreadsheet (eg '-rois').- Parameters:
value
- the suffix
-
getAlternativeFileSuffix
public String getAlternativeFileSuffix()
Returns the alternative file suffix to use for locating the associated spreadsheet (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 field prefix to use for the located objects.- Specified by:
setPrefix
in interfaceObjectPrefixHandler
- Parameters:
value
- the field prefix
-
getPrefix
public String getPrefix()
Returns the field prefix to use for the located objects.- Specified by:
getPrefix
in interfaceObjectPrefixHandler
- Returns:
- the field prefix
-
prefixTipText
public String prefixTipText()
Returns the tip text for this property.- Specified by:
prefixTipText
in interfaceObjectPrefixHandler
- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setSuffix
public void setSuffix(String value)
Sets the field suffix to use for the labels.- Parameters:
value
- the field suffix
-
getSuffix
public String getSuffix()
Returns the field suffix to use for the labels.- Returns:
- the field suffix
-
suffixTipText
public String suffixTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLabels
public void setLabels(BaseString[] value)
Sets the labels to use.- Parameters:
value
- the labels
-
getLabels
public BaseString[] getLabels()
Returns the labels to use.- Returns:
- the labels
-
labelsTipText
public String labelsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setSelectionProcessor
public void setSelectionProcessor(SelectionProcessor value)
Sets the selection processor to use.- Parameters:
value
- the processor
-
getSelectionProcessor
public SelectionProcessor getSelectionProcessor()
Returns the selection processor in use.- Returns:
- the processor
-
selectionProcessorTipText
public String selectionProcessorTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setSelectionShapePainter
public void setSelectionShapePainter(SelectionShapePainter value)
Sets the painter for the selection shape.- Parameters:
value
- the painter
-
getSelectionShapePainter
public SelectionShapePainter getSelectionShapePainter()
Returns the painter for the selection shape.- Returns:
- the painter
-
selectionShapePainterTipText
public String selectionShapePainterTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setOverlay
public void setOverlay(ImageOverlay value)
Sets the overlay to use for highlighting the objects.- Parameters:
value
- the overlay
-
getOverlay
public ImageOverlay getOverlay()
Returns the overlay to use for highlighting the objects.- Returns:
- the overlay
-
overlayTipText
public String overlayTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setZoom
public void setZoom(double value)
Sets the zoom level in percent (0-1600).- Parameters:
value
- the zoom, -1 to fit window, or 0-1600
-
getZoom
public double getZoom()
Returns the zoom level in percent.- Returns:
- the zoom
-
zoomTipText
public String zoomTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setWriter
public void setWriter(AbstractReportWriter value)
Sets the report writer to use for updating the report on disk.- Parameters:
value
- the writer
-
getWriter
public AbstractReportWriter getWriter()
Returns the report writer to use for updating the report on disk.- Returns:
- the writer
-
writerTipText
public String writerTipText()
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 interfaceContentHandler
- Returns:
- the list of extensions (no dot)
-
determineReportFile
protected File determineReportFile(File file, boolean mustExist, boolean reader)
Determines the report file file for the image.- Parameters:
file
- the image filemustExist
- whether the report must exist- Returns:
- the report file, null if not available
-
loadReport
protected Report loadReport(File file)
Loads the report associated with the image file.- Parameters:
file
- the image file- Returns:
- the report, null if not present or failed to load
-
loadContainer
protected BufferedImageContainer loadContainer(File file)
Reads the image and any associated report.- Parameters:
file
- the image to read- Returns:
- the generated container
-
saveReport
protected void saveReport(ImageAnnotator.AnnotatorPanel panel, File file)
Saves the report of the panel to disk.- Parameters:
file
- the image file for determining the report file
-
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
-
-