libpappsomspp
Library for mass spectrometry
pappso::TraceDetectionZivy Class Reference

#include <tracedetectionzivy.h>

Inheritance diagram for pappso::TraceDetectionZivy:
pappso::TraceDetectionInterface

Public Member Functions

 TraceDetectionZivy (unsigned int smoothing_half_window_length, unsigned int minmax_half_window_length, unsigned int maxmin_half_window_length, pappso_double detection_threshold_on_minmax, pappso_double detection_threshold_on_maxmin)
 
virtual ~TraceDetectionZivy ()
 
void setFilterMorphoMean (const FilterMorphoMean &smooth)
 
void setFilterMorphoMinMax (const FilterMorphoMinMax &m_minMax)
 
void setFilterMorphoMaxMin (const FilterMorphoMaxMin &maxMin)
 
void setDetectionThresholdOnMinmax (double detectionThresholdOnMinMax)
 
void setDetectionThresholdOnMaxmin (double detectionThresholdOnMaxMin)
 
unsigned int getSmoothingHalfEdgeWindows () const
 
unsigned int getMaxMinHalfEdgeWindows () const
 
unsigned int getMinMaxHalfEdgeWindows () const
 
pappso_double getDetectionThresholdOnMinmax () const
 
pappso_double getDetectionThresholdOnMaxmin () const
 
void detect (const Trace &xic, TraceDetectionSinkInterface &sink) const override
 

Private Attributes

FilterMorphoMean m_smooth
 
FilterMorphoMinMax m_minMax
 
FilterMorphoMaxMin m_maxMin
 
pappso_double m_detectionThresholdOnMinMax
 
pappso_double m_detectionThresholdOnMaxMin
 

Detailed Description

Definition at line 57 of file tracedetectionzivy.h.

Constructor & Destructor Documentation

◆ TraceDetectionZivy()

pappso::TraceDetectionZivy::TraceDetectionZivy ( unsigned int  smoothing_half_window_length,
unsigned int  minmax_half_window_length,
unsigned int  maxmin_half_window_length,
pappso_double  detection_threshold_on_minmax,
pappso_double  detection_threshold_on_maxmin 
)

Definition at line 53 of file tracedetectionzivy.cpp.

56 {
57  m_minMax = minMax;
58 }
59 void
60 TraceDetectionZivy::setFilterMorphoMaxMin(const FilterMorphoMaxMin &maxMin)
61 {
62  m_maxMin = maxMin;
63 }
64 
65 void

◆ ~TraceDetectionZivy()

pappso::TraceDetectionZivy::~TraceDetectionZivy ( )
virtual

Definition at line 66 of file tracedetectionzivy.cpp.

68 {

References m_detectionThresholdOnMinMax.

Member Function Documentation

◆ detect()

void pappso::TraceDetectionZivy::detect ( const Trace xic,
TraceDetectionSinkInterface sink 
) const
overridevirtual

Implements pappso::TraceDetectionInterface.

Definition at line 127 of file tracedetectionzivy.cpp.

131  {
132  throw ExceptionNotPossible(
133  QObject::tr("The original XIC is too small to detect peaks (%1) :\n%2")
134  .arg(xic.size())
135  .arg(e.qwhat()));
136  }
137  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
138  std::vector<DataPoint>::const_iterator previous_rt = xic_minmax.begin();
139  std::vector<DataPoint>::const_iterator current_rt = (previous_rt + 1);
140  std::vector<DataPoint>::const_iterator last_rt = (xic_minmax.end() - 1);
141 
142  std::vector<DataPoint>::const_iterator current_rt_on_maxmin =
143  (xic_maxmin.begin() + 1);
144 
145  std::vector<DataPoint>::const_iterator xic_position = xic.begin();
146  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
147  while(current_rt != last_rt)
148  // for (unsigned int i = 1, count = 0; i < xic_minmax.size() - 1; )
149  {
150  // conditions to have a peak
151  if((previous_rt->y < current_rt->y) &&
152  (current_rt->y > m_detectionThresholdOnMinMax) &&
153  (current_rt_on_maxmin->y > m_detectionThresholdOnMaxMin))
154  {
155  // here we test the last condition to have a peak
156 
157  // no peak case
158  if(current_rt->y < (current_rt + 1)->y)
159  {
160  //++i;
161  previous_rt = current_rt;
162  current_rt++;
163  current_rt_on_maxmin++;
164  }
165  // there is a peak here ! case
166  else if(current_rt->y > (current_rt + 1)->y)
167  {
168  // peak.setMaxXicElement(*current_rt);
169 
170  // find left boundary
171  std::vector<DataPoint>::const_iterator it_left =
172  moveLowerYLeftDataPoint(xic_minmax, current_rt);
173  // walk back
174  it_left = moveLowerYRigthDataPoint(xic_minmax, it_left);
175  // peak.setLeftBoundary(*it_left);
176 
177  // find right boundary
178  std::vector<DataPoint>::const_iterator it_right =
179  moveLowerYRigthDataPoint(xic_minmax, current_rt);
180  // walk back
181  it_right = moveLowerYLeftDataPoint(xic_minmax, it_right);
182  // peak.setRightBoundary(*it_right);
183 
184  // integrate peak surface :
185  auto it =
186  findFirstEqualOrGreaterX(xic_position, xic.end(), it_left->x);
187  xic_position =
188  findFirstEqualOrGreaterX(it, xic.end(), it_right->x) + 1;
189  // peak.setArea(areaTrace(it, xic_position));
190 
191  // find the maximum :
192  // peak.setMaxXicElement(*maxYDataPoint(it, xic_position));
193 
194  // areaTrace()
195  TracePeak peak(it, xic_position);
196  sink.setTracePeak(peak);
197  // }
198  //++i;
199  previous_rt = current_rt;
200  current_rt++;
201  current_rt_on_maxmin++;
202  }
203  // equality case, skipping equal points
204  else
205  {
206  // while (v_minmax[i] == v_minmax[i + 1]) {
207  //++i;
208  current_rt++;
209  current_rt_on_maxmin++;
210 
211  //++count;
212  }
213  }
214  // no chance to have a peak at all, continue looping
215  else
216  {
217  //++i;
218  previous_rt = current_rt;
219  current_rt++;
220  current_rt_on_maxmin++;
221  }
222  } // end loop for peaks
223  qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
224 }
225 } // namespace pappso

◆ getDetectionThresholdOnMaxmin()

pappso_double pappso::TraceDetectionZivy::getDetectionThresholdOnMaxmin ( ) const

Definition at line 120 of file tracedetectionzivy.cpp.

126  {

◆ getDetectionThresholdOnMinmax()

pappso_double pappso::TraceDetectionZivy::getDetectionThresholdOnMinmax ( ) const

Definition at line 115 of file tracedetectionzivy.cpp.

117  {
118  m_smooth.filter(xic_minmax);

◆ getMaxMinHalfEdgeWindows()

unsigned int pappso::TraceDetectionZivy::getMaxMinHalfEdgeWindows ( ) const

Definition at line 104 of file tracedetectionzivy.cpp.

108 {

◆ getMinMaxHalfEdgeWindows()

unsigned int pappso::TraceDetectionZivy::getMinMaxHalfEdgeWindows ( ) const

Definition at line 110 of file tracedetectionzivy.cpp.

117  {

◆ getSmoothingHalfEdgeWindows()

unsigned int pappso::TraceDetectionZivy::getSmoothingHalfEdgeWindows ( ) const

Definition at line 99 of file tracedetectionzivy.cpp.

100 {
102 };

References m_detectionThresholdOnMaxMin.

◆ setDetectionThresholdOnMaxmin()

void pappso::TraceDetectionZivy::setDetectionThresholdOnMaxmin ( double  detectionThresholdOnMaxMin)

Definition at line 93 of file tracedetectionzivy.cpp.

95 {
97 };

References m_detectionThresholdOnMinMax.

◆ setDetectionThresholdOnMinmax()

void pappso::TraceDetectionZivy::setDetectionThresholdOnMinmax ( double  detectionThresholdOnMinMax)

◆ setFilterMorphoMaxMin()

void pappso::TraceDetectionZivy::setFilterMorphoMaxMin ( const FilterMorphoMaxMin maxMin)

Definition at line 81 of file tracedetectionzivy.cpp.

84 {

◆ setFilterMorphoMean()

void pappso::TraceDetectionZivy::setFilterMorphoMean ( const FilterMorphoMean smooth)

Definition at line 71 of file tracedetectionzivy.cpp.

74 {

References m_detectionThresholdOnMaxMin.

◆ setFilterMorphoMinMax()

void pappso::TraceDetectionZivy::setFilterMorphoMinMax ( const FilterMorphoMinMax m_minMax)

Definition at line 76 of file tracedetectionzivy.cpp.

79 {

Member Data Documentation

◆ m_detectionThresholdOnMaxMin

pappso_double pappso::TraceDetectionZivy::m_detectionThresholdOnMaxMin
private

Definition at line 85 of file tracedetectionzivy.h.

Referenced by getSmoothingHalfEdgeWindows(), and setFilterMorphoMean().

◆ m_detectionThresholdOnMinMax

pappso_double pappso::TraceDetectionZivy::m_detectionThresholdOnMinMax
private

Definition at line 84 of file tracedetectionzivy.h.

Referenced by setDetectionThresholdOnMaxmin(), and ~TraceDetectionZivy().

◆ m_maxMin

FilterMorphoMaxMin pappso::TraceDetectionZivy::m_maxMin
private

Definition at line 83 of file tracedetectionzivy.h.

◆ m_minMax

FilterMorphoMinMax pappso::TraceDetectionZivy::m_minMax
private

Definition at line 82 of file tracedetectionzivy.h.

Referenced by setDetectionThresholdOnMinmax().

◆ m_smooth

FilterMorphoMean pappso::TraceDetectionZivy::m_smooth
private

Definition at line 81 of file tracedetectionzivy.h.


The documentation for this class was generated from the following files:
pappso::moveLowerYLeftDataPoint
std::vector< DataPoint >::const_iterator moveLowerYLeftDataPoint(const Trace &trace, std::vector< DataPoint >::const_iterator begin)
Move left to the lower value.
Definition: trace.cpp:176
pappso::moveLowerYRigthDataPoint
std::vector< DataPoint >::const_iterator moveLowerYRigthDataPoint(const Trace &trace, std::vector< DataPoint >::const_iterator begin)
Move right to the lower value.
Definition: trace.cpp:160
pappso::TraceDetectionZivy::m_maxMin
FilterMorphoMaxMin m_maxMin
Definition: tracedetectionzivy.h:83
pappso::TraceDetectionZivy::m_smooth
FilterMorphoMean m_smooth
Definition: tracedetectionzivy.h:81
pappso::TraceDetectionZivy::setFilterMorphoMaxMin
void setFilterMorphoMaxMin(const FilterMorphoMaxMin &maxMin)
Definition: tracedetectionzivy.cpp:81
pappso::FilterMorphoWindowBase::filter
virtual Trace & filter(Trace &data_points) const override
Definition: filtermorpho.cpp:60
pappso::TraceDetectionZivy::m_detectionThresholdOnMinMax
pappso_double m_detectionThresholdOnMinMax
Definition: tracedetectionzivy.h:84
pappso::TraceDetectionZivy::m_minMax
FilterMorphoMinMax m_minMax
Definition: tracedetectionzivy.h:82
pappso::TraceDetectionZivy::m_detectionThresholdOnMaxMin
pappso_double m_detectionThresholdOnMaxMin
Definition: tracedetectionzivy.h:85
pappso::FilterMorphoMinMax::getMinMaxHalfEdgeWindows
std::size_t getMinMaxHalfEdgeWindows() const
Definition: filtermorpho.cpp:233
pappso::findFirstEqualOrGreaterX
std::vector< DataPoint >::iterator findFirstEqualOrGreaterX(std::vector< DataPoint >::iterator begin, std::vector< DataPoint >::iterator end, const double &value)
find the first element in which X is equal or greater than the value searched important : it implies ...
Definition: trace.cpp:30