46 template <
class DataArrayT>
51 typename DataArrayT::iterator it = a.begin();
52 for (; it != a.end(); ++it)
54 if (it->getName() == name)
return it;
58 template <
class DataArrayT>
61 typename DataArrayT::const_iterator it = a.begin();
62 for (; it != a.end(); ++it)
64 if (it->getName() == name)
return it;
69 template <
typename PeakContainerT>
72 const double pos_start,
74 const bool ignoreDataArrays =
false 77 typename PeakContainerT::iterator it_start = p.PosBegin(pos_start);
78 typename PeakContainerT::iterator it_end = p.PosEnd(pos_end);
79 if (!ignoreDataArrays)
81 Size hops_left = std::distance(p.begin(), it_start);
82 Size n_elems = std::distance(it_start, it_end);
84 typename PeakContainerT::StringDataArrays& SDAs = p.getStringDataArrays();
87 if (sda.size() == p.size())
89 sda.erase(sda.begin() + hops_left + n_elems, sda.end());
90 sda.erase(sda.begin(), sda.begin() + hops_left);
94 typename PeakContainerT::FloatDataArrays& FDAs = p.getFloatDataArrays();
97 if (fda.size() == p.size())
99 fda.erase(fda.begin() + hops_left + n_elems, fda.end());
100 fda.erase(fda.begin(), fda.begin() + hops_left);
104 typename PeakContainerT::IntegerDataArrays& IDAs = p.getIntegerDataArrays();
107 if (ida.size() == p.size())
109 ida.erase(ida.begin() + hops_left + n_elems, ida.end());
110 ida.erase(ida.begin(), ida.begin() + hops_left);
114 p.erase(it_end, p.end());
115 p.erase(p.begin(), it_start);
118 template <
typename PeakContainerT>
121 if (p.empty())
return;
123 typename PeakContainerT::iterator it = std::min_element(p.begin(), p.end(),
126 return a.getIntensity() < b.getIntensity();
129 const double rebase = - it->getIntensity();
132 peak.setIntensity(peak.getIntensity() + rebase);
A more convenient string class.
Definition: String.h:57
void subtractMinimumIntensity(PeakContainerT &p)
Definition: SpectrumHelper.h:119
Peak2D PeakType
Definition: MassTrace.h:47
Main OpenMS namespace.
Definition: FeatureDeconvolution.h:46
Float data array class.
Definition: DataArrays.h:45
Integer data array class.
Definition: DataArrays.h:51
void removePeaks(PeakContainerT &p, const double pos_start, const double pos_end, const bool ignoreDataArrays=false)
Definition: SpectrumHelper.h:70
size_t Size
Size type e.g. used as variable which can hold result of size()
Definition: Types.h:127
String data array class.
Definition: DataArrays.h:57
DataArrayT::iterator getDataArrayByName(DataArrayT &a, const String &name)
Helper functions for MSSpectrum and MSChromatogram.
Definition: SpectrumHelper.h:49