MedianSlider.h
Classes
- MedianSlider -- Class to compute sliding median (full description)
Interface
- Public Members
- MedianSlider ()
- MedianSlider ( int halfwin )
- MedianSlider ( const MedianSlider &other )
- ~MedianSlider ()
- MedianSlider & operator = ( const MedianSlider &other )
- void cleanup ()
- Float add ( Float d,Bool flag=False )
- Float add ()
- Float next ( uInt n=1 )
- Float add ( const Vector<Float> &d,const Vector<Bool> &flag )
- Float add ( const Vector<Float> &d )
- Int nval ()
- Float median ()
- Float prevVal ( uInt n,Bool &flag )
- Float midpoint ( Bool &flag )
- Float midpoint ()
- Float diff ( Bool &flag )
- Float diff ()
- static size_t objsize ( int halfwin )
- Bool assure ()
Review Status
- Date Reviewed:
- yyyy/mm/dd
Synopsis
MedianSlider is a class for efficient computing of sliding medians.
Example
Motivation
Flagging Agents make extended use of sliding medians.
To Do
- think about a 2D sliding median
Member Description
MedianSlider ( const MedianSlider &other )
MedianSlider & operator = ( const MedianSlider &other )
Float add ( Float d,Bool flag=False )
Adds a datum to the slider. Once the window is full, newer values will
push out older values. Returns the new median value.
If flag is set to true, adds a "flagged" datum, one which takes
up space in the window but is skipped during median computations.
Float add ()
Adds a flagged datum
Float next ( uInt n=1 )
Adds N flagged datums
Float add ( const Vector<Float> &d,const Vector<Bool> &flag )
Adds several datums at once (with corresponding flags)
Float add ( const Vector<Float> &d )
Adds several non-flagged datums at once
Returns the number of values currently in the window. This is less
than the window width initially.
Int size ();
Returns the number of non-flagged values in window
Returns the current median value
Float prevVal ( uInt n,Bool &flag )
Returns a previous value (from n steps ago) from the sliding window
Float midpoint ( Bool &flag )
Returns value from midpoint (center) of window, possibly with flag
Float diff ( Bool &flag )
Returns the difference between the current median and the value
at window center. Optionally, also returns flag of median center
Float diff ()
static size_t objsize ( int halfwin )
returns total memory usage (in bytes) for a given halfwin size
For testing purposes only: verifies current value of median.
Throws an exception if it fails.