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 booleanm_FixInvalidwhether to fix the shapes of partial hits.protected booleanm_Partialwhether to include partial hits.protected Stringm_Prefixthe 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 voidcheck(BufferedImageContainer image)Checks whether the image can be processed.voiddefineOptions()Adds options to the internal list of options.protected abstract List<BufferedImageContainer>doProcess(BufferedImageContainer image)Performs the actual generation of the subimages.StringfixInvalidTipText()Returns the tip text for this property.booleangetFixInvalid()Returns whether to fix invalid shapes.booleangetPartial()Returns whether to include partial hits.StringgetPrefix()Returns the field prefix used in the report.StringgetQuickInfo()Returns a quick info about the object, which can be displayed in the GUI.StringpartialTipText()Returns the tip text for this property.StringprefixTipText()Returns the tip text for this property.List<BufferedImageContainer>process(BufferedImageContainer image)Generates subimages from the provided image.voidsetFixInvalid(boolean value)Sets whether to fix invalid shapes.voidsetPartial(boolean value)Sets whether to include partial hits.voidsetPrefix(String value)Sets the field prefix used in the report.protected ReporttransferObjects(Report oldReport, int x, int y, int width, int height)Generates a new report with only the objects that fall within the region.protected ReporttransferObjects(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 ReporttransferObjects(Report oldReport, Rectangle region)Generates a new report with only the objects that fall within the region.protected ReporttransferObjects(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:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
setPrefix
public void setPrefix(String value)
Sets the field prefix used in the report.- Specified by:
setPrefixin interfaceObjectPrefixHandler- Parameters:
value- the field prefix
-
getPrefix
public String getPrefix()
Returns the field prefix used in the report.- Specified by:
getPrefixin interfaceObjectPrefixHandler- Returns:
- the field prefix
-
prefixTipText
public String prefixTipText()
Returns the tip text for this property.- Specified by:
prefixTipTextin 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:
getQuickInfoin 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
-
-