ApplyFilter.h

Go to the documentation of this file.
00001 #ifndef APPLYFILTER_H_
00002 #define APPLYFILTER_H_
00003 
00004 #include "AdaptiveFilter.h"
00005 #include "TimeSeriesComponent.h"
00006 #include <boost/shared_ptr.hpp>
00007 #include <vector>
00008 
00009 namespace gplib
00010   {
00011     /** \addtogroup sigproc Signal processing methods */
00012     /* @{ */
00013 
00014     //! Apply an adaptive filter to a time-series
00015     class ApplyFilter
00016       {
00017     private:
00018       bool showprogress;
00019       bool wanthistory;
00020       int shift;
00021       AdaptiveFilter &Filter;
00022       int weightsaveintervall;
00023       std::vector<gplib::rvec> WeightHistory;
00024       std::vector<TimeSeriesComponent*> InputChannels;
00025       std::vector<TimeSeriesComponent*> RefChannels;
00026       std::vector<boost::shared_ptr<TimeSeriesComponent> > OutChannels;
00027       std::vector<std::vector<double> > EpsValues;
00028     public:
00029       //! Do we want visual feedback of the progess on the screen, if yes draw a simple progress indicator in text mode
00030       void ShowProgress(const bool what)
00031         {
00032           showprogress = what;
00033         }
00034       //! Return a matrix with the values of the weights at iterations specified by weightsaveintervall
00035       gplib::rmat GetWeightHistory();
00036       //! Set the distance between iterations at which the weights are saved
00037       void SetWeightSaveIntervall(const int intervall)
00038         {
00039           weightsaveintervall = intervall;
00040         }
00041       //! Return the vector of output channels
00042       const std::vector<boost::shared_ptr<TimeSeriesComponent> > &GetOutChannels()
00043         {
00044           return OutChannels;
00045         }
00046       //! Return the vector of channel approximation errors
00047       const std::vector<std::vector<double> > &GetEpsValues()
00048         {
00049           return EpsValues;
00050         }
00051       //! Set the shift between the input time series and the reference time series
00052       void SetShift(const int theshift)
00053         {
00054           shift = theshift;
00055         }
00056       //! Add an input channel to the filter
00057       void AddInputChannel(TimeSeriesComponent &Channel);
00058       //! Add a reference channel to the filter, some AdaptiveFilter objects require only one reference
00059       void AddReferenceChannel(TimeSeriesComponent &Channel);
00060       //! Filter the input channels with the current settings
00061       void FilterData();
00062       //! The constructor takes the AdaptiveFilter object that determines how the filtering is done, if keephistory is true we store the weights
00063       ApplyFilter(AdaptiveFilter &TheFilter, bool keephistory = false);
00064       virtual ~ApplyFilter();
00065 
00066       };
00067   /* @} */
00068   }
00069 #endif /*APPLYFILTER_H_*/

Generated on Tue May 4 16:52:14 2010 for GPLIB++ by  doxygen 1.5.8