94 typedef std::vector<double> ContainerT;
98 bool found_signal =
false;
99 const 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] =
static_cast<double>(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 occurred in the spectrum with retention time ") + spectrum.
getRT() +
".";
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);
140 typedef std::vector<double> ContainerT;
142 if (param_.getValue(
"use_ppm_tolerance").toBool())
145 "GaussFilter: Cannot use ppm tolerance on chromatograms");
148 bool found_signal =
false;
149 const Size data_size = chromatogram.size();
150 ContainerT rt_in(data_size), int_in(data_size), rt_out(data_size), int_out(data_size);
153 for (
Size p = 0; p < chromatogram.size(); ++p)
155 rt_in[p] = chromatogram[p].getRT();
156 int_in[p] = chromatogram[p].getIntensity();
160 ContainerT::iterator mz_out_it = rt_out.begin();
161 ContainerT::iterator int_out_it = int_out.begin();
162 found_signal = gauss_algo_.filter(rt_in.begin(), rt_in.end(), int_in.begin(), mz_out_it, int_out_it);
166 if (!found_signal && chromatogram.size() >= 3)
168 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.";
169 if (chromatogram.
getMZ() > 0.0)
171 error_message +=
String(
" The error occurred in the chromatogram with m/z time ") + chromatogram.
getMZ() +
".";
178 ContainerT::iterator mz_it = rt_out.begin();
179 ContainerT::iterator int_it = int_out.begin();
180 for (
Size p = 0; mz_it != rt_out.end(); mz_it++, int_it++, p++)
182 chromatogram[p].setIntensity(*int_it);
183 chromatogram[p].setMZ(*mz_it);
197 for (
Size i = 0; i < map.
size(); ++i)
200 setProgress(++progress);
205 setProgress(++progress);
218 void updateMembers_()
override;
const std::vector< MSChromatogram > & getChromatograms() const
returns the chromatogram list
A more convenient string class.
Definition: String.h:57
double spacing_
The spacing of the pre-tabulated kernel coefficients.
Definition: GaussFilter.h:215
The representation of a chromatogram.
Definition: MSChromatogram.h:54
profile data
Definition: SpectrumSettings.h:74
double getMZ() const
returns the mz of the product entry, makes sense especially for MRM scans
Size size() const
Definition: MSExperiment.h:127
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
#define LOG_ERROR
Macro to be used if non-fatal error are reported (processing continues)
Definition: LogStream.h:446
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
A method or algorithm argument contains illegal values.
Definition: Exception.h:648
GaussFilterAlgorithm gauss_algo_
Definition: GaussFilter.h:212
void filter(MSChromatogram &chromatogram)
Definition: GaussFilter.h:138
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:77
This class represents a Gaussian lowpass-filter which works on uniform as well as on non-uniform prof...
Definition: GaussFilter.h:74
void filterExperiment(PeakMap &map)
Smoothes an MSExperiment containing profile data.
Definition: GaussFilter.h:193
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:127
Base class for all classes that want to report their progress.
Definition: ProgressLogger.h:54
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91
void filter(MSSpectrum &spectrum)
Smoothes an MSSpectrum containing profile data.
Definition: GaussFilter.h:92
MSChromatogram & getChromatogram(Size id)
returns a single chromatogram