pappso::FilterFloorAmplitudePercentage Class Reference

Redefines the floor intensity of the Trace. More...

`#include <filterflooramplitudepercentage.h>`

Inheritance diagram for pappso::FilterFloorAmplitudePercentage:

## Public Member Functions

| FilterFloorAmplitudePercentage (double percentage)
| FilterFloorAmplitudePercentage (const QString &parameters)
| FilterFloorAmplitudePercentage (const FilterFloorAmplitudePercentage &other)
virtual | ~FilterFloorAmplitudePercentage ()
FilterFloorAmplitudePercentage & | operator= (const FilterFloorAmplitudePercentage &other)
Trace & | filter (Trace &data_points) const override
double | getPercentage () const
QString | name () const override
QString | toString () const override
| Return a string with the textual representation of the configuration data. More...
Public Member Functions inherited from pappso::FilterNameInterface
virtual | ~FilterNameInterface ()
Public Member Functions inherited from pappso::FilterInterface
virtual | ~FilterInterface ()

## Protected Member Functions

void | buildFilterFromString (const QString &strBuildParams) override
| build this filter using a string More...

## Private Attributes

double | m_percentage

## Detailed Description

Redefines the floor intensity of the Trace.

The amplitude of the trace is computed (maxValue - minValue) Its fraction is calculated = amplitude * (percentage / 100) The threshold value is computed as (minValue + fraction)

When the values to be filtered are below that threshold they acquire that threshold value.

When the values to be filtered are above that threshold they remain unchanged.

This effectively re-floors the values to threshold.

Definition at line 71 of file filterflooramplitudepercentage.h.

## Constructor & Destructor Documentation

## FilterFloorAmplitudePercentage() [1/3]

pappso::FilterFloorAmplitudePercentage::FilterFloorAmplitudePercentage | ( | double | percentage | ) |

Definition at line 49 of file filterflooramplitudepercentage.cpp.

{
m_percentage = percentage;
}
pappso::FilterFloorAmplitudePercentage::m_percentage
double m_percentage
Definition: filterflooramplitudepercentage.h:94

References m_percentage.

## FilterFloorAmplitudePercentage() [2/3]

pappso::FilterFloorAmplitudePercentage::FilterFloorAmplitudePercentage | ( | const QString & | parameters | ) |

Definition at line 80 of file filterflooramplitudepercentage.cpp.

{
buildFilterFromString(parameters);
}
pappso::FilterFloorAmplitudePercentage::buildFilterFromString
void buildFilterFromString(const QString &strBuildParams) override
build this filter using a string
Definition: filterflooramplitudepercentage.cpp:88

References buildFilterFromString().

## FilterFloorAmplitudePercentage() [3/3]

pappso::FilterFloorAmplitudePercentage::FilterFloorAmplitudePercentage | ( | const FilterFloorAmplitudePercentage & | other | ) |

Definition at line 56 of file filterflooramplitudepercentage.cpp.

{
m_percentage = other.m_percentage;
}

References m_percentage.

## ~FilterFloorAmplitudePercentage()

pappso::FilterFloorAmplitudePercentage::~FilterFloorAmplitudePercentage | ( |  | ) |

virtual

Definition at line 63 of file filterflooramplitudepercentage.cpp.

{
}

## Member Function Documentation

## buildFilterFromString()

void pappso::FilterFloorAmplitudePercentage::buildFilterFromString | ( | const QString & | strBuildParams | ) |

override protected virtual

build this filter using a string

Parameters

  strBuildParams | a string coding the filter and its parameters "filterName|param1;param2;param3"

Implements pappso::FilterNameInterface.

Definition at line 88 of file filterflooramplitudepercentage.cpp.

{
// Typical string: "FloorAmplitudePercentage|15"
if(parameters.startsWith(QString("%1|").arg(name())))
{
QStringList params = parameters.split("|").back().split(";");
m_percentage = params.at(0).toDouble();
}
else
{
throw pappso::ExceptionNotRecognized(
QString(
"Building of FilterFloorAmplitudePercentage from string %1 failed")
.arg(parameters));
}
}
pappso::ExceptionNotRecognized
excetion to use when an item type is not recognized
Definition: exceptionnotrecognized.h:42
pappso::FilterFloorAmplitudePercentage::name
QString name() const override
Definition: filterflooramplitudepercentage.cpp:159

References m_percentage, and name().

Referenced by FilterFloorAmplitudePercentage().

## filter()

Trace & pappso::FilterFloorAmplitudePercentage::filter | ( | Trace & | data_points | ) | const

override virtual

Implements pappso::FilterInterface.

Definition at line 108 of file filterflooramplitudepercentage.cpp.

{
auto it_min = minYDataPoint(data_points.begin(), data_points.end());
auto it_max = maxYDataPoint(data_points.begin(), data_points.end());
if(it_min == data_points.end() || it_max == data_points.end())
return data_points;
double min = it_min->y;
double max = it_max->y;
double amplitude = max - min;
double amplitude_ratio = amplitude * m_percentage / 100;
double threshold = min + amplitude_ratio;
// Since we never remove points, we only change their y value, we can do the
// filtering inplace.
for(auto &&data_point : data_points)
{
// Change the value to be threshold (re-flooring in action).
if(data_point.y < threshold)
{
data_point.y = threshold;
}
}
return data_points;
}
pappso::maxYDataPoint
std::vector< DataPoint >::const_iterator maxYDataPoint(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
Definition: trace.cpp:139
pappso::minYDataPoint
std::vector< DataPoint >::const_iterator minYDataPoint(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
Definition: trace.cpp:117
pappso::XicExtractMethod::max
@ max
maximum of intensities

References m_percentage, pappso::max, pappso::maxYDataPoint(), and pappso::minYDataPoint().

## getPercentage()

double pappso::FilterFloorAmplitudePercentage::getPercentage | ( |  | ) | const

Definition at line 143 of file filterflooramplitudepercentage.cpp.

{
return m_percentage;
}

References m_percentage.

## name()

QString pappso::FilterFloorAmplitudePercentage::name | ( |  | ) | const

override virtual

Implements pappso::FilterNameInterface.

Definition at line 159 of file filterflooramplitudepercentage.cpp.

{
return "FloorAmplitudePercentage";
}

Referenced by buildFilterFromString(), and toString().

## operator=()

FilterFloorAmplitudePercentage & pappso::FilterFloorAmplitudePercentage::operator= | ( | const FilterFloorAmplitudePercentage & | other | ) |

Definition at line 68 of file filterflooramplitudepercentage.cpp.

{
if(&other == this)
return *this;
m_percentage = other.m_percentage;
return *this;
}

References m_percentage.

## toString()

QString pappso::FilterFloorAmplitudePercentage::toString | ( |  | ) | const

override virtual

Return a string with the textual representation of the configuration data.

Implements pappso::FilterNameInterface.

Definition at line 151 of file filterflooramplitudepercentage.cpp.

{
return QString("%1|%2").arg(name()).arg(
QString::number(m_percentage, 'f', 2));
}

References m_percentage, and name().

## Member Data Documentation

## m_percentage

double pappso::FilterFloorAmplitudePercentage::m_percentage

private

Definition at line 94 of file filterflooramplitudepercentage.h.

Referenced by FilterFloorAmplitudePercentage(), buildFilterFromString(), filter(), getPercentage(), operator=(), and toString().

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

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