42 #include "../../exception/exceptionnotrecognized.h"
45 #include "../../trace/maptrace.h"
53 double mean,
double std_dev,
double threshold)
62 const QString ¶meters)
99 const QString ¶meters)
102 if(parameters.startsWith(QString(
"%1|").arg(
name())))
104 QStringList params = parameters.split(
"|").back().split(
";");
114 "Building of FilterLowIntensitySignalRemoval from string %1 failed")
129 std::size_t trace_size = trace.size();
150 bool was_ascending_to_apex =
false;
153 ApicesSPtr cluster_apices = std::make_shared<ClusterApices>();
173 was_ascending_to_apex =
true;
187 if(!was_ascending_to_apex)
227 if(!cluster_apices->size())
228 qFatal(
"Cannot be that the apices has no apex.");
240 cluster_apices = std::make_shared<ClusterApices>();
328 if(cluster_apices->size())
330 "At this point, the apices should be new and "
360 was_ascending_to_apex =
false;
380 if(cluster_apices->size())
387 Trace::const_iterator
389 Trace::const_iterator iter,
390 double distance_threshold)
396 Trace::const_iterator init_iter = iter;
398 if(iter == trace.cbegin())
402 Trace::const_iterator prev_iter = init_iter;
404 Trace::const_iterator last_apex_iter = init_iter;
407 bool was_ascending_to_apex =
false;
412 while(iter != trace.cbegin())
417 if(abs(init_iter->x - iter->x) >= distance_threshold)
418 return last_apex_iter;
420 if(iter->y > prev_iter->y)
423 was_ascending_to_apex =
true;
429 if(was_ascending_to_apex)
437 last_apex_iter = prev_iter;
452 return last_apex_iter;
456 Trace::const_iterator
458 Trace::const_iterator iter,
459 double distance_threshold)
465 Trace::const_iterator init_iter = iter;
467 if(iter == trace.cend())
471 Trace::const_iterator prev_iter = init_iter;
473 Trace::const_iterator last_apex_iter = init_iter;
476 bool was_ascending_to_apex =
false;
481 while(iter != trace.cend())
490 if(abs(init_iter->x - iter->x) >= distance_threshold)
491 return last_apex_iter;
493 if(iter->y > prev_iter->y)
496 was_ascending_to_apex =
true;
502 if(was_ascending_to_apex)
510 last_apex_iter = prev_iter;
521 return last_apex_iter;
554 Trace::const_iterator left_begin_iter = trace.cend();
555 Trace::const_iterator right_end_iter = trace.cend();
563 Trace::const_iterator begin_iter = *(cluster_apices->begin());
564 Trace::const_iterator end_iter = *(std::prev(cluster_apices->end()));
579 for(Trace::const_iterator iter = left_begin_iter; iter != right_end_iter;
582 map_trace[iter->x] = iter->y;
588 map_trace[left_begin_iter->x] = 0;
589 map_trace[std::prev(right_end_iter)->x] = 0;
613 if(trace.size() <= 2)
634 trace = std::move(reconstructed_trace);
651 return QString(
"%1|%2").arg(
name()).arg(QString::number(
m_threshold,
'f', 2));
658 return "FilterLowIntensitySignalRemoval";
excetion to use when an item type is not recognized
Redefines the floor intensity of the Trace.
Trace & nonConstFilter(Trace &data_points)
std::shared_ptr< ClusterApices > ApicesSPtr
Trace::const_iterator backwardFindApex(const Trace &trace, Trace::const_iterator iter, double distance_threshold)
QString name() const override
FilterLowIntensitySignalRemoval(double mean, double std_dev, double threshold)
double getThreshold() const
Trace reconstructTrace(const Trace &trace)
Trace & filter(Trace &data_points) const override
Trace::const_iterator forwardFindApex(const Trace &trace, Trace::const_iterator iter, double distance_threshold)
constexpr static double INTRA_CLUSTER_INTER_PEAK_DISTANCE
std::size_t detectClusterApices(const Trace &trace)
FilterLowIntensitySignalRemoval & operator=(const FilterLowIntensitySignalRemoval &other)
virtual ~FilterLowIntensitySignalRemoval()
void buildFilterFromString(const QString &strBuildParams) override
build this filter using a string
QString toString() const override
Return a string with the textual representation of the configuration data.
std::vector< ApicesSPtr > m_clusters
A simple container of DataPoint instances.
tries to keep as much as possible monoisotopes, removing any possible C13 peaks and changes multichar...