35 #ifndef OPENMS_FILTERING_SMOOTHING_GAUSSFILTER_H
36 #define OPENMS_FILTERING_SMOOTHING_GAUSSFILTER_H
91 template <
typename PeakType>
94 typedef std::vector<double> ContainerT;
98 bool found_signal =
false;
99 Size data_size = spectrum.size();
100 ContainerT mz_in(data_size), int_in(data_size), mz_out(data_size), int_out(data_size);
103 for (
Size p = 0; p < spectrum.size(); ++p)
105 mz_in[p] = spectrum[p].getMZ();
106 int_in[p] = spectrum[p].getIntensity();
110 ContainerT::iterator mz_out_it = mz_out.begin();
111 ContainerT::iterator int_out_it = int_out.begin();
112 found_signal = gauss_algo_.filter(mz_in.begin(), mz_in.end(), int_in.begin(), mz_out_it, int_out_it);
116 if (!found_signal && spectrum.size() >= 3)
118 String error_message =
"Found no signal. The gaussian width is probably smaller than the spacing in your profile data. Try to use a bigger width.";
119 if (spectrum.
getRT() > 0.0)
121 error_message +=
String(
" The error occured in the spectrum with retention time ") + spectrum.
getRT() +
".\n";
123 std::cerr << error_message;
128 ContainerT::iterator mz_it = mz_out.begin();
129 ContainerT::iterator int_it = int_out.begin();
130 for (
Size p = 0; mz_it != mz_out.end(); mz_it++, int_it++, p++)
132 spectrum[p].setIntensity(*int_it);
133 spectrum[p].setMZ(*mz_it);
138 template <
typename PeakType>
142 if (param_.getValue(
"use_ppm_tolerance").toBool())
145 "GaussFilter: Cannot use ppm tolerance on chromatograms");
151 filter_spectra.push_back(*it);
153 filter(filter_spectra);
154 chromatogram.
clear(
false);
157 chromatogram.push_back(*it);
167 template <
typename PeakType>
172 for (
Size i = 0; i < map.
size(); ++i)
175 setProgress(++progress);
180 setProgress(++progress);
193 virtual void updateMembers_();
A more convenient string class.
Definition: String.h:57
double spacing_
The spacing of the pre-tabulated kernel coefficients.
Definition: GaussFilter.h:190
Size size() const
Definition: MSExperiment.h:117
The representation of a chromatogram.
Definition: MSChromatogram.h:52
void filter(MSChromatogram< PeakType > &chromatogram)
Definition: GaussFilter.h:139
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
A method or algorithm argument contains illegal values.
Definition: Exception.h:634
MSChromatogram< ChromatogramPeakType > & getChromatogram(Size id)
returns a single chromatogram
Definition: MSExperiment.h:796
GaussFilterAlgorithm gauss_algo_
Definition: GaussFilter.h:187
double getRT() const
Definition: MSSpectrum.h:243
This class represents a Gaussian lowpass-filter which works on uniform as well as on non-uniform prof...
Definition: GaussFilterAlgorithm.h:70
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:69
This class represents a Gaussian lowpass-filter which works on uniform as well as on non-uniform prof...
Definition: GaussFilter.h:73
void setType(SpectrumType type)
sets the spectrum type
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:55
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
void filterExperiment(MSExperiment< PeakType > &map)
Smoothes an MSExperiment containing profile data.
Definition: GaussFilter.h:168
void clear(bool clear_meta_data)
Clears all data and meta data.
Definition: MSChromatogram.h:587
void filter(MSSpectrum< PeakType > &spectrum)
Smoothes an MSSpectrum containing profile data.
Definition: GaussFilter.h:92
const std::vector< MSChromatogram< ChromatogramPeakType > > & getChromatograms() const
returns the chromatogram list
Definition: MSExperiment.h:788