Package adams.gui.tools.previewbrowser
Class SimpleImageSegmentationAnnotationsHandler
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.gui.tools.previewbrowser.AbstractContentHandler
-
- adams.gui.tools.previewbrowser.SimpleImageSegmentationAnnotationsHandler
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,SizeOfHandler
,ContentHandler
,Serializable
public class SimpleImageSegmentationAnnotationsHandler extends AbstractContentHandler
Overlays image segmentation annotations from a PNG 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 int
m_Alpha
the alpha value to use for the overlay (0: transparent, 255: opaque).protected ImageColorizer
m_Colorizer
the image colorizer to use.protected ImageReader
m_OverlayReader
the image reader to use for the overlay.protected ImageReader
m_Reader
the image reader to use.-
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 SimpleImageSegmentationAnnotationsHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description String
alphaTipText()
Returns the tip text for this property.String
colorizerTipText()
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.protected BufferedImage
generateOverlay(File file, MessageCollection errors)
Generates the overlay image.int
getAlpha()
Returns the alpha value to use for the overlay: 0=transparent, 255=opaque.ImageColorizer
getColorizer()
Returns the image colorizer to use.String[]
getExtensions()
Returns the list of extensions (without dot) that this handler can take care of.ImageReader
getOverlayReader()
Returns the image reader to use for the overlay.ImageReader
getReader()
Returns the image reader to use.String
globalInfo()
Returns a string describing the object.protected File
locateAnnotation(File file)
Locates the annotation PNG file.String
overlayReaderTipText()
Returns the tip text for this property.String
readerTipText()
Returns the tip text for this property.PreviewPanel
reusePreview(File file, PreviewPanel lastPreview)
Reuses the last preview, if possible.void
setAlpha(int value)
Sets the alpha value to use for the overlay: 0=transparent, 255=opaque.void
setColorizer(ImageColorizer value)
Sets the image colorizer to use.void
setOverlayReader(ImageReader value)
Sets the image reader to use for the overlay.void
setReader(ImageReader value)
Sets the image reader to use.-
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 ImageReader m_Reader
the image reader to use.
-
m_OverlayReader
protected ImageReader m_OverlayReader
the image reader to use for the overlay.
-
m_Colorizer
protected ImageColorizer m_Colorizer
the image colorizer to use.
-
m_Alpha
protected int m_Alpha
the alpha value to use for the overlay (0: transparent, 255: opaque).
-
-
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(ImageReader value)
Sets the image reader to use.- Parameters:
value
- the image reader
-
getReader
public ImageReader getReader()
Returns the image reader to use.- Returns:
- the image reader
-
readerTipText
public String readerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setOverlayReader
public void setOverlayReader(ImageReader value)
Sets the image reader to use for the overlay.- Parameters:
value
- the image reader
-
getOverlayReader
public ImageReader getOverlayReader()
Returns the image reader to use for the overlay.- Returns:
- the image reader
-
overlayReaderTipText
public String overlayReaderTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setColorizer
public void setColorizer(ImageColorizer value)
Sets the image colorizer to use.- Parameters:
value
- the image colorizer
-
getColorizer
public ImageColorizer getColorizer()
Returns the image colorizer to use.- Returns:
- the colorizer
-
colorizerTipText
public String colorizerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setAlpha
public void setAlpha(int value)
Sets the alpha value to use for the overlay: 0=transparent, 255=opaque.- Parameters:
value
- the alphae value
-
getAlpha
public int 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
-
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)
-
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
-
generateOverlay
protected BufferedImage generateOverlay(File file, MessageCollection errors)
Generates the overlay image.- Parameters:
file
- the file to generate the overlay forerrors
- for collecting errors- Returns:
- the overlay, null in case of errors
-
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
-
-