libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::FilterMorphoWindowBase Class Referenceabstract

base class that apply a signal treatment based on a window More...

#include <filtermorpho.h>

Inheritance diagram for pappso::FilterMorphoWindowBase:
pappso::FilterNameInterface pappso::FilterInterface pappso::FilterMorphoMax pappso::FilterMorphoMean pappso::FilterMorphoMedian pappso::FilterMorphoMin pappso::FilterMorphoSum

Public Member Functions

 FilterMorphoWindowBase (std::size_t half_window_size)
 
 FilterMorphoWindowBase (const FilterMorphoWindowBase &other)
 
virtual ~FilterMorphoWindowBase ()
 
FilterMorphoWindowBaseoperator= (const FilterMorphoWindowBase &other)
 
virtual Tracefilter (Trace &data_points) const override
 
virtual std::size_t getHalfWindowSize () const
 
virtual QString name () const override
 
virtual QString toString () const override
 
- 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
 
virtual double getWindowValue (std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end) const =0
 

Protected Attributes

std::size_t m_halfWindowSize = 0
 

Detailed Description

base class that apply a signal treatment based on a window

Definition at line 40 of file filtermorpho.h.

Constructor & Destructor Documentation

◆ FilterMorphoWindowBase() [1/2]

◆ FilterMorphoWindowBase() [2/2]

FilterMorphoWindowBase::FilterMorphoWindowBase ( const FilterMorphoWindowBase & other)

Definition at line 40 of file filtermorpho.cpp.

42{
43}

References FilterMorphoWindowBase(), and m_halfWindowSize.

◆ ~FilterMorphoWindowBase()

virtual pappso::FilterMorphoWindowBase::~FilterMorphoWindowBase ( )
inlinevirtual

Definition at line 46 of file filtermorpho.h.

46{};

Member Function Documentation

◆ buildFilterFromString()

void pappso::FilterMorphoWindowBase::buildFilterFromString ( const QString & strBuildParams)
overrideprotectedvirtual

build this filter using a string

Parameters
strBuildParamsa string coding the filter and its parameters "filterName|param1;param2;param3"

Implements pappso::FilterNameInterface.

Definition at line 59 of file filtermorpho.cpp.

60{
61}

◆ filter()

Trace & FilterMorphoWindowBase::filter ( Trace & data_points) const
overridevirtual

Implements pappso::FilterInterface.

Definition at line 77 of file filtermorpho.cpp.

78{
79
80 qDebug() << " " << m_halfWindowSize << " data_points.size()" << data_points.size();
81 if(m_halfWindowSize == 0)
82 return data_points;
83 if(data_points.size() <= m_halfWindowSize)
84 return data_points;
85 Trace old_trace(data_points);
86 auto it = old_trace.begin();
87 auto itend = old_trace.end() - m_halfWindowSize - 1;
88 auto it_target = data_points.begin();
89
90
91 std::size_t loop_begin = 0;
92 while((it != itend) && (loop_begin < m_halfWindowSize))
93 {
94 // maxYDataPoint(it_begin, it + m_halfWindowSize + 1);
95 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
96 // << it->x << " " << m_halfWindowSize;
97 // it_target->x = it->x;
98 it_target->y = getWindowValue(old_trace.begin(), it + m_halfWindowSize + 1);
99 it++;
100 it_target++;
101 loop_begin++;
102 }
103 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
104 while(it != itend)
105 {
106 // it_target->x = it->x;
107 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
108 // << it->x;
109 it_target->y = getWindowValue(it - m_halfWindowSize, it + m_halfWindowSize + 1);
110 it++;
111 it_target++;
112 }
113 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
114 while(it != old_trace.end())
115 {
116 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
117 // << it->x;
118 // it_target->x = it->x;
119 it_target->y = getWindowValue(it - m_halfWindowSize, old_trace.end());
120 it++;
121 it_target++;
122 }
123 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
124 // problem with move or swap : this lead to segmentation faults in some cases
125 // data_points = std::move(new_trace);
126 qDebug();
127 return data_points;
128}
virtual double getWindowValue(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end) const =0

References getWindowValue(), and m_halfWindowSize.

Referenced by pappso::masschroq::CborOutputStream::writeMsRunRetentionTime().

◆ getHalfWindowSize()

std::size_t FilterMorphoWindowBase::getHalfWindowSize ( ) const
virtual

◆ getWindowValue()

virtual double pappso::FilterMorphoWindowBase::getWindowValue ( std::vector< DataPoint >::const_iterator begin,
std::vector< DataPoint >::const_iterator end ) const
protectedpure virtual

◆ name()

QString pappso::FilterMorphoWindowBase::name ( ) const
overridevirtual

Implements pappso::FilterNameInterface.

Reimplemented in pappso::FilterMorphoMean.

Definition at line 64 of file filtermorpho.cpp.

65{
66 return "nose";
67}

◆ operator=()

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

Definition at line 51 of file filtermorpho.cpp.

52{
54
55 return *this;
56}

References FilterMorphoWindowBase(), and m_halfWindowSize.

◆ toString()

QString pappso::FilterMorphoWindowBase::toString ( ) const
overridevirtual

Implements pappso::FilterNameInterface.

Reimplemented in pappso::FilterMorphoMean.

Definition at line 70 of file filtermorpho.cpp.

71{
72 return "nose";
73}

Member Data Documentation

◆ m_halfWindowSize


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