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 86 of file filterresample.h.

Constructor & Destructor Documentation

◆ FilterResampleKeepXRange() [1/2]

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

Definition at line 142 of file filterresample.cpp.

◆ FilterResampleKeepXRange() [2/2]

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

Definition at line 147 of file filterresample.cpp.

149 : m_minX(other.m_minX), m_maxX(other.m_maxX)
150{
151}

◆ ~FilterResampleKeepXRange()

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

Definition at line 95 of file filterresample.h.

95{};

Member Function Documentation

◆ filter()

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

Implements pappso::FilterInterface.

Definition at line 168 of file filterresample.cpp.

169{
170 // qDebug() << "The range to keep:" << m_minX << "-" << m_maxX;
171
172 auto begin_it =
173 findFirstEqualOrGreaterX(spectrum.begin(), spectrum.end(), m_minX);
174
175 // qDebug() << "Found begin iterator (for m_minX) having:" << begin_it->x
176 //<< "x (m/z) value";
177
178 auto end_it = findFirstGreaterX(begin_it, spectrum.end(), m_maxX);
179
180 if(end_it == spectrum.end())
181 {
182 // qDebug() << "The end iterator (for m_maxX) is the end(). The prev "
183 //"iterator has"
184 //<< std::prev(end_it)->x << " x(m / z) value.";
185 }
186 else
187 {
188 // qDebug() << "Found end iterator (for m_maxX) having:" << end_it->x
189 //<< "x (m/z) value";
190 }
191
192 // qDebug() << "Only keeping range" << begin_it->x << "-"
193 //<< std::prev(end_it)->x;
194
195 spectrum.erase(end_it, spectrum.end());
196 spectrum.erase(spectrum.begin(), begin_it);
197
198 return spectrum;
199}
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
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:99

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

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

◆ operator=()

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

Definition at line 155 of file filterresample.cpp.

156{
157 if(&other == this)
158 return *this;
159
160 m_minX = other.m_minX;
161 m_maxX = other.m_maxX;
162
163 return *this;
164}

References m_maxX, and m_minX.

Member Data Documentation

◆ m_maxX

double pappso::FilterResampleKeepXRange::m_maxX
private

Definition at line 90 of file filterresample.h.

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

◆ m_minX

double pappso::FilterResampleKeepXRange::m_minX
private

Definition at line 89 of file filterresample.h.

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


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