00001 #ifndef APPLYFILTER_H_ 00002 #define APPLYFILTER_H_ 00003 00004 #include "AdaptiveFilter.h" 00005 #include "TimeSeriesComponent.h" 00006 #include "CFatalException.h" 00007 #include <boost/shared_ptr.hpp> 00008 #include <vector> 00009 00010 /** \addtogroup sigproc Signal processing methods */ 00011 /* @{ */ 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){showprogress = what;} 00031 //! Return a matrix with the values of the weights at iterations specified by weightsaveintervall 00032 gplib::rmat GetWeightHistory(); 00033 //! Set the distance between iterations at which the weights are saved 00034 void SetWeightSaveIntervall(const int intervall){weightsaveintervall = intervall;} 00035 //! Return the vector of output channels 00036 const std::vector<boost::shared_ptr<TimeSeriesComponent> > &GetOutChannels(){return OutChannels;} 00037 //! Return the vector of channel approximation errors 00038 const std::vector< std::vector<double> > &GetEpsValues(){return EpsValues;} 00039 //! Set the shift between the input time series and the reference time series 00040 void SetShift(const int theshift){shift = theshift;} 00041 //! Add an input channel to the filter 00042 void AddInputChannel(TimeSeriesComponent &Channel); 00043 //! Add a reference channel to the filter, some AdaptiveFilter objects require only one reference 00044 void AddReferenceChannel(TimeSeriesComponent &Channel); 00045 //! Filter the input channels with the current settings 00046 void FilterData(); 00047 //! The constructor takes the AdaptiveFilter object that determines how the filtering is done, if keephistory is true we store the weights 00048 ApplyFilter(AdaptiveFilter &TheFilter, bool keephistory = false); 00049 virtual ~ApplyFilter(); 00050 00051 }; 00052 /* @} */ 00053 #endif /*APPLYFILTER_H_*/
1.5.5