35 #ifndef OPENMS_FILTERING_TRANSFORMERS_BERNNORM_H
36 #define OPENMS_FILTERING_TRANSFORMERS_BERNNORM_H
84 template <
typename SpectrumType>
87 typedef typename SpectrumType::Iterator Iterator;
88 typedef typename SpectrumType::ConstIterator ConstIterator;
92 th_ = (
DoubleReal)param_.getValue(
"threshold");
94 spectrum.sortByPosition();
98 std::map<double, Size> peakranks;
99 for (ConstIterator it = spectrum.begin(); it != spectrum.end(); ++it)
101 peakranks[it->getIntensity()] = 0;
102 if (it->getIntensity() > maxint)
104 maxint = it->getIntensity();
108 for (std::map<double, Size>::reverse_iterator mit = peakranks.rbegin(); mit != peakranks.rend(); ++mit)
110 mit->second = ++rank;
115 for (
SignedSize i = spectrum.size() - 1; i >= 0; --i)
117 if (spectrum[i].getIntensity() > maxint * th_)
119 maxmz = spectrum[i].getMZ();
125 for (Iterator it = spectrum.begin(); it != spectrum.end(); )
127 double newint = c1_ - (c2_ / maxmz) * peakranks[it->getIntensity()];
130 it = spectrum.erase(it);
134 it->setIntensity(newint);
143 void filterPeakMap(
PeakMap & exp);
157 #endif //OPENMS_FILTERING_TRANSFORMERS_BERNNORM_H
DoubleReal th_
Definition: BernNorm.h:149
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:151
DoubleReal c2_
Definition: BernNorm.h:148
BernNorm scales the peaks by ranking them and then scaling them according to rank.
Definition: BernNorm.h:57
void filterSpectrum(SpectrumType &spectrum)
Definition: BernNorm.h:85
DoubleReal c1_
Definition: BernNorm.h:147
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:90
double DoubleReal
Double-precision real type.
Definition: Types.h:118