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

Sets the maximum intensity of the trace to the provided value. More...

`#include <filternormalizeintensities.h>`

Inheritance diagram for pappso::FilterNormalizeIntensities:

## Public Member Functions

| FilterNormalizeIntensities (double new_max_y_value)
| FilterNormalizeIntensities (const QString &parameters)
| FilterNormalizeIntensities (const FilterNormalizeIntensities &other)
virtual | ~FilterNormalizeIntensities ()
FilterNormalizeIntensities & | operator= (const FilterNormalizeIntensities &other)
Trace & | filter (Trace &data_points) const override
QString | name () const override
QString | toString () const override
| Return a string with the textual representation of the configuration data.
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

## Private Attributes

double | m_newYMax

## Static Private Attributes

static constexpr double | nan = std::numeric_limits<double>::quiet_NaN()

## Detailed Description

Sets the maximum intensity of the trace to the provided value.

All the other values are modified by applying the same modification ratio.

The amplitude of the trace is computed (maxValue - minValue) The new maxValue is set to the required intensity. All the other data points have their intensity modified:

new_intensity = previous_intensity / old_max_value * new_max_value

Definition at line 67 of file filternormalizeintensities.h.

## Constructor & Destructor Documentation

## FilterNormalizeIntensities() [1/3]

pappso::FilterNormalizeIntensities::FilterNormalizeIntensities | ( | double | new_max_y_value | ) |

Definition at line 50 of file filternormalizeintensities.cpp.

: m_newYMax(new_max_y_value)
{
}
pappso::FilterNormalizeIntensities::m_newYMax
double m_newYMax
Definition filternormalizeintensities.h:89

## FilterNormalizeIntensities() [2/3]

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

Definition at line 56 of file filternormalizeintensities.cpp.

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

References buildFilterFromString().

## FilterNormalizeIntensities() [3/3]

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

Definition at line 63 of file filternormalizeintensities.cpp.

{
m_newYMax = other.m_newYMax;
}

References m_newYMax.

## ~FilterNormalizeIntensities()

pappso::FilterNormalizeIntensities::~FilterNormalizeIntensities | ( |  | ) |

virtual

Definition at line 70 of file filternormalizeintensities.cpp.

{
}

## Member Function Documentation

## buildFilterFromString()

void pappso::FilterNormalizeIntensities::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 filternormalizeintensities.cpp.

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

References m_newYMax, and name().

Referenced by FilterNormalizeIntensities().

## filter()

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

override virtual

Implements pappso::FilterInterface.

Definition at line 107 of file filternormalizeintensities.cpp.

{
// Start by looking at the most intense data point (greatest y value of the
// whole trace)
auto max_dp_iter = maxYDataPoint(trace.cbegin(), trace.cend());
if(max_dp_iter == trace.cend())
throw pappso::ExceptionNotPossible(
QString("Failed to find the max intensity data point in the trace."));
if(!max_dp_iter->y)
throw pappso::ExceptionNotPossible(
QString("The max intensity data point in the trace has intensity 0."));
double ratio = m_newYMax / max_dp_iter->y;
for(DataPoint &dp : trace)
{
dp.y *= ratio;
}
// #if 0
max_dp_iter = maxYDataPoint(trace.cbegin(), trace.cend());
qDebug() << "Now max int:" << max_dp_iter->y;
// #endif
return trace;
}
pappso::ExceptionNotPossible
Definition exceptionnotpossible.h:29
pappso::maxYDataPoint
std::vector< DataPoint >::const_iterator maxYDataPoint(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
Definition trace.cpp:180

References m_newYMax, and pappso::maxYDataPoint().

## name()

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

override virtual

Implements pappso::FilterNameInterface.

Definition at line 148 of file filternormalizeintensities.cpp.

{
return "FilterNormalizeIntensities";
}

Referenced by buildFilterFromString(), and toString().

## operator=()

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

Definition at line 76 of file filternormalizeintensities.cpp.

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

References m_newYMax.

## toString()

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

override virtual

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

Implements pappso::FilterNameInterface.

Definition at line 141 of file filternormalizeintensities.cpp.

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

References m_newYMax, and name().

## Member Data Documentation

## m_newYMax

double pappso::FilterNormalizeIntensities::m_newYMax

private

Definition at line 89 of file filternormalizeintensities.h.

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

## nan

constexpr double pappso::FilterNormalizeIntensities::nan = std::numeric_limits<double>::quiet_NaN()

static constexpr private

Definition at line 87 of file filternormalizeintensities.h.

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

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