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_LayerNames
the layer names.protected boolean
m_Lenient
whether to be lenient.protected boolean
m_SkipFirstLayer
whether to skip the first layer (usually background).-
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 String
check(PlaceholderFile file)
Hook method for performing checks before reading the data.void
defineOptions()
Adds options to the internal list of options.protected ImageSegmentationContainer
doRead(PlaceholderFile file)
Reads the image segmentation annotations.protected abstract ImageSegmentationContainer
doReadLayers(PlaceholderFile file)
Reads the image segmentation annotations.String
getDefaultFormatExtension()
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.boolean
getLenient()
Returns whether lenient, ie the associated PNG does not have to exist.boolean
getSkipFirstLayer()
Returns whether to skip the first layer.String
layerNamesTipText()
Returns the tip text for this property.String
lenientTipText()
Returns the tip text for this property.protected PlaceholderFile
locatePNG(PlaceholderFile file)
Locates the PNG annotation file.protected ImageSegmentationContainer
newContainer(PlaceholderFile file)
Creates a container with the base image and no layers.void
setLayerNames(BaseString[] value)
Sets the names for the layers to use.void
setLenient(boolean value)
Sets whether lenient, ie the associated PNG does not have to exist.void
setSkipFirstLayer(boolean value)
Sets whether to skip the first layer.String
skipFirstLayerTipText()
Returns the tip text for this property.-
Methods inherited from class adams.data.io.input.AbstractImageSegmentationAnnotationReader
getCorrespondingWriter, read
-
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
getCorrespondingWriter, read
-
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:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
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:
setLayerNames
in interfaceImageSegmentationAnnotationReaderWithLayerNames
- Parameters:
value
- the names
-
getLayerNames
public BaseString[] getLayerNames()
Returns the names for the layers to use.- Specified by:
getLayerNames
in interfaceImageSegmentationAnnotationReaderWithLayerNames
- Returns:
- the names
-
layerNamesTipText
public String layerNamesTipText()
Returns the tip text for this property.- Specified by:
layerNamesTipText
in 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:
setLenient
in interfaceLenientModeSupporter
- Parameters:
value
- true if lenient
-
getLenient
public boolean getLenient()
Returns whether lenient, ie the associated PNG does not have to exist.- Specified by:
getLenient
in interfaceLenientModeSupporter
- Returns:
- true if lenient
-
lenientTipText
public String lenientTipText()
Returns the tip text for this property.- Specified by:
lenientTipText
in 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:
getFormatExtensions
in interfaceFileFormatHandler
- Returns:
- the extension (without the dot!)
-
getDefaultFormatExtension
public String getDefaultFormatExtension()
Returns the default extension of the format.- Specified by:
getDefaultFormatExtension
in 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:
check
in 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:
doRead
in classAbstractImageSegmentationAnnotationReader
- Parameters:
file
- the file to read from- Returns:
- the annotations
-
-