Package adams.data.io.input
Class AbstractPNGAnnotationImageSegmentationReader
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.io.input.AbstractImageSegmentationAnnotationReader
-
- adams.data.io.input.AbstractPNGAnnotationImageSegmentationReader
-
- All Implemented Interfaces:
Destroyable,GlobalInfoSupporter,FileFormatHandler,LenientModeSupporter,LoggingLevelHandler,LoggingSupporter,OptionHandler,SizeOfHandler,ImageSegmentationAnnotationReader,ImageSegmentationAnnotationReaderWithLayerNames,Serializable
- Direct Known Subclasses:
AbstractCustomPNGAnnotationImageSegmentationReader,IndexedPNGImageSegmentationReader
public abstract class AbstractPNGAnnotationImageSegmentationReader extends AbstractImageSegmentationAnnotationReader implements ImageSegmentationAnnotationReaderWithLayerNames, LenientModeSupporter
Ancestor for readers that read the annotations from a single PNG file.- Author:
- FracPete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected BaseString[]m_LayerNamesthe layer names.protected booleanm_Lenientwhether to be lenient.protected booleanm_SkipFirstLayerwhether to skip the first layer (usually background).-
Fields inherited from class adams.data.io.input.AbstractImageSegmentationAnnotationReader
m_AlternativeAnnotationDir, m_UseAlternativeAnnotationDir
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description AbstractPNGAnnotationImageSegmentationReader()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected Stringcheck(PlaceholderFile file)Hook method for performing checks before reading the data.voiddefineOptions()Adds options to the internal list of options.protected ImageSegmentationContainerdoRead(PlaceholderFile file)Reads the image segmentation annotations.protected abstract ImageSegmentationContainerdoReadLayers(PlaceholderFile file)Reads the image segmentation annotations.StringgetDefaultFormatExtension()Returns the default extension of the format.String[]getFormatExtensions()Returns the extension(s) of the format.BaseString[]getLayerNames()Returns the names for the layers to use.booleangetLenient()Returns whether lenient, ie the associated PNG does not have to exist.booleangetSkipFirstLayer()Returns whether to skip the first layer.StringlayerNamesTipText()Returns the tip text for this property.StringlenientTipText()Returns the tip text for this property.protected PlaceholderFilelocatePNG(PlaceholderFile file)Locates the PNG annotation file.protected ImageSegmentationContainernewContainer(PlaceholderFile file)Creates a container with the base image and no layers.voidsetLayerNames(BaseString[] value)Sets the names for the layers to use.voidsetLenient(boolean value)Sets whether lenient, ie the associated PNG does not have to exist.voidsetSkipFirstLayer(boolean value)Sets whether to skip the first layer.StringskipFirstLayerTipText()Returns the tip text for this property.-
Methods inherited from class adams.data.io.input.AbstractImageSegmentationAnnotationReader
alternativeAnnotationDirTipText, getAlternativeAnnotationDir, getCorrespondingWriter, getUseAlternativeAnnotationDir, read, setAlternativeAnnotationDir, setUseAlternativeAnnotationDir, useAlternativeAnnotationDirTipText
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, globalInfo, 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.io.FileFormatHandler
getFormatDescription
-
Methods inherited from interface adams.data.io.input.ImageSegmentationAnnotationReader
getAlternativeAnnotationDir, getCorrespondingWriter, getUseAlternativeAnnotationDir, read, setAlternativeAnnotationDir, setUseAlternativeAnnotationDir
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_SkipFirstLayer
protected boolean m_SkipFirstLayer
whether to skip the first layer (usually background).
-
m_LayerNames
protected BaseString[] m_LayerNames
the layer names.
-
m_Lenient
protected boolean m_Lenient
whether to be lenient.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractImageSegmentationAnnotationReader
-
setSkipFirstLayer
public void setSkipFirstLayer(boolean value)
Sets whether to skip the first layer.- Parameters:
value- true if to skip
-
getSkipFirstLayer
public boolean getSkipFirstLayer()
Returns whether to skip the first layer.- Returns:
- true if to skip
-
skipFirstLayerTipText
public String skipFirstLayerTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLayerNames
public void setLayerNames(BaseString[] value)
Sets the names for the layers to use.- Specified by:
setLayerNamesin interfaceImageSegmentationAnnotationReaderWithLayerNames- Parameters:
value- the names
-
getLayerNames
public BaseString[] getLayerNames()
Returns the names for the layers to use.- Specified by:
getLayerNamesin interfaceImageSegmentationAnnotationReaderWithLayerNames- Returns:
- the names
-
layerNamesTipText
public String layerNamesTipText()
Returns the tip text for this property.- Specified by:
layerNamesTipTextin interfaceImageSegmentationAnnotationReaderWithLayerNames- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setLenient
public void setLenient(boolean value)
Sets whether lenient, ie the associated PNG does not have to exist.- Specified by:
setLenientin interfaceLenientModeSupporter- Parameters:
value- true if lenient
-
getLenient
public boolean getLenient()
Returns whether lenient, ie the associated PNG does not have to exist.- Specified by:
getLenientin interfaceLenientModeSupporter- Returns:
- true if lenient
-
lenientTipText
public String lenientTipText()
Returns the tip text for this property.- Specified by:
lenientTipTextin interfaceLenientModeSupporter- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getFormatExtensions
public String[] getFormatExtensions()
Returns the extension(s) of the format.- Specified by:
getFormatExtensionsin interfaceFileFormatHandler- Returns:
- the extension (without the dot!)
-
getDefaultFormatExtension
public String getDefaultFormatExtension()
Returns the default extension of the format.- Specified by:
getDefaultFormatExtensionin interfaceFileFormatHandler- Returns:
- the default extension (without the dot!)
-
locatePNG
protected PlaceholderFile locatePNG(PlaceholderFile file)
Locates the PNG annotation file.- Parameters:
file- the JPG file to determine the PNG file for- Returns:
- the PNG file, or null if failed to determine
-
check
protected String check(PlaceholderFile file)
Hook method for performing checks before reading the data.- Overrides:
checkin classAbstractImageSegmentationAnnotationReader- Parameters:
file- the file to check- Returns:
- null if no errors, otherwise error message
-
newContainer
protected ImageSegmentationContainer newContainer(PlaceholderFile file)
Creates a container with the base image and no layers.- Parameters:
file- the base image to load- Returns:
- the container
-
doReadLayers
protected abstract ImageSegmentationContainer doReadLayers(PlaceholderFile file)
Reads the image segmentation annotations.- Parameters:
file- the file to read from- Returns:
- the annotations
-
doRead
protected ImageSegmentationContainer doRead(PlaceholderFile file)
Reads the image segmentation annotations.- Specified by:
doReadin classAbstractImageSegmentationAnnotationReader- Parameters:
file- the file to read from- Returns:
- the annotations
-
-