adams.data.filter
Class Centroid

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.data.filter.AbstractFilter<Heatmap>
              extended by adams.data.filter.Centroid
All Implemented Interfaces:
CleanUpHandler, Debuggable, Destroyable, OptionHandler, ShallowCopySupporter<AbstractFilter>, SizeOfHandler, TechnicalInformationHandler, Serializable, Comparable

public class Centroid
extends AbstractFilter<Heatmap>
implements TechnicalInformationHandler

Computes the centroid of a heatmap and adds this to the heatmap's report.
It is possible to perform multiple iterations and each time with a shrunken heatmap. This is useful if the centroid cannot be computed reliably the first time.
For more information on the centroid calculation, see:
WikiPedia. Image moment.

BibTeX:

 @misc{missing_id,
    author = {WikiPedia},
    title = {Image moment},
    HTTP = {http://en.wikipedia.org/wiki/Image_moment}
 }
 

Valid options are:

-D <int> (property: debugLevel)
    The greater the number the more additional info the scheme may output to
    the console (0 = off).
    default: 0
    minimum: 0
 
-num-iterations <int> (property: numIterations)
    The number of iterations to perform for finding the centroid.
    default: 1
    minimum: 1
 
-shrink-factor <double> (property: shrinkFactor)
    The factor to shrink the heatmap with after each iteration.
    default: 0.75
    minimum: 0.0010
    maximum: 0.999
 

Version:
$Revision: 6884 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class adams.data.filter.AbstractFilter
AbstractFilter.FilterJob<T extends DataContainer>
 
Field Summary
static String CENTROID_X
          the X of the centroid.
static String CENTROID_Y
          the Y of the centroid.
protected  int m_NumIterations
          the number of iterations to peform.
protected  double m_ShrinkFactor
          the factor to shrink the heatmap after each iteration.
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
Centroid()
           
 
Method Summary
 void defineOptions()
          Adds options to the internal list of options.
protected  Heatmap findCentroid(Heatmap data)
          Finds the centroid.
 int getNumIterations()
          Returns the number of iterations for finding the centroid.
 double getShrinkFactor()
          Returns the factor to shrink the heatmap with after each iteration
 TechnicalInformation getTechnicalInformation()
          Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
 String globalInfo()
          Returns a string describing the object.
 String numIterationsTipText()
          Returns the tip text for this property.
protected  Heatmap processData(Heatmap data)
          Performs the actual filtering.
 void setNumIterations(int value)
          Sets the number of iterations for finding the centroid.
 void setShrinkFactor(double value)
          Sets the factor to shrink the heatmap with after each iteration.
 String shrinkFactorTipText()
          Returns the tip text for this property.
 
Methods inherited from class adams.data.filter.AbstractFilter
checkData, cleanUp, compareTo, destroy, equals, filter, filter, filter, filter, filter, forCommandLine, forName, getFilters, reset, shallowCopy, shallowCopy
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debug, debugLevelTipText, finishInit, getDebugLevel, getOptionManager, initialize, isDebugOn, newOptionManager, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut, sizeOf
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

CENTROID_X

public static final String CENTROID_X
the X of the centroid.

See Also:
Constant Field Values

CENTROID_Y

public static final String CENTROID_Y
the Y of the centroid.

See Also:
Constant Field Values

m_NumIterations

protected int m_NumIterations
the number of iterations to peform.


m_ShrinkFactor

protected double m_ShrinkFactor
the factor to shrink the heatmap after each iteration.

Constructor Detail

Centroid

public Centroid()
Method Detail

globalInfo

public String globalInfo()
Returns a string describing the object.

Specified by:
globalInfo in class AbstractOptionHandler
Returns:
a description suitable for displaying in the gui

getTechnicalInformation

public TechnicalInformation getTechnicalInformation()
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.

Specified by:
getTechnicalInformation in interface TechnicalInformationHandler
Returns:
the technical information about this class

defineOptions

public void defineOptions()
Adds options to the internal list of options.

Specified by:
defineOptions in interface OptionHandler
Overrides:
defineOptions in class AbstractOptionHandler

setNumIterations

public void setNumIterations(int value)
Sets the number of iterations for finding the centroid.

Parameters:
value - the number of iterations

getNumIterations

public int getNumIterations()
Returns the number of iterations for finding the centroid.

Returns:
the number of iterations

numIterationsTipText

public String numIterationsTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setShrinkFactor

public void setShrinkFactor(double value)
Sets the factor to shrink the heatmap with after each iteration.

Parameters:
value - the factor

getShrinkFactor

public double getShrinkFactor()
Returns the factor to shrink the heatmap with after each iteration

Returns:
the factor

shrinkFactorTipText

public String shrinkFactorTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

findCentroid

protected Heatmap findCentroid(Heatmap data)
Finds the centroid.

Parameters:
data - the data to find the centroid in
Returns:
the data with the updated report

processData

protected Heatmap processData(Heatmap data)
Performs the actual filtering.

Specified by:
processData in class AbstractFilter<Heatmap>
Parameters:
data - the data to filter
Returns:
the filtered data


Copyright © 2013 University of Waikato, Hamilton, NZ. All Rights Reserved.