pappsomspp
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 ()
 
Tracefilter (Trace &trace) const override
 

Private Attributes

double m_min_x
 
double m_max_x
 

Detailed Description

Definition at line 93 of file filterresample.h.

Constructor & Destructor Documentation

◆ FilterResampleKeepXRange() [1/2]

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

Definition at line 120 of file filterresample.cpp.

122  : m_min_x(min_x), m_max_x(max_x)
123 {

◆ FilterResampleKeepXRange() [2/2]

FilterResampleKeepXRange::FilterResampleKeepXRange ( const FilterResampleKeepXRange other)

Definition at line 125 of file filterresample.cpp.

129 {

◆ ~FilterResampleKeepXRange()

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

Definition at line 102 of file filterresample.h.

105 : public MassSpectrumFilterInterface

Member Function Documentation

◆ filter()

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

Implements pappso::FilterInterface.

Definition at line 133 of file filterresample.cpp.

135 {
136  auto begin_it =
137  findFirstEqualOrGreaterX(spectrum.begin(), spectrum.end(), m_min_x);
138  // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
139  //<< " begin_it->x=" << begin_it->x;
140  auto end_it = findFirstGreaterX(begin_it, spectrum.end(), m_max_x);
141  // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
142  //<< " end_it->x=" << end_it->x;
143 
144  spectrum.erase(end_it, spectrum.end());
145  spectrum.erase(spectrum.begin(), begin_it);
146  // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__
147  //<< " spectrum.size()=" << spectrum.size();
148 
149  return spectrum;

References pappso::findFirstEqualOrGreaterX(), pappso::findFirstGreaterX(), m_max_x, and m_min_x.

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

Member Data Documentation

◆ m_max_x

double pappso::FilterResampleKeepXRange::m_max_x
private

Definition at line 97 of file filterresample.h.

Referenced by filter().

◆ m_min_x

double pappso::FilterResampleKeepXRange::m_min_x
private

Definition at line 96 of file filterresample.h.

Referenced by filter().


The documentation for this class was generated from the following files:
pappso::FilterResampleKeepXRange::FilterResampleKeepXRange
FilterResampleKeepXRange(double min_x=0, double max_x=0)
Definition: filterresample.cpp:120
pappso::FilterResampleKeepXRange::m_min_x
double m_min_x
Definition: filterresample.h:96
pappso::FilterResampleKeepXRange::m_max_x
double m_max_x
Definition: filterresample.h:97
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:29
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:57