libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::FilterResampleKeepXRange Class Reference

#include <filterresample.h>

Inheritance diagram for pappso::FilterResampleKeepXRange:
pappso::FilterInterface

Public Member Functions

 FilterResampleKeepXRange (double min_x=0, double max_x=0)
 FilterResampleKeepXRange (const FilterResampleKeepXRange &other)
virtual ~FilterResampleKeepXRange ()
FilterResampleKeepXRangeoperator= (const FilterResampleKeepXRange &other)
Tracefilter (Trace &trace) const override
Public Member Functions inherited from pappso::FilterInterface
virtual ~FilterInterface ()

Private Attributes

double m_minX
double m_maxX

Detailed Description

Definition at line 88 of file filterresample.h.

Constructor & Destructor Documentation

◆ FilterResampleKeepXRange() [1/2]

pappso::FilterResampleKeepXRange::FilterResampleKeepXRange ( double min_x = 0,
double max_x = 0 )

Definition at line 134 of file filterresample.cpp.

References m_maxX, and m_minX.

Referenced by FilterResampleKeepXRange(), and operator=().

◆ FilterResampleKeepXRange() [2/2]

pappso::FilterResampleKeepXRange::FilterResampleKeepXRange ( const FilterResampleKeepXRange & other)

Definition at line 139 of file filterresample.cpp.

140 : m_minX(other.m_minX), m_maxX(other.m_maxX)
141{
142}

References FilterResampleKeepXRange(), m_maxX, and m_minX.

◆ ~FilterResampleKeepXRange()

virtual pappso::FilterResampleKeepXRange::~FilterResampleKeepXRange ( )
inlinevirtual

Definition at line 97 of file filterresample.h.

97{};

Member Function Documentation

◆ filter()

Trace & pappso::FilterResampleKeepXRange::filter ( Trace & trace) const
overridevirtual

Implements pappso::FilterInterface.

Definition at line 159 of file filterresample.cpp.

160{
161 // qDebug() << "The range to keep:" << m_minX << "-" << m_maxX;
162
163 auto begin_it = findFirstEqualOrGreaterX(spectrum.begin(), spectrum.end(), m_minX);
164
165 // qDebug() << "Found begin iterator (for m_minX) having:" << begin_it->x
166 //<< "x (m/z) value";
167
168 auto end_it = findFirstGreaterX(begin_it, spectrum.end(), m_maxX);
169
170 if(end_it == spectrum.end())
171 {
172 // qDebug() << "The end iterator (for m_maxX) is the end(). The prev "
173 //"iterator has"
174 //<< std::prev(end_it)->x << " x(m / z) value.";
175 }
176 else
177 {
178 // qDebug() << "Found end iterator (for m_maxX) having:" << end_it->x
179 //<< "x (m/z) value";
180 }
181
182 // qDebug() << "Only keeping range" << begin_it->x << "-"
183 //<< std::prev(end_it)->x;
184
185 spectrum.erase(end_it, spectrum.end());
186 spectrum.erase(spectrum.begin(), begin_it);
187
188 return spectrum;
189}
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:65
std::vector< DataPoint >::iterator findFirstGreaterX(std::vector< DataPoint >::iterator begin, std::vector< DataPoint >::iterator end, const double &value)
find the first element in which X is greater than the value searched important : it implies that Trac...
Definition trace.cpp:93

References pappso::findFirstEqualOrGreaterX(), pappso::findFirstGreaterX(), m_maxX, and m_minX.

Referenced by pappso::MsRunXicExtractor::extractOneXicCoord(), and pappso::FilterResampleKeepPointInPolygon::filter().

◆ operator=()

FilterResampleKeepXRange & pappso::FilterResampleKeepXRange::operator= ( const FilterResampleKeepXRange & other)

Definition at line 146 of file filterresample.cpp.

147{
148 if(&other == this)
149 return *this;
150
151 m_minX = other.m_minX;
152 m_maxX = other.m_maxX;
153
154 return *this;
155}

References FilterResampleKeepXRange(), m_maxX, and m_minX.

Member Data Documentation

◆ m_maxX

double pappso::FilterResampleKeepXRange::m_maxX
private

◆ m_minX

double pappso::FilterResampleKeepXRange::m_minX
private

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