73     template <
typename SpectrumType>
 
   78       windowsize_ = (
double)param_.getValue(
"windowsize");
 
   79       peakcount_ = (
UInt)param_.getValue(
"peakcount");
 
   87       std::set<double> positions;
 
   88       for (ConstIterator it = old_spectrum.begin(); it != old_spectrum.end(); ++it)
 
   92         for (ConstIterator it2 = it; (it2->getPosition() - it->getPosition() < windowsize_); )
 
   94           window.push_back(*it2);
 
   95           if (++it2 == old_spectrum.end())
 
  104         for (
Size i = 0; i < peakcount_; ++i)
 
  106           if (i < window.size())
 
  108             positions.insert(window[i].getMZ());
 
  116       std::vector<Size> indices;
 
  117       for (ConstIterator it = spectrum.begin(); it != spectrum.end(); ++it)
 
  119         if (positions.find(it->getMZ()) != positions.end())
 
  121           Size index(it - spectrum.begin());
 
  122           indices.push_back(index);
 
  130     void filterPeakMap(
PeakMap& exp);
 
  133     template <
typename SpectrumType>
 
  136       if (spectrum.empty())
 
  143       windowsize_ = static_cast<double>(param_.getValue(
"windowsize"));
 
  144       peakcount_ = static_cast<UInt>(param_.getValue(
"peakcount"));
 
  151       double window_start = spectrum[0].getMZ();
 
  152       for (
Size i = 0; i != spectrum.size(); ++i)
 
  154         if (spectrum[i].getMZ() - window_start < windowsize_) 
 
  156           peaks_in_window.push_back(spectrum[i]);
 
  160           window_start = spectrum[i].getMZ(); 
 
  163           if (peaks_in_window.size() > peakcount_)
 
  165             std::partial_sort(peaks_in_window.begin(), peaks_in_window.begin() + peakcount_, peaks_in_window.end(), 
reverseComparator(
typename SpectrumType::PeakType::IntensityLess()));
 
  166             copy(peaks_in_window.begin(), peaks_in_window.begin() + peakcount_, back_inserter(out));
 
  170             std::sort(peaks_in_window.begin(), peaks_in_window.end(), 
reverseComparator(
typename SpectrumType::PeakType::IntensityLess()));
 
  171             copy(peaks_in_window.begin(), peaks_in_window.end(), back_inserter(out));
 
  174           peaks_in_window.
clear(
false);
 
  175           peaks_in_window.push_back(spectrum[i]);
 
  179       if (!peaks_in_window.empty()) 
 
  185         double last_window_size = peaks_in_window.back().getMZ() - window_start;
 
  186         double last_window_size_fraction = last_window_size / windowsize_;
 
  187         Size last_window_peakcount = static_cast<Size>(
std::round(last_window_size_fraction * peakcount_));
 
  189         if (peaks_in_window.size() > last_window_peakcount)
 
  191           std::partial_sort(peaks_in_window.begin(), peaks_in_window.begin() + last_window_peakcount, peaks_in_window.end(), 
 
  193           std::copy(peaks_in_window.begin(), peaks_in_window.begin() + last_window_peakcount, back_inserter(out));
 
  197           std::copy(peaks_in_window.begin(), peaks_in_window.end(), std::back_inserter(out));
 
  202       std::vector<Size> indices;
 
  205         if (
std::find(out.begin(), out.end(), *it) != out.end())
 
  207           Size index(it - spectrum.begin());
 
  208           indices.push_back(index);