26 #include "../resample/convert2dense.hpp"
27 #include "pwiz/utility/findmf/base/filter/filter.hpp"
29 #include "pwiz/utility/findmf/base/filter/gaussfilter.hpp"
30 #include "pwiz/utility/findmf/base/base/interpolate.hpp"
31 #include "pwiz/utility/findmf/base/resample/determinebinwidth.hpp"
32 #include "pwiz/utility/findmf/base/base/copyif.hpp"
43 template<
typename TReal>
50 template<
typename Tzerocross,
typename T
intensity,
typename Tout>
53 [[maybe_unused]] Tintensity intensity,
57 typedef typename std::iterator_traits<Tout>::value_type AreaType;
58 for( ; beginZ != endZ ; ++beginZ, ++area )
60 size_t idx =
static_cast<size_t>( *beginZ );
61 size_t start =
static_cast<size_t>( std::round( idx -
integwith_ ) );
62 size_t end =
static_cast<size_t>( std::round( idx +
integwith_ + 2.) );
64 for( ; start != end ; ++start )
66 aread += *(resmpled + start);
75 template<
typename TReal>
88 template<
typename Tzerocross,
typename T
intensity,
typename Tout >
95 typedef typename std::iterator_traits<Tout>::value_type AreaType;
96 for( ; beginZ != endZ ; ++beginZ, ++area )
98 size_t idx =
static_cast<size_t>( *beginZ );
99 size_t start =
static_cast<size_t>( std::round( idx -
integwith_ ) );
100 size_t end =
static_cast<size_t>( std::round( idx +
integwith_ + 2) );
102 Tintensity st = intensity + start;
103 Tintensity en = intensity + end;
104 Tintensity center = intensity + idx;
105 std::ptrdiff_t x1 = std::distance(st, center);
106 std::ptrdiff_t y1 = std::distance(center,en);
108 std::ptrdiff_t x2 = std::distance(intensity,st);
109 std::ptrdiff_t y2 = std::distance(intensity,en);
110 std::ptrdiff_t pp = std::distance(st,en);
111 AreaType areav = std::accumulate(resampled+x2,resampled+y2,0.);
118 template<
typename TInt >
119 void mextend( TInt &start, TInt &end, TInt idx)
const
121 typedef typename std::iterator_traits<TInt>::value_type Intensitytype;
123 for(TInt intens = idx ; intens >= start; --intens) {
124 Intensitytype val1 = *intens;
125 Intensitytype val2 = *(intens-1);
138 for(TInt intens = idx ; intens <= end; ++intens) {
139 Intensitytype val1 = *intens;
140 Intensitytype val2 = *(intens+1);
158 template<
typename TReal,
template <
typename B>
class TIntegrator >
171 ralab::base::resample::SamplingWith
sw_;
178 std::pair<TReal, TReal> & massrange,
181 TReal intensitythreshold = 10.,
183 uint32_t maxnumberofpeaks = 0,
189 c2d_.
defBreak(massrange,ralab::base::resample::resolution2ppm(resolution));
191 ralab::base::filter::getGaussianFilterQuantile(
filter_,width);
195 template<
typename Tmass,
typename T
intensity>
196 void operator()(Tmass begmz, Tmass endmz, Tintensity begint )
199 typename std::iterator_traits<Tintensity>::value_type minint = *std::upper_bound(begint,begint+std::distance(begmz,endmz),0.1);
202 double a =
sw_(begmz,endmz);
237 if(threshmax > threshold)
238 threshold = threshmax;
242 if(threshold > 0.01) {
263 peakmass_.begin(),boost::bind(std::greater<TReal>(),_1,threshold));
265 typename std::vector<TReal>::iterator b = ralab::base::utils::copy_if(
peakarea_.begin(),
peakarea_.end(),
266 peakarea_.begin(),boost::bind(std::greater<TReal>(),_1,threshold));