35 #ifndef OPENMS_FILTERING_TRANSFORMERS_NORMALIZER_H
36 #define OPENMS_FILTERING_TRANSFORMERS_NORMALIZER_H
76 template <
typename SpectrumType>
79 typedef typename SpectrumType::Iterator Iterator;
80 typedef typename SpectrumType::ConstIterator ConstIterator;
82 method_ = param_.getValue(
"method");
85 if (method_ ==
"to_one")
88 for (ConstIterator it = spectrum.begin(); it != spectrum.end(); ++it)
90 if (max < it->getIntensity())
92 max = it->getIntensity();
95 for (Iterator it = spectrum.begin(); it != spectrum.end(); ++it)
97 it->setIntensity(it->getIntensity() / max);
101 else if (method_ ==
"to_TIC")
104 for (ConstIterator it = spectrum.begin(); it != spectrum.end(); ++it)
106 sum += it->getIntensity();
109 for (Iterator it = spectrum.begin(); it != spectrum.end(); ++it)
111 it->setIntensity(it->getIntensity() /
sum);
126 void filterPeakMap(
PeakMap & exp);
139 #endif //OPENMS_FILTERING_TRANSFORMERS_NORMALIZER_H
A more convenient string class.
Definition: String.h:57
static double sum(IteratorType begin, IteratorType end)
Calculates the sum of a range of values.
Definition: StatisticFunctions.h:118
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
Invalid value exception.
Definition: Exception.h:336
A base class for all classes handling default parameters.
Definition: DefaultParamHandler.h:92
Normalizer normalizes the peak intensities.
Definition: Normalizer.h:53
void filterSpectrum(SpectrumType &spectrum)
Definition: Normalizer.h:77
String method_
Definition: Normalizer.h:133