Class LabeledRegions
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.data.image.transformer.subimages.AbstractSubImagesGenerator
-
- adams.data.image.transformer.subimages.LabeledRegions
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,SizeOfHandler
,ObjectPrefixHandler
,Serializable
public class LabeledRegions extends AbstractSubImagesGenerator
Extracts the sub-images according to the region definitions.
Additional report values:
- Region: for the region
- Coordinates: for the 1-based coordinates (x,y,w,h)
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING min-user-mode: Expert
-prefix <java.lang.String> (property: prefix) The report field prefix used in the report. default: Object.
-partial <boolean> (property: partial) If enabled, partial hits are included as well. default: false
-fix-invalid <boolean> (property: fixInvalid) If enabled, objects that fall partially outside the image boundaries get fixed (eg when allowing partial hits). default: false
-region <adams.core.base.LabeledRectangle> [-region ...] (property: regions) The regions to extract (x y w h label, 0 or 1-based x/y). default:
-one-based-coords <boolean> (property: oneBasedCoords) If enabled, the coordinates are consisdered starting at 1 rather than 0. default: true
-label-key <java.lang.String> (property: labelKey) The key for the label in the meta-data. default: type
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static String
KEY_COORDINATES
the key for the coordinates.static String
KEY_REGION
the key for the region.protected String
m_LabelKey
the meta-data key for the label.protected boolean
m_OneBasedCoords
whether the regions are 1-based or 0-based.protected LabeledRectangle[]
m_Regions
the regions to use.-
Fields inherited from class adams.data.image.transformer.subimages.AbstractSubImagesGenerator
m_FixInvalid, m_Partial, m_Prefix
-
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 LabeledRegions()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defineOptions()
Adds options to the internal list of options.protected List<BufferedImageContainer>
doProcess(BufferedImageContainer image)
Performs the actual generation of the subimages.String
getLabelKey()
Returns the key for the label in the meta-data.boolean
getOneBasedCoords()
Returns whether the coordinates start at 1 or 0.String
getQuickInfo()
Returns a quick info about the object, which can be displayed in the GUI.LabeledRectangle[]
getRegions()
Returns the regions to extract (x y w h, 0 or 1-based x/y).String
globalInfo()
Returns a string describing the object.String
labelKeyTipText()
Returns the tip text for this property.String
oneBasedCoordsTipText()
Returns the tip text for this property.String
regionsTipText()
Returns the tip text for this property.void
setLabelKey(String value)
Sets the key for the label in the meta-data.void
setOneBasedCoords(boolean value)
Sets whether the coordinates start at 1 or 0.void
setRegions(LabeledRectangle[] value)
Sets the regions to extract (x y w h, 0 or 1-based x/y).-
Methods inherited from class adams.data.image.transformer.subimages.AbstractSubImagesGenerator
check, fixInvalidTipText, getFixInvalid, getPartial, getPrefix, partialTipText, prefixTipText, process, setFixInvalid, setPartial, setPrefix, transferObjects, transferObjects, transferObjects, transferObjects
-
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.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
KEY_REGION
public static final String KEY_REGION
the key for the region.- See Also:
- Constant Field Values
-
KEY_COORDINATES
public static final String KEY_COORDINATES
the key for the coordinates.- See Also:
- Constant Field Values
-
m_Regions
protected LabeledRectangle[] m_Regions
the regions to use.
-
m_OneBasedCoords
protected boolean m_OneBasedCoords
whether the regions are 1-based or 0-based.
-
m_LabelKey
protected String m_LabelKey
the meta-data key for the label.
-
-
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 classAbstractSubImagesGenerator
-
setRegions
public void setRegions(LabeledRectangle[] value)
Sets the regions to extract (x y w h, 0 or 1-based x/y).- Parameters:
value
- the regions
-
getRegions
public LabeledRectangle[] getRegions()
Returns the regions to extract (x y w h, 0 or 1-based x/y).- Returns:
- the regions
-
regionsTipText
public String regionsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setOneBasedCoords
public void setOneBasedCoords(boolean value)
Sets whether the coordinates start at 1 or 0.- Parameters:
value
- true if 1-based coordinates
-
getOneBasedCoords
public boolean getOneBasedCoords()
Returns whether the coordinates start at 1 or 0.- Returns:
- true if 1-based coordinates
-
oneBasedCoordsTipText
public String oneBasedCoordsTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the gui
-
setLabelKey
public void setLabelKey(String value)
Sets the key for the label in the meta-data.- Parameters:
value
- the key
-
getLabelKey
public String getLabelKey()
Returns the key for the label in the meta-data.- Returns:
- the key
-
labelKeyTipText
public String labelKeyTipText()
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
- Overrides:
getQuickInfo
in classAbstractSubImagesGenerator
- Returns:
- null if no info available, otherwise short string
-
doProcess
protected List<BufferedImageContainer> doProcess(BufferedImageContainer image)
Performs the actual generation of the subimages.- Specified by:
doProcess
in classAbstractSubImagesGenerator
- Parameters:
image
- the image to process- Returns:
- the list of subimages generated
-
-