35 #ifndef OPENMS_FILTERING_TRANSFORMERS_INTENSITYBALANCEFILTER_H 36 #define OPENMS_FILTERING_TRANSFORMERS_INTENSITYBALANCEFILTER_H 83 template <
typename SpectrumType>
87 std::multimap<double, Size> band_intensity;
88 double parentmass = 0.0;
91 for (
Size i = 0; i < bands; ++i)
97 while (j < spectrum.size() && spectrum[j].getPosition()[0] < (parentmass - 300) / bands * (i + 1) + 300)
99 intensity += spectrum[j++].getIntensity();
101 band_intensity.insert(std::make_pair(intensity, i));
104 double total_intensity = 0;
105 double twobiggest = 0;
106 double sevensmallest = 0;
107 for (std::multimap<double, Size>::reverse_iterator mmrit = band_intensity.rbegin(); mmrit != band_intensity.rend(); ++mmrit, ++j)
109 total_intensity += mmrit->first;
113 twobiggest += mmrit->first;
118 sevensmallest += mmrit->first;
122 return (twobiggest - sevensmallest) / total_intensity;
128 return "IntensityBalanceFilter";
135 #endif // OPENMS_FILTERING_TRANSFORMERS_INTENSITYBALANCEFILTER_H A more convenient string class.
Definition: String.h:57
double apply(SpectrumType &spectrum)
Definition: IntensityBalanceFilter.h:84
static FilterFunctor * create()
Definition: IntensityBalanceFilter.h:80
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:47
static const String getProductName()
Definition: IntensityBalanceFilter.h:126
The representation of a 1D spectrum.
Definition: MSSpectrum.h:67
A FilterFunctor extracts some spectrum characteristics for quality assessment.
Definition: FilterFunctor.h:45
const std::vector< Precursor > & getPrecursors() const
returns a const reference to the precursors
IntensityBalanceFilter divides the m/z-range into ten regions and sums the intensity in these regions...
Definition: IntensityBalanceFilter.h:53
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:128