Class AbstractSubImagesGenerator
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.image.transformer.subimages.AbstractSubImagesGenerator
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,ObjectPrefixHandler
,Serializable
- Direct Known Subclasses:
Grid
,LabeledRegions
,Objects
,PassThrough
,Regions
public abstract class AbstractSubImagesGenerator extends AbstractOptionHandler implements QuickInfoSupporter, ObjectPrefixHandler
Ancestor for classes that generate subimages from a single image.- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_FixInvalid
whether to fix the shapes of partial hits.protected boolean
m_Partial
whether to include partial hits.protected String
m_Prefix
the prefix to use when generating a report.-
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 AbstractSubImagesGenerator()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
check(BufferedImageContainer image)
Checks whether the image can be processed.void
defineOptions()
Adds options to the internal list of options.protected abstract List<BufferedImageContainer>
doProcess(BufferedImageContainer image)
Performs the actual generation of the subimages.String
fixInvalidTipText()
Returns the tip text for this property.boolean
getFixInvalid()
Returns whether to fix invalid shapes.boolean
getPartial()
Returns whether to include partial hits.String
getPrefix()
Returns the field prefix used in the report.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.String
partialTipText()
Returns the tip text for this property.String
prefixTipText()
Returns the tip text for this property.List<BufferedImageContainer>
process(BufferedImageContainer image)
Generates subimages from the provided image.void
setFixInvalid(boolean value)
Sets whether to fix invalid shapes.void
setPartial(boolean value)
Sets whether to include partial hits.void
setPrefix(String value)
Sets the field prefix used in the report.protected Report
transferObjects(Report oldReport, int x, int y, int width, int height)
Generates a new report with only the objects that fall within the region.protected Report
transferObjects(Report oldReport, int x, int y, int width, int height, String label, String key)
Generates a new report with only the objects that fall within the region.protected Report
transferObjects(Report oldReport, Rectangle region)
Generates a new report with only the objects that fall within the region.protected Report
transferObjects(Report oldReport, Rectangle region, String label, String key)
Generates a new report with only the objects that fall within the region.-
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.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_Prefix
protected String m_Prefix
the prefix to use when generating a report.
-
m_Partial
protected boolean m_Partial
whether to include partial hits.
-
m_FixInvalid
protected boolean m_FixInvalid
whether to fix the shapes of partial hits.
-
-
Method Detail
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptions
in interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
setPrefix
public void setPrefix(String value)
Sets the field prefix used in the report.- Specified by:
setPrefix
in interfaceObjectPrefixHandler
- Parameters:
value
- the field prefix
-
getPrefix
public String getPrefix()
Returns the field prefix used in the report.- 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.
-
setPartial
public void setPartial(boolean value)
Sets whether to include partial hits.- Parameters:
value
- true if to include partial hits
-
getPartial
public boolean getPartial()
Returns whether to include partial hits.- Returns:
- true if to include partial hits
-
partialTipText
public String partialTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setFixInvalid
public void setFixInvalid(boolean value)
Sets whether to fix invalid shapes.- Parameters:
value
- true if to fix invalid shapes
-
getFixInvalid
public boolean getFixInvalid()
Returns whether to fix invalid shapes.- Returns:
- true if to fix invalid shapes
-
fixInvalidTipText
public String fixInvalidTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Returns:
- null if no info available, otherwise short string
-
check
protected void check(BufferedImageContainer image)
Checks whether the image can be processed.
Default implementation only ensures that an image is present.- Parameters:
image
- the image to check
-
transferObjects
protected Report transferObjects(Report oldReport, int x, int y, int width, int height)
Generates a new report with only the objects that fall within the region.- Parameters:
oldReport
- the old report to use as basisx
- the left position of the regiony
- the top position of the regionwidth
- the width of the regionheight
- the height of the region- Returns:
- the new report with the subset of objects in the region
-
transferObjects
protected Report transferObjects(Report oldReport, int x, int y, int width, int height, String label, String key)
Generates a new report with only the objects that fall within the region.- Parameters:
oldReport
- the old report to use as basisx
- the left position of the regiony
- the top position of the regionwidth
- the width of the regionheight
- the height of the regionlabel
- the label to set, ignored if nullkey
- the meta-data key to use, ignored if null- Returns:
- the new report with the subset of objects in the region
-
transferObjects
protected Report transferObjects(Report oldReport, Rectangle region)
Generates a new report with only the objects that fall within the region.- Parameters:
oldReport
- the old report to use as basisregion
- the region in which to locate objects- Returns:
- the new report with the subset of objects in the region
-
transferObjects
protected Report transferObjects(Report oldReport, Rectangle region, String label, String key)
Generates a new report with only the objects that fall within the region.- Parameters:
oldReport
- the old report to use as basisregion
- the region in which to locate objectslabel
- the label to set, ignored if nullkey
- the meta-data key to use, ignored if null- Returns:
- the new report with the subset of objects in the region
-
doProcess
protected abstract List<BufferedImageContainer> doProcess(BufferedImageContainer image)
Performs the actual generation of the subimages.- Parameters:
image
- the image to process- Returns:
- the list of subimages generated
-
process
public List<BufferedImageContainer> process(BufferedImageContainer image)
Generates subimages from the provided image.- Parameters:
image
- the image to process- Returns:
- the list of subimages generated
-
-