Package adams.gui.tools.previewbrowser
Class ImageSegmentationAnnotationsHandler
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.tools.previewbrowser.AbstractContentHandler
-
- adams.gui.tools.previewbrowser.ImageSegmentationAnnotationsHandler
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,ContentHandler
,ColorProviderHandler
,Serializable
public class ImageSegmentationAnnotationsHandler extends AbstractContentHandler implements ColorProviderHandler
Overlays image segmentation annotations obtained from the specified reader over the original JPG image.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected float
m_Alpha
the alpha value (0=transparent, 1=opaque).protected boolean
m_BestFit
whether to use best fit.protected ColorProvider
m_ColorProvider
the color provider to use.protected BaseString[]
m_DisplayedLabels
displayed labels.protected ImageSegmentationAnnotationReader
m_Reader
the annotation reader to use.protected boolean
m_UseSeparateLayers
whether to use separate layers.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 ImageSegmentationAnnotationsHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
alphaTipText()
Returns the tip text for this property.String
bestFitTipText()
Returns the tip text for this property.String
colorProviderTipText()
Returns the tip text for this property.PreviewPanel
createPreview(File file)
Creates the actual preview.void
defineOptions()
Adds options to the internal list of options.String
displayedLabelsTipText()
Returns the tip text for this property.float
getAlpha()
Returns the alpha value to use for the overlay: 0=transparent, 255=opaque.boolean
getBestFit()
Returns whether to use best fit for the image or not.ColorProvider
getColorProvider()
Returns the color provider to use.BaseString[]
getDisplayedLabels()
Returns the displayed labels.String[]
getExtensions()
Returns the list of extensions (without dot) that this handler can take care of.ImageSegmentationAnnotationReader
getReader()
Returns the image annotation reader to use.boolean
getUseSeparateLayers()
Returns whether to use separate layers or just one.double
getZoom()
Returns the zoom level in percent.String
globalInfo()
Returns a string describing the object.protected File
locateAnnotation(File file)
Locates the annotation PNG file.String
readerTipText()
Returns the tip text for this property.PreviewPanel
reusePreview(File file, PreviewPanel lastPreview)
Reuses the last preview, if possible.void
setAlpha(float value)
Sets the alpha value to use for the overlay: 0=transparent, 255=opaque.void
setBestFit(boolean value)
Sets whether to use best fit for the image or not.void
setColorProvider(ColorProvider value)
Sets the color provider to use.void
setDisplayedLabels(BaseString[] value)
Sets the displayed labels.void
setReader(ImageSegmentationAnnotationReader value)
Sets the image annotation reader to use.void
setUseSeparateLayers(boolean value)
Sets whether to use separate layers or just one.void
setZoom(double value)
Sets the zoom level in percent (1-inf).String
useSeparateLayersTipText()
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 ImageSegmentationAnnotationReader m_Reader
the annotation reader to use.
-
m_ColorProvider
protected ColorProvider m_ColorProvider
the color provider to use.
-
m_Alpha
protected float m_Alpha
the alpha value (0=transparent, 1=opaque).
-
m_DisplayedLabels
protected BaseString[] m_DisplayedLabels
displayed labels.
-
m_Zoom
protected double m_Zoom
the zoom level.
-
m_BestFit
protected boolean m_BestFit
whether to use best fit.
-
m_UseSeparateLayers
protected boolean m_UseSeparateLayers
whether to use separate layers.
-
-
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(ImageSegmentationAnnotationReader value)
Sets the image annotation reader to use.- Parameters:
value
- the reader
-
getReader
public ImageSegmentationAnnotationReader getReader()
Returns the image annotation reader to use.- 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
-
setColorProvider
public void setColorProvider(ColorProvider value)
Sets the color provider to use.- Specified by:
setColorProvider
in interfaceColorProviderHandler
- Parameters:
value
- the color provider
-
getColorProvider
public ColorProvider getColorProvider()
Returns the color provider to use.- Specified by:
getColorProvider
in interfaceColorProviderHandler
- Returns:
- the color provider
-
colorProviderTipText
public String colorProviderTipText()
Returns the tip text for this property.- Specified by:
colorProviderTipText
in interfaceColorProviderHandler
- Returns:
- tip text for this property suitable for displaying in the gui
-
setAlpha
public void setAlpha(float value)
Sets the alpha value to use for the overlay: 0=transparent, 255=opaque.- Parameters:
value
- the alpha value
-
getAlpha
public float getAlpha()
Returns the alpha value to use for the overlay: 0=transparent, 255=opaque.- Returns:
- the alpha value
-
alphaTipText
public String alphaTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setDisplayedLabels
public void setDisplayedLabels(BaseString[] value)
Sets the displayed labels.- Parameters:
value
- the labels
-
getDisplayedLabels
public BaseString[] getDisplayedLabels()
Returns the displayed labels.- Returns:
- the labels
-
displayedLabelsTipText
public String displayedLabelsTipText()
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 (1-inf).- Parameters:
value
- the zoom
-
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.
-
setBestFit
public void setBestFit(boolean value)
Sets whether to use best fit for the image or not.- Parameters:
value
- true if to use
-
getBestFit
public boolean getBestFit()
Returns whether to use best fit for the image or not.- Returns:
- true if to use
-
bestFitTipText
public String bestFitTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setUseSeparateLayers
public void setUseSeparateLayers(boolean value)
Sets whether to use separate layers or just one.- Parameters:
value
- true if to use
-
getUseSeparateLayers
public boolean getUseSeparateLayers()
Returns whether to use separate layers or just one.- Returns:
- true if to use
-
useSeparateLayersTipText
public String useSeparateLayersTipText()
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)
-
locateAnnotation
protected File locateAnnotation(File file)
Locates the annotation PNG file.- Parameters:
file
- the JPG file- Returns:
- the annotation file or null if failed to locate
-
createPreview
public PreviewPanel createPreview(File file)
Creates the actual preview.- Specified by:
createPreview
in interfaceContentHandler
- Specified by:
createPreview
in classAbstractContentHandler
- Parameters:
file
- the file to create the view for- Returns:
- the preview
-
reusePreview
public PreviewPanel reusePreview(File file, PreviewPanel lastPreview)
Reuses the last preview, if possible.
Default implementation just creates a new preview.- Specified by:
reusePreview
in interfaceContentHandler
- Overrides:
reusePreview
in classAbstractContentHandler
- Parameters:
file
- the file to create the view for- Returns:
- the preview
-
-