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.

61{
62}

◆ filter()

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

Implements pappso::FilterInterface.

Definition at line 78 of file filtermorpho.cpp.

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

66{
67 return "nose";
68}

◆ 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 71 of file filtermorpho.cpp.

72{
73 return "nose";
74}

Member Data Documentation

◆ m_halfWindowSize


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