pappso::FilterLocalMaximum Class Reference

finds all local maxima, i.e. any point that has a greater y value than both of its neighboring points and only keep those points More...

`#include <filterlocalmaximum.h>`

Inheritance diagram for pappso::FilterLocalMaximum:

## Public Member Functions

| FilterLocalMaximum (std::size_t half_window_size)
| FilterLocalMaximum (const FilterLocalMaximum &other)
virtual | ~FilterLocalMaximum ()
Trace & | filter (Trace &data_points) const override
std::size_t | getHalfWindowSize () const
Public Member Functions inherited from pappso::FilterInterface
virtual | ~FilterInterface ()

## Private Attributes

std::size_t | m_halfWindowSize = 0

## Detailed Description

finds all local maxima, i.e. any point that has a greater y value than both of its neighboring points and only keep those points

usefull documentation : http://pd.chem.ucl.ac.uk/pdnn/peaks/peakindx.htm

Definition at line 43 of file filterlocalmaximum.h.

## Constructor & Destructor Documentation

## FilterLocalMaximum() [1/2]

FilterLocalMaximum::FilterLocalMaximum | ( | std::size_t | half_window_size | ) |

Default constructor

Definition at line 34 of file filterlocalmaximum.cpp.

: m_halfWindowSize(half_window_size)
{
}
pappso::FilterLocalMaximum::m_halfWindowSize
std::size_t m_halfWindowSize
Definition: filterlocalmaximum.h:68

## FilterLocalMaximum() [2/2]

FilterLocalMaximum::FilterLocalMaximum | ( | const FilterLocalMaximum & | other | ) |

Copy constructor

Parameters

  other | TODO

Definition at line 39 of file filterlocalmaximum.cpp.

: m_halfWindowSize(other.m_halfWindowSize)
{
}

## ~FilterLocalMaximum()

FilterLocalMaximum::~FilterLocalMaximum | ( |  | ) |

virtual

Destructor

Definition at line 44 of file filterlocalmaximum.cpp.

{
}

## Member Function Documentation

## filter()

Trace & FilterLocalMaximum::filter | ( | Trace & | data_points | ) | const

override virtual

Implements pappso::FilterInterface.

Definition at line 49 of file filterlocalmaximum.cpp.

{
if(m_halfWindowSize == 0)
return data_points;
Trace new_trace;
auto it = data_points.begin();
auto itend =
data_points.end() - m_halfWindowSize - 1; // no filter at the end of signal
// new_trace.reserve(data_points.size());
while((it != data_points.end()) &&
(std::distance(data_points.begin(), it) < (int)m_halfWindowSize))
{
// no filter at the begining of the signal
it++;
}
while(it != itend)
{
auto itwend = it + m_halfWindowSize + 1;
auto itw = maxYDataPoint(it - m_halfWindowSize, it + 1);
if(itw == it)
{
itw = maxYDataPoint(it, itwend);
if(itw == it)
{
new_trace.push_back({it->x, it->y});
}
}
it++;
}
data_points = std::move(new_trace);
return data_points;
}
pappso::Trace
A simple container of DataPoint instances.
Definition: trace.h:148
pappso::maxYDataPoint
std::vector< DataPoint >::const_iterator maxYDataPoint(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
Definition: trace.cpp:139

References m_halfWindowSize, and pappso::maxYDataPoint().

## getHalfWindowSize()

std::size_t FilterLocalMaximum::getHalfWindowSize | ( |  | ) | const

Definition at line 88 of file filterlocalmaximum.cpp.

{
return m_halfWindowSize;
}

References m_halfWindowSize.

## Member Data Documentation

## m_halfWindowSize

std::size_t pappso::FilterLocalMaximum::m_halfWindowSize = 0

private

Definition at line 68 of file filterlocalmaximum.h.

Referenced by filter(), and getHalfWindowSize().

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

- pappsomspp/processing/filters/filterlocalmaximum.h
- pappsomspp/processing/filters/filterlocalmaximum.cpp