35 #ifndef OPENMS_FILTERING_SMOOTHING_GAUSSFILTER_H 36 #define OPENMS_FILTERING_SMOOTHING_GAUSSFILTER_H 95 typedef std::vector<double> ContainerT;
99 bool found_signal =
false;
100 const Size data_size = spectrum.size();
101 ContainerT mz_in(data_size), int_in(data_size), mz_out(data_size), int_out(data_size);
104 for (
Size p = 0; p < spectrum.size(); ++p)
106 mz_in[p] = spectrum[p].getMZ();
107 int_in[p] =
static_cast<double>(spectrum[p].getIntensity());
111 ContainerT::iterator mz_out_it = mz_out.begin();
112 ContainerT::iterator int_out_it = int_out.begin();
113 found_signal = gauss_algo_.filter(mz_in.begin(), mz_in.end(), int_in.begin(), mz_out_it, int_out_it);
117 if (!found_signal && spectrum.size() >= 3)
119 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.";
120 if (spectrum.
getRT() > 0.0)
122 error_message +=
String(
" The error occurred in the spectrum with retention time ") + spectrum.
getRT() +
".";
129 ContainerT::iterator mz_it = mz_out.begin();
130 ContainerT::iterator int_it = int_out.begin();
131 for (
Size p = 0; mz_it != mz_out.end(); mz_it++, int_it++, p++)
133 spectrum[p].setIntensity(*int_it);
134 spectrum[p].setMZ(*mz_it);
141 typedef std::vector<double> ContainerT;
143 if (param_.getValue(
"use_ppm_tolerance").toBool())
146 "GaussFilter: Cannot use ppm tolerance on chromatograms");
149 bool found_signal =
false;
150 const Size data_size = chromatogram.size();
151 ContainerT rt_in(data_size), int_in(data_size), rt_out(data_size), int_out(data_size);
154 for (
Size p = 0; p < chromatogram.size(); ++p)
156 rt_in[p] = chromatogram[p].getRT();
157 int_in[p] = chromatogram[p].getIntensity();
161 ContainerT::iterator mz_out_it = rt_out.begin();
162 ContainerT::iterator int_out_it = int_out.begin();
163 found_signal = gauss_algo_.filter(rt_in.begin(), rt_in.end(), int_in.begin(), mz_out_it, int_out_it);
167 if (!found_signal && chromatogram.size() >= 3)
169 String error_message =
"Found no signal. The Gaussian width is probably smaller than the spacing in your chromatogram data. Try to use a bigger width.";
170 if (chromatogram.
getMZ() > 0.0)
172 error_message +=
String(
" The error occurred in the chromatogram with m/z time ") + chromatogram.
getMZ() +
".";
179 ContainerT::iterator mz_it = rt_out.begin();
180 ContainerT::iterator int_it = int_out.begin();
181 for (
Size p = 0; mz_it != rt_out.end(); mz_it++, int_it++, p++)
183 chromatogram[p].setIntensity(*int_it);
184 chromatogram[p].setMZ(*mz_it);
198 for (
Size i = 0; i < map.
size(); ++i)
201 setProgress(++progress);
206 setProgress(++progress);
219 virtual void updateMembers_();
const std::vector< MSChromatogram > & getChromatograms() const
returns the chromatogram list
Definition: MSExperiment.h:861
A more convenient string class.
Definition: String.h:57
double spacing_
The spacing of the pre-tabulated kernel coefficients.
Definition: GaussFilter.h:216
The representation of a chromatogram.
Definition: MSChromatogram.h:55
Raw data (also called profile data)
Definition: SpectrumSettings.h:75
double getMZ() const
returns the mz of the product entry, makes sense especially for MRM scans
Size size() const
Definition: MSExperiment.h:132
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
#define LOG_ERROR
Macro to be used if non-fatal error are reported (processing continues)
Definition: LogStream.h:447
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
A method or algorithm argument contains illegal values.
Definition: Exception.h:649
GaussFilterAlgorithm gauss_algo_
Definition: GaussFilter.h:213
void filter(MSChromatogram &chromatogram)
Definition: GaussFilter.h:139
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:82
This class represents a Gaussian lowpass-filter which works on uniform as well as on non-uniform prof...
Definition: GaussFilter.h:75
void filterExperiment(PeakMap &map)
Smoothes an MSExperiment containing profile data.
Definition: GaussFilter.h:194
void setType(SpectrumType type)
sets the spectrum type
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128
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 filter(MSSpectrum &spectrum)
Smoothes an MSSpectrum containing profile data.
Definition: GaussFilter.h:93
MSChromatogram & getChromatogram(Size id)
returns a single chromatogram
Definition: MSExperiment.h:875