libpappsomspp
Library for mass spectrometry
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
 

Private Attributes

double m_minX
 
double m_maxX
 

Detailed Description

Definition at line 82 of file filterresample.h.

Constructor & Destructor Documentation

◆ FilterResampleKeepXRange() [1/2]

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

Definition at line 139 of file filterresample.cpp.

140  : m_minX(min_x), m_maxX(max_x)
141 {
142 }

◆ FilterResampleKeepXRange() [2/2]

FilterResampleKeepXRange::FilterResampleKeepXRange ( const FilterResampleKeepXRange other)

Definition at line 144 of file filterresample.cpp.

146  : FilterResampleKeepXRange(other.m_minX, other.m_maxX)
147 {
148 }

◆ ~FilterResampleKeepXRange()

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

Definition at line 91 of file filterresample.h.

91 {};

Member Function Documentation

◆ filter()

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

Implements pappso::FilterInterface.

Definition at line 162 of file filterresample.cpp.

163 {
164  auto begin_it =
165  findFirstEqualOrGreaterX(spectrum.begin(), spectrum.end(), m_minX);
166  // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
167  //<< " begin_it->x=" << begin_it->x;
168  auto end_it = findFirstGreaterX(begin_it, spectrum.end(), m_maxX);
169  // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
170  //<< " end_it->x=" << end_it->x;
171 
172  spectrum.erase(end_it, spectrum.end());
173  spectrum.erase(spectrum.begin(), begin_it);
174  // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
175  //<< " spectrum.size()=" << spectrum.size();
176 
177  return spectrum;
178 }

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

Referenced by pappso::MassSpectrumCombiner::combine(), pappso::TracePlusCombiner::combine(), pappso::MassSpectrumFilterResampleKeepMzRange::filter(), and pappso::MsRunXicExtractor::getXicCstSPtr().

◆ operator=()

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

Definition at line 152 of file filterresample.cpp.

153 {
154  m_minX = other.m_minX;
155  m_maxX = other.m_maxX;
156 
157  return *this;
158 }

References m_maxX, and m_minX.

Member Data Documentation

◆ m_maxX

double pappso::FilterResampleKeepXRange::m_maxX
private

Definition at line 86 of file filterresample.h.

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

◆ m_minX

double pappso::FilterResampleKeepXRange::m_minX
private

Definition at line 85 of file filterresample.h.

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


The documentation for this class was generated from the following files:
pappso::FilterResampleKeepXRange::m_minX
double m_minX
Definition: filterresample.h:85
pappso::FilterResampleKeepXRange::m_maxX
double m_maxX
Definition: filterresample.h:86
pappso::FilterResampleKeepXRange::FilterResampleKeepXRange
FilterResampleKeepXRange(double min_x=0, double max_x=0)
Definition: filterresample.cpp:139
pappso::findFirstEqualOrGreaterX
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:31
pappso::findFirstGreaterX
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:59