Filter.h

Go to the documentation of this file.
00001 /**<!-------------------------------------------------------------------->
00002    @class  Filter
00003    @author Travis Fischer (fisch0920@gmail.com)
00004    @author Matthew Jacobs (jacobs.mh@gmail.com)
00005    @date   Fall 2008
00006    
00007    @brief
00008       Templated representation of a symmetric N-dimensional filter function 
00009    in T^N centered at zero with known max support (where the function is zero 
00010    outside of that radius of that support; ie, support is equivalent to 
00011    diameter)
00012    <!-------------------------------------------------------------------->**/
00013 
00014 #ifndef FILTER_H_
00015 #define FILTER_H_
00016 
00017 #include <utils/PropertyMap.h>
00018 #include <common/math/Vector.h>
00019 
00020 template <unsigned N = 2, typename T = real_t>
00021 class Filter : public PropertyMap {
00022    public:
00023       ///@name Constructors
00024       //@{-----------------------------------------------------------------
00025       
00026       inline   Filter(real_t support = 2)
00027          : m_support(support)
00028       { }
00029       
00030       virtual ~Filter()
00031       { }
00032       
00033       
00034       //@}-----------------------------------------------------------------
00035       ///@name Initialization
00036       //@{-----------------------------------------------------------------
00037       
00038       /**
00039        * @brief
00040        *    Performs any initialization which may be necessary before filter  
00041        * evaluation
00042        * 
00043        * @note
00044        *    Default implementation initializes the filter support based on 
00045        * its PropertyMap
00046        */
00047       virtual void init() {
00048          m_support = getValue<real_t>("support", m_support);
00049       }
00050       
00051       
00052       //@}-----------------------------------------------------------------
00053       ///@name Main usage interface
00054       //@{-----------------------------------------------------------------
00055       
00056       /**
00057        * @returns the value of this filter function evaluated at the given 
00058        *    point
00059        */
00060       virtual T evaluate(const Vector2 &pt) = 0;
00061       
00062       
00063       //@}-----------------------------------------------------------------
00064       ///@name Accessors / Mutators
00065       //@{-----------------------------------------------------------------
00066       
00067       /// @returns the size of the support of this filter (symmetric)
00068       inline real_t getSupport() const {
00069          return m_support;
00070       }
00071       
00072       
00073       //@}-----------------------------------------------------------------
00074       
00075    protected:
00076       real_t m_support;
00077 };
00078 
00079 typedef Filter<2, real_t> Filter2D;
00080 typedef Filter<1, real_t> Filter1D;
00081 
00082 #endif // FILTER_H_
00083 

Generated on 28 Feb 2009 for Milton by doxygen 1.5.6