adams.data.filter
Class CropToCentroid

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

public class CropToCentroid
extends AbstractPreFilter<Heatmap>

Generates a cropped heatmap centered around the centroid calculated on the pre-filtered data.

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
 
-filter <adams.data.filter.AbstractFilter> (property: filter)
    Pre-filters the data, .
    default: adams.data.filter.Threshold
 
-height <int> (property: height)
    The height of the cropped region.
    default: 240
    minimum: 1
 
-width <int> (property: width)
    The width of the cropped region.
    default: 320
    minimum: 1
 
-centroid <adams.data.filter.Centroid> (property: centroid)
    The centroid filter to use.
    default: adams.data.filter.Centroid
 

Version:
$Revision: 6027 $
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 CROP_BOTTOM
          the bottom coordinate of the crop in the original heatmap.
static String CROP_LEFT
          the left coordinate of the crop in the original heatmap.
static String CROP_RIGHT
          the right coordinate of the crop in the original heatmap.
static String CROP_TOP
          the right coordinate of the crop in the original heatmap.
protected  Centroid m_Centroid
          the centroid filter.
protected  int m_Height
          the height of the crop region around the centroid.
protected  int m_Width
          the width of the crop region around the centroid.
 
Fields inherited from class adams.data.filter.AbstractPreFilter
m_Filter
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
CropToCentroid()
           
 
Method Summary
 String centroidTipText()
          Returns the tip text for this property.
static Heatmap crop(Heatmap original, int centroidY, int centroidX, int height, int width)
          Crops the heatmap around the centroid stored in the heatmap's report.
 void defineOptions()
          Adds options to the internal list of options.
 Centroid getCentroid()
          Returns the centroid filter.
protected  AbstractFilter getDefaultFilter()
          Returns the default pre-filter to use.
 int getHeight()
          Returns the height start the submap from.
 int getWidth()
          Returns the width start the submap from.
 String globalInfo()
          Returns a string describing the object.
 String heightTipText()
          Returns the tip text for this property.
protected  Heatmap processData(Heatmap filtered, Heatmap original)
          Performs the actual filtering, using the pre-filtered data to manipulate the original data.
 void setCentroid(Centroid value)
          Sets the centroid filter.
 void setHeight(int value)
          Sets the height of the submap.
 void setWidth(int value)
          Sets the width of the submap.
 String widthTipText()
          Returns the tip text for this property.
 
Methods inherited from class adams.data.filter.AbstractPreFilter
filterTipText, getFilter, processData, setFilter
 
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

CROP_LEFT

public static final String CROP_LEFT
the left coordinate of the crop in the original heatmap.

See Also:
Constant Field Values

CROP_TOP

public static final String CROP_TOP
the right coordinate of the crop in the original heatmap.

See Also:
Constant Field Values

CROP_RIGHT

public static final String CROP_RIGHT
the right coordinate of the crop in the original heatmap.

See Also:
Constant Field Values

CROP_BOTTOM

public static final String CROP_BOTTOM
the bottom coordinate of the crop in the original heatmap.

See Also:
Constant Field Values

m_Height

protected int m_Height
the height of the crop region around the centroid.


m_Width

protected int m_Width
the width of the crop region around the centroid.


m_Centroid

protected Centroid m_Centroid
the centroid filter.

Constructor Detail

CropToCentroid

public CropToCentroid()
Method Detail

globalInfo

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

Overrides:
globalInfo in class AbstractPreFilter<Heatmap>
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 interface OptionHandler
Overrides:
defineOptions in class AbstractPreFilter<Heatmap>

getDefaultFilter

protected AbstractFilter getDefaultFilter()
Returns the default pre-filter to use.

Overrides:
getDefaultFilter in class AbstractPreFilter<Heatmap>
Returns:
the default

setHeight

public void setHeight(int value)
Sets the height of the submap.

Parameters:
value - the height

getHeight

public int getHeight()
Returns the height start the submap from.

Returns:
the height

heightTipText

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

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

setWidth

public void setWidth(int value)
Sets the width of the submap.

Parameters:
value - the width

getWidth

public int getWidth()
Returns the width start the submap from.

Returns:
the width

widthTipText

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

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

setCentroid

public void setCentroid(Centroid value)
Sets the centroid filter.

Parameters:
value - the filter

getCentroid

public Centroid getCentroid()
Returns the centroid filter.

Returns:
the filter

centroidTipText

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

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

processData

protected Heatmap processData(Heatmap filtered,
                              Heatmap original)
Performs the actual filtering, using the pre-filtered data to manipulate the original data.

Specified by:
processData in class AbstractPreFilter<Heatmap>
Parameters:
filtered - the pref-filtered data
original - the original input data
Returns:
the final data

crop

public static Heatmap crop(Heatmap original,
                           int centroidY,
                           int centroidX,
                           int height,
                           int width)
Crops the heatmap around the centroid stored in the heatmap's report.

Parameters:
original - the heatmap, with the centroid information
centroidY - the Y position of the centroid
centroidX - the X position of the centroid
height - the new height of the heatmap
width - the new width of the heatmap
Returns:
the cropped heatmap


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