GPLIB++
ApplyFilter.h
Go to the documentation of this file.
1 #ifndef APPLYFILTER_H_
2 #define APPLYFILTER_H_
3 
4 #include "AdaptiveFilter.h"
5 #include "TimeSeriesComponent.h"
6 #include <boost/shared_ptr.hpp>
7 #include <vector>
8 
9 namespace gplib
10  {
11  /** \addtogroup sigproc Signal processing methods */
12  /* @{ */
13 
14  //! Apply an adaptive filter to a time-series
16  {
17  private:
18  bool showprogress;
19  bool wanthistory;
20  int shift;
21  AdaptiveFilter &Filter;
22  int weightsaveintervall;
23  std::vector<gplib::rvec> WeightHistory;
24  std::vector<TimeSeriesComponent*> InputChannels;
25  std::vector<TimeSeriesComponent*> RefChannels;
26  std::vector<boost::shared_ptr<TimeSeriesComponent> > OutChannels;
27  std::vector<std::vector<double> > EpsValues;
28  public:
29  //! Do we want visual feedback of the progess on the screen, if yes draw a simple progress indicator in text mode
30  void ShowProgress(const bool what)
31  {
32  showprogress = what;
33  }
34  //! Return a matrix with the values of the weights at iterations specified by weightsaveintervall
35  gplib::rmat GetWeightHistory();
36  //! Set the distance between iterations at which the weights are saved
37  void SetWeightSaveIntervall(const int intervall)
38  {
39  weightsaveintervall = intervall;
40  }
41  //! Return the vector of output channels
42  const std::vector<boost::shared_ptr<TimeSeriesComponent> > &GetOutChannels()
43  {
44  return OutChannels;
45  }
46  //! Return the vector of channel approximation errors
47  const std::vector<std::vector<double> > &GetEpsValues()
48  {
49  return EpsValues;
50  }
51  //! Set the shift between the input time series and the reference time series
52  void SetShift(const int theshift)
53  {
54  shift = theshift;
55  }
56  //! Add an input channel to the filter
57  void AddInputChannel(TimeSeriesComponent &Channel);
58  //! Add a reference channel to the filter, some AdaptiveFilter objects require only one reference
60  //! Filter the input channels with the current settings
61  void FilterData();
62  //! The constructor takes the AdaptiveFilter object that determines how the filtering is done, if keephistory is true we store the weights
63  ApplyFilter(AdaptiveFilter &TheFilter, bool keephistory = false);
64  virtual ~ApplyFilter();
65 
66  };
67  /* @} */
68  }
69 #endif /*APPLYFILTER_H_*/
const std::vector< std::vector< double > > & GetEpsValues()
Return the vector of channel approximation errors.
Definition: ApplyFilter.h:47
void AddReferenceChannel(TimeSeriesComponent &Channel)
Add a reference channel to the filter, some AdaptiveFilter objects require only one reference...
Definition: ApplyFilter.cpp:45
Apply an adaptive filter to a time-series.
Definition: ApplyFilter.h:15
gplib::rmat GetWeightHistory()
Return a matrix with the values of the weights at iterations specified by weightsaveintervall.
Definition: ApplyFilter.cpp:23
void ShowProgress(const bool what)
Do we want visual feedback of the progess on the screen, if yes draw a simple progress indicator in t...
Definition: ApplyFilter.h:30
void AddInputChannel(TimeSeriesComponent &Channel)
Add an input channel to the filter.
Definition: ApplyFilter.cpp:36
ApplyFilter(AdaptiveFilter &TheFilter, bool keephistory=false)
The constructor takes the AdaptiveFilter object that determines how the filtering is done...
Definition: ApplyFilter.cpp:8
void SetWeightSaveIntervall(const int intervall)
Set the distance between iterations at which the weights are saved.
Definition: ApplyFilter.h:37
A generic base class for all types of adaptive filters.
TimeSeriesComponent is the base storage class for all types of time series data.
void FilterData()
Filter the input channels with the current settings.
Definition: ApplyFilter.cpp:57
void SetShift(const int theshift)
Set the shift between the input time series and the reference time series.
Definition: ApplyFilter.h:52
const std::vector< boost::shared_ptr< TimeSeriesComponent > > & GetOutChannels()
Return the vector of output channels.
Definition: ApplyFilter.h:42
virtual ~ApplyFilter()
Definition: ApplyFilter.cpp:14