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 ~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  Trace old_trace(data_points);
69  auto it = old_trace.begin();
70  auto itend = old_trace.end() - m_halfWindowSize - 1;
71  auto it_target = data_points.begin();
72 
73 
74  std::size_t loop_begin = 0;
75  while((it != itend) && (loop_begin < m_halfWindowSize))
76  {
77  // maxYDataPoint(it_begin, it + m_halfWindowSize + 1);
78  // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
79  // << it->x << " " << m_halfWindowSize;
80  // it_target->x = it->x;
81  it_target->y =
82  getWindowValue(old_trace.begin(), it + m_halfWindowSize + 1);
83  it++;
84  it_target++;
85  loop_begin++;
86  }
87  // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
88  while(it != itend)
89  {
90  // it_target->x = it->x;
91  // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
92  // << it->x;
93  it_target->y =
95  it++;
96  it_target++;
97  }
98  // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
99  while(it != old_trace.end())
100  {
101  // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__ << " "
102  // << it->x;
103  // it_target->x = it->x;
104  it_target->y = getWindowValue(it - m_halfWindowSize, old_trace.end());
105  it++;
106  it_target++;
107  }
108  // qDebug() << __FILE__ << " " << __FUNCTION__ << " " << __LINE__;
109  // problem with move or swap : this lead to segmentation faults in some cases
110  // data_points = std::move(new_trace);
111  qDebug();
112  return data_points;
113 }
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:132

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: