libpappsomspp
Library for mass spectrometry
ralab::base::ms::LocalMinPeakArea< TReal > Struct Template Reference

#include <peakpickerqtof.hpp>

Public Types

typedef TReal value_type
 

Public Member Functions

 LocalMinPeakArea (TReal integwith, TReal threshold=.1)
 
template<typename Tzerocross , typename Tintensity , typename Tout >
void operator() (Tzerocross beginZ, Tzerocross endZ, Tintensity intensity, Tintensity resampled, Tout area) const
 intagrates the peak intesnities More...
 

Public Attributes

TReal integwith_
 
TReal threshold_
 

Private Member Functions

template<typename TInt >
void mextend (TInt &start, TInt &end, TInt idx) const
 exend peak to left and rigth More...
 

Detailed Description

template<typename TReal>
struct ralab::base::ms::LocalMinPeakArea< TReal >

extends peak to the left and to the right to the next local minimum or a predefined threshol or a maximum allowed extension.

Definition at line 75 of file peakpickerqtof.hpp.

Member Typedef Documentation

◆ value_type

template<typename TReal >
typedef TReal ralab::base::ms::LocalMinPeakArea< TReal >::value_type

Definition at line 76 of file peakpickerqtof.hpp.

Constructor & Destructor Documentation

◆ LocalMinPeakArea()

template<typename TReal >
ralab::base::ms::LocalMinPeakArea< TReal >::LocalMinPeakArea ( TReal  integwith,
TReal  threshold = .1 
)
inline
Parameters
integwithmaximal allowed peak width +- in pixel

Definition at line 80 of file peakpickerqtof.hpp.

82  :integwith_(integwith),threshold_(threshold) {}

Member Function Documentation

◆ mextend()

template<typename TReal >
template<typename TInt >
void ralab::base::ms::LocalMinPeakArea< TReal >::mextend ( TInt &  start,
TInt &  end,
TInt  idx 
) const
inlineprivate

exend peak to left and rigth

Definition at line 118 of file peakpickerqtof.hpp.

119  {
120  typedef typename std::iterator_traits<TInt>::value_type Intensitytype;
121  //
122  for(TInt intens = idx ; intens >= start; --intens) {
123  Intensitytype val1 = *intens;
124  Intensitytype val2 = *(intens-1);
125  if(val1 > threshold_) {
126  if(val1 < val2 ) {
127  start = intens;
128  break;
129  }
130  }
131  else {
132  start = intens;
133  break;
134  }
135  }
136 
137  for(TInt intens = idx ; intens <= end; ++intens) {
138  Intensitytype val1 = *intens;
139  Intensitytype val2 = *(intens+1);
140  if(val1 > threshold_) {
141  if(val1 < val2 ) {
142  end = intens;
143  break;
144  }
145  }
146  else {
147  end = intens;
148  break;
149  }
150  }
151  }

References ralab::base::ms::LocalMinPeakArea< TReal >::threshold_.

Referenced by ralab::base::ms::LocalMinPeakArea< TReal >::operator()().

◆ operator()()

template<typename TReal >
template<typename Tzerocross , typename Tintensity , typename Tout >
void ralab::base::ms::LocalMinPeakArea< TReal >::operator() ( Tzerocross  beginZ,
Tzerocross  endZ,
Tintensity  intensity,
Tintensity  resampled,
Tout  area 
) const
inline

intagrates the peak intesnities

Definition at line 88 of file peakpickerqtof.hpp.

93  {
94  typedef typename std::iterator_traits<Tout>::value_type AreaType;
95  for( ; beginZ != endZ ; ++beginZ, ++area )
96  {
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) );
100 
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);
106  mextend(st, en, center);
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.);
111  *area = areav;
112  }
113  }

References ralab::base::ms::LocalMinPeakArea< TReal >::integwith_, and ralab::base::ms::LocalMinPeakArea< TReal >::mextend().

Member Data Documentation

◆ integwith_

template<typename TReal >
TReal ralab::base::ms::LocalMinPeakArea< TReal >::integwith_

◆ threshold_

template<typename TReal >
TReal ralab::base::ms::LocalMinPeakArea< TReal >::threshold_

The documentation for this struct was generated from the following file:
ralab::base::ms::LocalMinPeakArea::threshold_
TReal threshold_
Definition: peakpickerqtof.hpp:78
ralab::base::ms::LocalMinPeakArea::integwith_
TReal integwith_
Definition: peakpickerqtof.hpp:77
ralab::base::ms::LocalMinPeakArea::mextend
void mextend(TInt &start, TInt &end, TInt idx) const
exend peak to left and rigth
Definition: peakpickerqtof.hpp:118