35 #ifndef OPENMS_FILTERING_SMOOTHING_SAVITZKYGOLAYFILTER_H
36 #define OPENMS_FILTERING_SMOOTHING_SAVITZKYGOLAYFILTER_H
42 #include <gsl/gsl_vector.h>
43 #include <gsl/gsl_matrix.h>
44 #include <gsl/gsl_linalg.h>
45 #include <gsl/gsl_permutation.h>
46 #include <gsl/gsl_pow_int.h>
121 template <
typename PeakType>
139 int mid = (frame_size_ / 2);
147 for (i = 0; i <= mid; ++i)
149 it_forward = (first - i);
152 for (j = 0; j < frame_size_; ++j)
154 help += it_forward->getIntensity() * coeffs_[(i + 1) * frame_size_ - 1 - j];
159 out_it->setPosition(first->getPosition());
160 out_it->setIntensity(std::max(0.0, help));
166 it_help = (last - mid);
167 while (first != it_help)
169 it_forward = (first - mid);
172 for (j = 0; j < frame_size_; ++j)
174 help += it_forward->getIntensity() * coeffs_[mid * frame_size_ + j];
179 out_it->setPosition(first->getPosition());
180 out_it->setIntensity(std::max(0.0, help));
186 for (i = (mid - 1); i >= 0; --i)
188 it_forward = (first - (frame_size_ - i - 1));
191 for (j = 0; j < frame_size_; ++j)
193 help += it_forward->getIntensity() * coeffs_[i * frame_size_ + j];
197 out_it->setPosition(first->getPosition());
198 out_it->setIntensity(std::max(0.0, help));
206 template <
typename PeakType>
213 filter_spectra.push_back(*it);
215 filter(filter_spectra);
216 chromatogram.
clear(
false);
219 chromatogram.push_back(*it);
227 template <
typename PeakType>
232 for (
Size i = 0; i < map.
size(); ++i)
235 setProgress(++progress);
240 setProgress(++progress);
253 virtual void updateMembers_();
258 #endif // OPENMS_FILTERING_SMOOTHING_SAVITZKYGOLAYFILTER_H
Size size() const
Definition: MSExperiment.h:117
The representation of a chromatogram.
Definition: MSChromatogram.h:53
unsigned int UInt
Unsigned integer type.
Definition: Types.h:92
UInt frame_size_
UInt of the filter kernel (number of pre-tabulated coefficients)
Definition: SavitzkyGolayFilter.h:249
void filter(MSSpectrum< PeakType > &spectrum)
Removed the noise from an MSSpectrum containing profile data.
Definition: SavitzkyGolayFilter.h:122
UInt order_
The order of the smoothing polynomial.
Definition: SavitzkyGolayFilter.h:251
Computes the Savitzky-Golay filter coefficients using QR decomposition.
Definition: SavitzkyGolayFilter.h:107
MSChromatogram< ChromatogramPeakType > & getChromatogram(Size id)
returns a single chromatogram
Definition: MSExperiment.h:774
void filter(MSChromatogram< PeakType > &chromatogram)
Definition: SavitzkyGolayFilter.h:207
Representation of a mass spectrometry experiment.
Definition: MSExperiment.h:68
void filterExperiment(MSExperiment< PeakType > &map)
Removed the noise from an MSExperiment containing profile data.
Definition: SavitzkyGolayFilter.h:228
std::vector< DoubleReal > coeffs_
Coefficients.
Definition: SavitzkyGolayFilter.h:247
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:144
Base class for all classes that want to report their progess.
Definition: ProgressLogger.h:56
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:90
void clear(bool clear_meta_data)
Clears all data and meta data.
Definition: MSChromatogram.h:564
const std::vector< MSChromatogram< ChromatogramPeakType > > & getChromatograms() const
returns the chromatogram list
Definition: MSExperiment.h:768