83 template <
typename SpectrumType>
89 c1_ = (
double)param_.getValue(
"C1");
90 c2_ = (
double)param_.getValue(
"C2");
91 th_ = (
double)param_.getValue(
"threshold");
97 std::map<double, Size> peakranks;
98 for (ConstIterator it = spectrum.begin(); it != spectrum.end(); ++it)
100 peakranks[it->getIntensity()] = 0;
101 if (it->getIntensity() > maxint)
103 maxint = it->getIntensity();
107 for (std::map<double, Size>::reverse_iterator mit = peakranks.rbegin(); mit != peakranks.rend(); ++mit)
109 mit->second = ++rank;
114 for (
SignedSize i = spectrum.size() - 1; i >= 0; --i)
116 if (spectrum[i].getIntensity() > maxint * th_)
118 maxmz = spectrum[i].getMZ();
124 for (Iterator it = spectrum.begin(); it != spectrum.end(); )
126 double newint = c1_ - (c2_ / maxmz) * peakranks[it->getIntensity()];
129 it = spectrum.erase(it);
133 it->setIntensity(newint);
142 void filterPeakMap(
PeakMap & exp);
double th_
Definition: BernNorm.h:148
void sortByPosition()
Lexicographically sorts the peaks by their position.
unsigned int UInt
Unsigned integer type.
Definition: Types.h:94
ContainerType::const_iterator ConstIterator
Non-mutable iterator.
Definition: MSSpectrum.h:103
ptrdiff_t SignedSize
Signed Size type e.g. used as pointer difference.
Definition: Types.h:134
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
ContainerType::iterator Iterator
Mutable iterator.
Definition: MSSpectrum.h:101
double c2_
Definition: BernNorm.h:147
BernNorm scales the peaks by ranking them and then scaling them according to rank.
Definition: BernNorm.h:56
The representation of a 1D spectrum.
Definition: MSSpectrum.h:66
void filterSpectrum(SpectrumType &spectrum)
Definition: BernNorm.h:84
In-Memory representation of a mass spectrometry experiment.
Definition: MSExperiment.h:77
double c1_
Definition: BernNorm.h:146
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:91