libpappsomspp
Library for mass spectrometry
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::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
 
- Public Member Functions inherited from pappso::FilterInterface
virtual Tracefilter (Trace &data_points) const =0
 
virtual ~FilterInterface ()
 

Protected Member Functions

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::FilterMorphoWindowBase ( std::size_t  half_window_size)

Definition at line 36 of file filtermorpho.cpp.

37 : m_halfWindowSize(half_window_size)
38{
39}

◆ FilterMorphoWindowBase() [2/2]

FilterMorphoWindowBase::FilterMorphoWindowBase ( const FilterMorphoWindowBase other)

Definition at line 40 of file filtermorpho.cpp.

43{
44}

◆ ~FilterMorphoWindowBase()

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

Definition at line 52 of file filtermorpho.h.

52{};

Member Function Documentation

◆ filter()

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

Implements pappso::FilterInterface.

Definition at line 61 of file filtermorpho.cpp.

62{
63
64 qDebug() << " " << m_halfWindowSize << " data_points.size()"
65 << data_points.size();
66 if(m_halfWindowSize == 0)
67 return data_points;
68 if(data_points.size() <= m_halfWindowSize)
69 return data_points;
70 Trace old_trace(data_points);
71 auto it = old_trace.begin();
72 auto itend = old_trace.end() - m_halfWindowSize - 1;
73 auto it_target = data_points.begin();
74
75
76 std::size_t loop_begin = 0;
77 while((it != itend) && (loop_begin < m_halfWindowSize))
78 {
79 // maxYDataPoint(it_begin, it + m_halfWindowSize + 1);
80 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
81 // << it->x << " " << m_halfWindowSize;
82 // it_target->x = it->x;
83 it_target->y =
84 getWindowValue(old_trace.begin(), it + m_halfWindowSize + 1);
85 it++;
86 it_target++;
87 loop_begin++;
88 }
89 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
90 while(it != itend)
91 {
92 // it_target->x = it->x;
93 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
94 // << it->x;
95 it_target->y =
97 it++;
98 it_target++;
99 }
100 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
101 while(it != old_trace.end())
102 {
103 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
104 // << it->x;
105 // it_target->x = it->x;
106 it_target->y = getWindowValue(it - m_halfWindowSize, old_trace.end());
107 it++;
108 it_target++;
109 }
110 // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
111 // problem with move or swap : this lead to segmentation faults in some cases
112 // data_points = std::move(new_trace);
113 qDebug();
114 return data_points;
115}
virtual double getWindowValue(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end) const =0
A simple container of DataPoint instances.
Definition: trace.h:148

References getWindowValue(), and m_halfWindowSize.

Referenced by pappso::TraceDetectionMoulon::detect(), pappso::TraceDetectionZivy::detect(), pappso::FilterMorphoMinMax::filter(), pappso::FilterMorphoMaxMin::filter(), and pappso::FilterMorphoBackground::filter().

◆ getHalfWindowSize()

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

Definition at line 46 of file filtermorpho.cpp.

47{
48 return m_halfWindowSize;
49}

References m_halfWindowSize.

◆ getWindowValue()

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

◆ operator=()

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

Definition at line 52 of file filtermorpho.cpp.

53{
55
56 return *this;
57}

References m_halfWindowSize.

Member Data Documentation

◆ m_halfWindowSize


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