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 index (0-based, deprecated)
- Region-Index: for the region index (0-based)
- Region-Label: for the region label
- 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 considered 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 StringKEY_COORDINATESthe key for the coordinates.static StringKEY_REGIONthe key for the region (deprecated).static StringKEY_REGION_INDEXthe key for the region (index, 0-based).static StringKEY_REGION_LABELthe key for the region (label).protected Stringm_LabelKeythe meta-data key for the label.protected booleanm_OneBasedCoordswhether the regions are 1-based or 0-based.protected LabeledRectangle[]m_Regionsthe 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 voiddefineOptions()Adds options to the internal list of options.protected List<BufferedImageContainer>doProcess(BufferedImageContainer image)Performs the actual generation of the subimages.StringgetLabelKey()Returns the key for the label in the meta-data.booleangetOneBasedCoords()Returns whether the coordinates start at 1 or 0.StringgetQuickInfo()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).StringglobalInfo()Returns a string describing the object.StringlabelKeyTipText()Returns the tip text for this property.StringoneBasedCoordsTipText()Returns the tip text for this property.StringregionsTipText()Returns the tip text for this property.voidsetLabelKey(String value)Sets the key for the label in the meta-data.voidsetOneBasedCoords(boolean value)Sets whether the coordinates start at 1 or 0.voidsetRegions(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 (deprecated).- See Also:
- Constant Field Values
-
KEY_REGION_INDEX
public static final String KEY_REGION_INDEX
the key for the region (index, 0-based).- See Also:
- Constant Field Values
-
KEY_REGION_LABEL
public static final String KEY_REGION_LABEL
the key for the region (label).- 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:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin 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:
getQuickInfoin interfaceQuickInfoSupporter- Overrides:
getQuickInfoin 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:
doProcessin classAbstractSubImagesGenerator- Parameters:
image- the image to process- Returns:
- the list of subimages generated
-
-