ProteoWizard
SavitzkyGolaySmoother.hpp
Go to the documentation of this file.
1 //
2 // $Id: SavitzkyGolaySmoother.hpp 1807 2010-02-12 16:32:36Z chambm $
3 //
4 //
5 // Original author: Matt Chambers <matt.chambers <a.t> vanderbilt.edu>
6 //
7 // Copyright 2008 Vanderbilt University - Nashville, TN 37232
8 //
9 // Licensed under the Apache License, Version 2.0 (the "License");
10 // you may not use this file except in compliance with the License.
11 // You may obtain a copy of the License at
12 //
13 // http://www.apache.org/licenses/LICENSE-2.0
14 //
15 // Unless required by applicable law or agreed to in writing, software
16 // distributed under the License is distributed on an "AS IS" BASIS,
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 // See the License for the specific language governing permissions and
19 // limitations under the License.
20 //
21 
22 
23 #ifndef _SAVITZKYGOLAYSMOOTHER_HPP_
24 #define _SAVITZKYGOLAYSMOOTHER_HPP_
25 
26 
27 #include "Smoother.hpp"
28 #include <vector>
29 #include <boost/shared_ptr.hpp>
30 
31 
32 namespace pwiz {
33 namespace analysis {
34 
35 
36 struct PWIZ_API_DECL SavitzkyGolaySmoother : public Smoother
37 {
38  SavitzkyGolaySmoother(int polynomialOrder, int windowSize);
39  ~SavitzkyGolaySmoother();
40 
41  /// smooth y values to existing vectors using Savitzky-Golay algorithm;
42  /// preconditions:
43  /// - samples within the window must be (approximately) equally spaced
44  virtual void smooth(const std::vector<double>& x, const std::vector<double>& y,
45  std::vector<double>& xSmoothed, std::vector<double>& ySmoothed);
46 
47  /// smooth y values and copy back to the input vectors using Savitzky-Golay algorithm;
48  /// preconditions:
49  /// - samples within the window must be (approximately) equally spaced
50  virtual void smooth_copy(std::vector<double>& x, std::vector<double>& y);
51 
52  private:
53  struct Impl;
54  boost::shared_ptr<Impl> impl_;
55 };
56 
57 
58 } // namespace analysis
59 } // namespace pwiz
60 
61 #endif // _SAVITZKYGOLAYSMOOTHER_HPP_