Loading...
Searching...
No Matches
pappso::TraceDetectionZivy Class Reference

`#include <tracedetectionzivy.h>`

Inheritance diagram for pappso::TraceDetectionZivy:

## 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, bool remove_peak_base) const override
| detect peaks on a trace

## Private Attributes

FilterMorphoMean | m_smooth
FilterMorphoMinMax | m_minMax
FilterMorphoMaxMin | m_maxMin
pappso_double | m_detectionThresholdOnMinMax
pappso_double | m_detectionThresholdOnMaxMin

## Detailed Description

Definition at line 36 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 35 of file tracedetectionzivy.cpp.

: m_smooth(smoothing_half_window_length),
m_minMax(minmax_half_window_length),
m_maxMin(maxmin_half_window_length)
{
m_detectionThresholdOnMaxMin = detection_threshold_on_maxmin;
m_detectionThresholdOnMinMax = detection_threshold_on_minmax;
}
pappso::TraceDetectionZivy::m_maxMin
FilterMorphoMaxMin m_maxMin
Definition tracedetectionzivy.h:69
pappso::TraceDetectionZivy::m_minMax
FilterMorphoMinMax m_minMax
Definition tracedetectionzivy.h:68
pappso::TraceDetectionZivy::m_detectionThresholdOnMaxMin
pappso_double m_detectionThresholdOnMaxMin
Definition tracedetectionzivy.h:71
pappso::TraceDetectionZivy::m_detectionThresholdOnMinMax
pappso_double m_detectionThresholdOnMinMax
Definition tracedetectionzivy.h:70
pappso::TraceDetectionZivy::m_smooth
FilterMorphoMean m_smooth
Definition tracedetectionzivy.h:67

References m_detectionThresholdOnMaxMin, and m_detectionThresholdOnMinMax.

## ~TraceDetectionZivy()

pappso::TraceDetectionZivy::~TraceDetectionZivy | ( |  | ) |

virtual

Definition at line 48 of file tracedetectionzivy.cpp.

{
}

## Member Function Documentation

## detect()

void pappso::TraceDetectionZivy::detect | ( | const Trace & | trace,
|  | TraceDetectionSinkInterface & | sink,
|  | bool | remove_peak_base
| ) |  | const

override virtual

detect peaks on a trace

Parameters

  trace | the trace to detect peaks on
  sink | the object to store peaks or stream it
  remove_peak_base | if true, removes the area under the base of the peak

Implements pappso::TraceDetectionInterface.

Definition at line 109 of file tracedetectionzivy.cpp.

{
// detect peak positions on close curve : a peak is an intensity value
// strictly greater than the two surrounding values. In case of
// equality (very rare, can happen with some old old spectrometers) we
// take the last equal point to be the peak
qDebug();
std::size_t size = xic.size();
if(size < 4)
{
qDebug() << QObject::tr(
"The original XIC is too small to detect peaks (%1)")
.arg(xic.size());
return;
}
if(size <= m_maxMin.getMaxMinHalfEdgeWindows())
return;
if(size <= m_minMax.getMinMaxHalfEdgeWindows())
return;
Trace xic_minmax(xic); //"close" courbe du haut
if(m_smooth.getMeanHalfEdgeWindows() != 0)
{
qDebug() << "f";
m_smooth.filter(xic_minmax);
}
qDebug();
Trace xic_maxmin(xic_minmax); //"open" courbe du bas
qDebug();
try
{
qDebug() << "f1";
m_minMax.filter(xic_minmax);
qDebug() << "f2";
m_maxMin.filter(xic_maxmin);
}
catch(const ExceptionOutOfRange &e)
{
qDebug() << QObject::tr(
"The original XIC is too small to detect peaks (%1) :\n%2")
.arg(xic.size())
.arg(e.qwhat());
return;
}
qDebug() << "a";
std::vector<DataPoint>::const_iterator previous_rt = xic_minmax.begin();
std::vector<DataPoint>::const_iterator current_rt = (previous_rt + 1);
std::vector<DataPoint>::const_iterator last_rt = (xic_minmax.end() - 1);
std::vector<DataPoint>::const_iterator current_rt_on_maxmin =
(xic_maxmin.begin() + 1);
std::vector<DataPoint>::const_iterator xic_position = xic.begin();
qDebug() << "b";
while(current_rt != last_rt)
// for (unsigned int i = 1, count = 0; i < xic_minmax.size() - 1; )
{
// conditions to have a peak
if((previous_rt->y < current_rt->y) &&
(current_rt->y > m_detectionThresholdOnMinMax) &&
(current_rt_on_maxmin->y > m_detectionThresholdOnMaxMin))
{
// here we test the last condition to have a peak
// no peak case
if(current_rt->y < (current_rt + 1)->y)
{
//++i;
previous_rt = current_rt;
current_rt++;
current_rt_on_maxmin++;
}
// there is a peak here ! case
else if(current_rt->y > (current_rt + 1)->y)
{
// peak.setMaxXicElement(*current_rt);
// find left boundary
std::vector<DataPoint>::const_iterator it_left =
moveLowerYLeftDataPoint(xic_minmax, current_rt);
// walk back
it_left = moveLowerYRigthDataPoint(xic_minmax, it_left);
// peak.setLeftBoundary(*it_left);
// find right boundary
std::vector<DataPoint>::const_iterator it_right =
moveLowerYRigthDataPoint(xic_minmax, current_rt);
// walk back
it_right = moveLowerYLeftDataPoint(xic_minmax, it_right);
// peak.setRightBoundary(*it_right);
// integrate peak surface :
auto it =
findFirstEqualOrGreaterX(xic_position, xic.end(), it_left->x);
xic_position =
findFirstEqualOrGreaterX(it, xic.end(), it_right->x) + 1;
// peak.setArea(areaTrace(it, xic_position));
// find the maximum :
// peak.setMaxXicElement(*maxYDataPoint(it, xic_position));
// areaTrace()
TracePeak peak(it, xic_position, remove_peak_base);
sink.setTracePeak(peak);
// }
//++i;
previous_rt = current_rt;
current_rt++;
current_rt_on_maxmin++;
}
// equality case, skipping equal points
else
{
// while (v_minmax[i] == v_minmax[i + 1]) {
//++i;
current_rt++;
current_rt_on_maxmin++;
//++count;
}
}
// no chance to have a peak at all, continue looping
else
{
//++i;
previous_rt = current_rt;
current_rt++;
current_rt_on_maxmin++;
}
} // end loop for peaks
qDebug();
}
pappso::FilterMorphoMaxMin::filter
Trace & filter(Trace &data_points) const override
Definition filtermorpho.cpp:261
pappso::FilterMorphoMaxMin::getMaxMinHalfEdgeWindows
std::size_t getMaxMinHalfEdgeWindows() const
Definition filtermorpho.cpp:270
pappso::FilterMorphoMean::getMeanHalfEdgeWindows
std::size_t getMeanHalfEdgeWindows() const
Definition filtermorpho.cpp:432
pappso::FilterMorphoMinMax::getMinMaxHalfEdgeWindows
std::size_t getMinMaxHalfEdgeWindows() const
Definition filtermorpho.cpp:236
pappso::FilterMorphoMinMax::filter
Trace & filter(Trace &data_points) const override
Definition filtermorpho.cpp:227
pappso::FilterMorphoWindowBase::filter
virtual Trace & filter(Trace &data_points) const override
Definition filtermorpho.cpp:61
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:71
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:223
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:205

References pappso::FilterMorphoWindowBase::filter(), pappso::FilterMorphoMinMax::filter(), pappso::FilterMorphoMaxMin::filter(), pappso::findFirstEqualOrGreaterX(), pappso::FilterMorphoMaxMin::getMaxMinHalfEdgeWindows(), pappso::FilterMorphoMean::getMeanHalfEdgeWindows(), pappso::FilterMorphoMinMax::getMinMaxHalfEdgeWindows(), m_detectionThresholdOnMaxMin, m_detectionThresholdOnMinMax, m_maxMin, m_minMax, m_smooth, pappso::moveLowerYLeftDataPoint(), pappso::moveLowerYRigthDataPoint(), pappso::PappsoException::qwhat(), and pappso::TraceDetectionSinkInterface::setTracePeak().

## getDetectionThresholdOnMaxmin()

pappso_double pappso::TraceDetectionZivy::getDetectionThresholdOnMaxmin | ( |  | ) | const

Definition at line 102 of file tracedetectionzivy.cpp.

{
return m_detectionThresholdOnMaxMin;
};

References m_detectionThresholdOnMaxMin.

## getDetectionThresholdOnMinmax()

pappso_double pappso::TraceDetectionZivy::getDetectionThresholdOnMinmax | ( |  | ) | const

Definition at line 97 of file tracedetectionzivy.cpp.

{
return m_detectionThresholdOnMinMax;
};

References m_detectionThresholdOnMinMax.

## getMaxMinHalfEdgeWindows()

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

Definition at line 86 of file tracedetectionzivy.cpp.

{
return m_maxMin.getMaxMinHalfEdgeWindows();
};

References pappso::FilterMorphoMaxMin::getMaxMinHalfEdgeWindows(), and m_maxMin.

## getMinMaxHalfEdgeWindows()

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

Definition at line 92 of file tracedetectionzivy.cpp.

{
return m_minMax.getMinMaxHalfEdgeWindows();
};

References pappso::FilterMorphoMinMax::getMinMaxHalfEdgeWindows(), and m_minMax.

## getSmoothingHalfEdgeWindows()

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

Definition at line 81 of file tracedetectionzivy.cpp.

{
return m_smooth.getMeanHalfEdgeWindows();
};

References pappso::FilterMorphoMean::getMeanHalfEdgeWindows(), and m_smooth.

## setDetectionThresholdOnMaxmin()

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

Definition at line 75 of file tracedetectionzivy.cpp.

{
m_detectionThresholdOnMaxMin = detectionThresholdOnMaxMin;
}

References m_detectionThresholdOnMaxMin.

## setDetectionThresholdOnMinmax()

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

Definition at line 69 of file tracedetectionzivy.cpp.

{
m_detectionThresholdOnMinMax = detectionThresholdOnMinMax;
}

References m_detectionThresholdOnMinMax.

## setFilterMorphoMaxMin()

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

Definition at line 63 of file tracedetectionzivy.cpp.

{
m_maxMin = maxMin;
}

References m_maxMin.

## setFilterMorphoMean()

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

Definition at line 53 of file tracedetectionzivy.cpp.

{
m_smooth = smooth;
}

References m_smooth.

## setFilterMorphoMinMax()

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

Definition at line 58 of file tracedetectionzivy.cpp.

{
m_minMax = minMax;
}

References m_minMax.

## Member Data Documentation

## m_detectionThresholdOnMaxMin

pappso_double pappso::TraceDetectionZivy::m_detectionThresholdOnMaxMin

private

Definition at line 71 of file tracedetectionzivy.h.

Referenced by TraceDetectionZivy(), detect(), getDetectionThresholdOnMaxmin(), and setDetectionThresholdOnMaxmin().

## m_detectionThresholdOnMinMax

pappso_double pappso::TraceDetectionZivy::m_detectionThresholdOnMinMax

private

Definition at line 70 of file tracedetectionzivy.h.

Referenced by TraceDetectionZivy(), detect(), getDetectionThresholdOnMinmax(), and setDetectionThresholdOnMinmax().

## m_maxMin

FilterMorphoMaxMin pappso::TraceDetectionZivy::m_maxMin

private

Definition at line 69 of file tracedetectionzivy.h.

Referenced by detect(), getMaxMinHalfEdgeWindows(), and setFilterMorphoMaxMin().

## m_minMax

FilterMorphoMinMax pappso::TraceDetectionZivy::m_minMax

private

Definition at line 68 of file tracedetectionzivy.h.

Referenced by detect(), getMinMaxHalfEdgeWindows(), and setFilterMorphoMinMax().

## m_smooth

FilterMorphoMean pappso::TraceDetectionZivy::m_smooth

private

Definition at line 67 of file tracedetectionzivy.h.

Referenced by detect(), getSmoothingHalfEdgeWindows(), and setFilterMorphoMean().

The documentation for this class was generated from the following files:

- pappsomspp/processing/detection/tracedetectionzivy.h
- pappsomspp/processing/detection/tracedetectionzivy.cpp