29 #include "../../trace/trace.h"
31 #include "../../exception/exceptionoutofrange.h"
32 #include "../../exception/exceptionnotrecognized.h"
37 : m_halfWindowSize(half_window_size)
42 : m_halfWindowSize(other.m_halfWindowSize)
65 << data_points.size();
70 Trace old_trace(data_points);
71 auto it = old_trace.begin();
73 auto it_target = data_points.begin();
76 std::size_t loop_begin = 0;
101 while(it != old_trace.end())
136 std::vector<DataPoint>::const_iterator begin,
137 std::vector<DataPoint>::const_iterator end)
const
163 std::vector<DataPoint>::const_iterator begin,
164 std::vector<DataPoint>::const_iterator end)
const
196 std::vector<DataPoint>::const_iterator begin,
197 std::vector<DataPoint>::const_iterator end)
const
209 : m_filterMax(half_window_size), m_filterMin(half_window_size)
213 : m_filterMax(other.m_filterMax), m_filterMin(other.m_filterMin)
243 : m_filterMin(half_window_size), m_filterMax(half_window_size)
247 : m_filterMin(other.m_filterMin), m_filterMax(other.m_filterMax)
276 : m_halfWindowSize(half_window_size)
281 : m_halfWindowSize(other.m_halfWindowSize)
286 const QString &strBuildParams)
288 buildFilterFromString(strBuildParams);
293 const QString &strBuildParams)
296 if(strBuildParams.startsWith(
"antiSpike|"))
298 QStringList params = strBuildParams.split(
"|").back().split(
";");
300 m_halfWindowSize = params.at(0).toUInt();
305 QString(
"building FilterMorphoAntiSpike from string %1 is not possible")
306 .arg(strBuildParams));
313 QString strCode = QString(
"antiSpike|%1").arg(m_halfWindowSize);
346 Trace old_trace(data_points);
347 auto it = old_trace.begin();
348 auto it_target = data_points.begin();
349 auto itw = old_trace.begin();
355 while((it != old_trace.end()) &&
363 while((it != itend) && (it != old_trace.end()))
407 std::vector<DataPoint>::const_iterator begin,
408 std::vector<DataPoint>::const_iterator end)
const
439 std::vector<DataPoint>::const_iterator begin,
440 std::vector<DataPoint>::const_iterator end)
const
447 std::size_t median_half_window_size, std::size_t minmax_half_window_size)
448 : m_filterMorphoMedian(median_half_window_size),
449 m_filterMorphoMinMax(minmax_half_window_size)
455 : m_filterMorphoMedian(other.m_filterMorphoMedian),
456 m_filterMorphoMinMax(other.m_filterMorphoMinMax)
excetion to use when an item type is not recognized
anti spike filter set to zero alone values inside the window
FilterMorphoAntiSpike & operator=(const FilterMorphoAntiSpike &other)
std::size_t getHalfWindowSize() const
void buildFilterFromString(const QString &strBuildParams) override
build this filter using a string
QString toString() const override
QString name() const override
FilterMorphoAntiSpike(std::size_t half_window_size)
std::size_t m_halfWindowSize
Trace & filter(Trace &data_points) const override
compute background of a trace compute background noise on a trace
Trace & filter(Trace &data_points) const override
FilterMorphoBackground(std::size_t median_half_window_size, std::size_t minmax_half_window_size)
FilterMorphoMedian m_filterMorphoMedian
const FilterMorphoMedian & getFilterMorphoMedian() const
FilterMorphoBackground & operator=(const FilterMorphoBackground &other)
const FilterMorphoMinMax & getFilterMorphoMinMax() const
FilterMorphoMinMax m_filterMorphoMinMax
transform the trace with the maximum of the minimum equivalent of the erode filter for pictures
Trace & filter(Trace &data_points) const override
FilterMorphoMaxMin(std::size_t half_window_size)
FilterMorphoMax m_filterMax
std::size_t getMaxMinHalfEdgeWindows() const
FilterMorphoMaxMin & operator=(const FilterMorphoMaxMin &other)
FilterMorphoMin m_filterMin
transform the trace into its maximum over a window
double getWindowValue(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end) const override
std::size_t getMaxHalfEdgeWindows() const
FilterMorphoMax(std::size_t half_window_size)
FilterMorphoMax & operator=(const FilterMorphoMax &other)
mean filter apply mean of y values inside the window : this results in a kind of smoothing
FilterMorphoMean(std::size_t half_window_size)
FilterMorphoMean & operator=(const FilterMorphoMean &other)
double getWindowValue(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end) const override
std::size_t getMeanHalfEdgeWindows() const
transform the trace with the minimum of the maximum equivalent of the dilate filter for pictures
FilterMorphoMax m_filterMax
FilterMorphoMin m_filterMin
FilterMorphoMinMax(std::size_t half_window_size)
std::size_t getMinMaxHalfEdgeWindows() const
Trace & filter(Trace &data_points) const override
FilterMorphoMinMax & operator=(const FilterMorphoMinMax &other)
transform the trace into its minimum over a window
std::size_t getMinHalfEdgeWindows() const
FilterMorphoMin(std::size_t half_window_size)
double getWindowValue(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end) const override
FilterMorphoMin & operator=(const FilterMorphoMin &other)
FilterMorphoSum & operator=(const FilterMorphoSum &other)
FilterMorphoSum(std::size_t half_window_size)
double getWindowValue(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end) const override
base class that apply a signal treatment based on a window
virtual Trace & filter(Trace &data_points) const override
virtual double getWindowValue(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end) const =0
std::size_t m_halfWindowSize
FilterMorphoWindowBase(std::size_t half_window_size)
virtual std::size_t getHalfWindowSize() const
FilterMorphoWindowBase & operator=(const FilterMorphoWindowBase &other)
A simple container of DataPoint instances.
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...
std::vector< DataPoint >::iterator findDifferentYvalue(std::vector< DataPoint >::iterator begin, std::vector< DataPoint >::iterator end, const double &y_value)
find the first element in which Y is different of value
std::vector< DataPoint >::const_iterator maxYDataPoint(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
double medianYTrace(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
calculate the median of y value of a trace
double meanYTrace(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)
calculate the mean of y value of a trace
double sumYTrace(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end, double init)
calculate the sum of y value of a trace
std::vector< DataPoint >::const_iterator minYDataPoint(std::vector< DataPoint >::const_iterator begin, std::vector< DataPoint >::const_iterator end)