25 #include "../resample/convert2dense.hpp"
26 #include "pwiz/utility/findmf/base/filter/filter.hpp"
28 #include "pwiz/utility/findmf/base/filter/gaussfilter.hpp"
29 #include "pwiz/utility/findmf/base/base/interpolate.hpp"
30 #include "pwiz/utility/findmf/base/resample/determinebinwidth.hpp"
31 #include "pwiz/utility/findmf/base/base/copyif.hpp"
42 template<
typename TReal>
49 template<
typename Tzerocross,
typename T
intensity,
typename Tout>
52 [[maybe_unused]] Tintensity intensity,
56 typedef typename std::iterator_traits<Tout>::value_type AreaType;
57 for( ; beginZ != endZ ; ++beginZ, ++area )
59 size_t idx =
static_cast<size_t>( *beginZ );
60 size_t start =
static_cast<size_t>( std::round( idx -
integwith_ ) );
61 size_t end =
static_cast<size_t>( std::round( idx +
integwith_ + 2.) );
63 for( ; start != end ; ++start )
65 aread += *(resmpled + start);
74 template<
typename TReal>
87 template<
typename Tzerocross,
typename T
intensity,
typename Tout >
94 typedef typename std::iterator_traits<Tout>::value_type AreaType;
95 for( ; beginZ != endZ ; ++beginZ, ++area )
97 size_t idx =
static_cast<size_t>( *beginZ );
98 size_t start =
static_cast<size_t>( std::round( idx -
integwith_ ) );
99 size_t end =
static_cast<size_t>( std::round( idx +
integwith_ + 2) );
101 Tintensity st = intensity + start;
102 Tintensity en = intensity + end;
103 Tintensity center = intensity + idx;
104 std::ptrdiff_t x1 = std::distance(st, center);
105 std::ptrdiff_t y1 = std::distance(center,en);
107 std::ptrdiff_t x2 = std::distance(intensity,st);
108 std::ptrdiff_t y2 = std::distance(intensity,en);
109 std::ptrdiff_t pp = std::distance(st,en);
110 AreaType areav = std::accumulate(resampled+x2,resampled+y2,0.);
117 template<
typename TInt >
118 void mextend( TInt &start, TInt &end, TInt idx)
const
120 typedef typename std::iterator_traits<TInt>::value_type Intensitytype;
122 for(TInt intens = idx ; intens >= start; --intens) {
123 Intensitytype val1 = *intens;
124 Intensitytype val2 = *(intens-1);
137 for(TInt intens = idx ; intens <= end; ++intens) {
138 Intensitytype val1 = *intens;
139 Intensitytype val2 = *(intens+1);
157 template<
typename TReal,
template <
typename B>
class TIntegrator >
170 ralab::base::resample::SamplingWith
sw_;
177 std::pair<TReal, TReal> & massrange,
180 TReal intensitythreshold = 10.,
182 uint32_t maxnumberofpeaks = 0,
188 c2d_.
defBreak(massrange,ralab::base::resample::resolution2ppm(resolution));
190 ralab::base::filter::getGaussianFilterQuantile(
filter_,width);
194 template<
typename Tmass,
typename T
intensity>
195 void operator()(Tmass begmz, Tmass endmz, Tintensity begint )
197 typename std::iterator_traits<Tintensity>::value_type minint = *std::upper_bound(begint,begint+std::distance(begmz,endmz),0.1);
200 double a =
sw_(begmz,endmz);
234 if(threshmax > threshold)
235 threshold = threshmax;
239 if(threshold > 0.01) {
260 peakmass_.begin(),boost::bind(std::greater<TReal>(),_1,threshold));
262 typename std::vector<TReal>::iterator b = ralab::base::utils::copy_if(
peakarea_.begin(),
peakarea_.end(),
263 peakarea_.begin(),boost::bind(std::greater<TReal>(),_1,threshold));