libpappsomspp
Library for mass spectrometry
Loading...
Searching...
No Matches
pappso::FilterResampleKeepPointInPolygon Class Reference

#include <filterresample.h>

Inheritance diagram for pappso::FilterResampleKeepPointInPolygon:
pappso::FilterInterface

Public Member Functions

 FilterResampleKeepPointInPolygon ()
 
 FilterResampleKeepPointInPolygon (IntegrationScopeBaseSPtr integration_scope_sp, DataKind data_kind)
 
 FilterResampleKeepPointInPolygon (const IntegrationScopeSpecVector &integration_scope_specs)
 
 FilterResampleKeepPointInPolygon (const FilterResampleKeepPointInPolygon &other)
 
virtual ~FilterResampleKeepPointInPolygon ()
 
void newSelectionPolygonSpec (const IntegrationScopeSpec &integration_scope_spec)
 
FilterResampleKeepPointInPolygonoperator= (const FilterResampleKeepPointInPolygon &other)
 
Tracefilter (Trace &trace) const override
 
Tracefilter (Trace &trace, double dt_value, double rt_value) const
 
- Public Member Functions inherited from pappso::FilterInterface
virtual ~FilterInterface ()
 

Private Attributes

IntegrationScopeSpecVector m_integrationScopeSpecs
 
double m_lowestMz = std::numeric_limits<double>::max()
 
double m_greatestMz = std::numeric_limits<double>::min()
 

Detailed Description

Definition at line 107 of file filterresample.h.

Constructor & Destructor Documentation

◆ FilterResampleKeepPointInPolygon() [1/4]

pappso::FilterResampleKeepPointInPolygon::FilterResampleKeepPointInPolygon ( )

Definition at line 244 of file filterresample.cpp.

245{
246}

◆ FilterResampleKeepPointInPolygon() [2/4]

pappso::FilterResampleKeepPointInPolygon::FilterResampleKeepPointInPolygon ( IntegrationScopeBaseSPtr integration_scope_sp,
DataKind data_kind )

Definition at line 249 of file filterresample.cpp.

251{
252 m_integrationScopeSpecs.push_back(
253 IntegrationScopeSpec(integration_scope_sp, data_kind));
254
255 QPointF point;
256 if(!m_integrationScopeSpecs.front().integrationScopeSPtr->getPoint(point))
257 qFatal("Failed to get point.");
258 m_lowestMz = point.y();
259
260 double height;
261 if(!m_integrationScopeSpecs.front().integrationScopeSPtr->getHeight(height))
262 qFatal("Failed to get height.");
263 m_greatestMz = m_lowestMz + height;
264}
IntegrationScopeSpecVector m_integrationScopeSpecs

References m_greatestMz, m_integrationScopeSpecs, and m_lowestMz.

◆ FilterResampleKeepPointInPolygon() [3/4]

pappso::FilterResampleKeepPointInPolygon::FilterResampleKeepPointInPolygon ( const IntegrationScopeSpecVector & integration_scope_specs)

Definition at line 267 of file filterresample.cpp.

269{
270 // qDebug();
271
272 m_integrationScopeSpecs.assign(integration_scope_specs.begin(),
273 integration_scope_specs.end());
274
275 for(auto &&item : m_integrationScopeSpecs)
276 {
277 if(item.integrationScopeSPtr->isRectangle())
278 {
279 // qDebug() << "item is Rectangle.";
280
281 QPointF point;
282 if(!item.integrationScopeSPtr->getPoint(point))
283 qFatal("Failed to get point.");
284 m_lowestMz = std::min(m_lowestMz, point.y());
285
286 double height;
287 if(!item.integrationScopeSPtr->getHeight(height))
288 qFatal("Failed to get height.");
289 m_greatestMz = std::max(m_greatestMz, m_lowestMz + height);
290 }
291 else
292 {
293 if(!item.integrationScopeSPtr->isRhomboid())
294 qFatal(
295 "If integration scope is not Rectangle, then it must be "
296 "Rhomboid.");
297
298 // qDebug() << "item is Rhomboid.";
299
300 QPointF point;
301
302 // Because the mz scale is on the coordinate, we ask for
303 // bottom-most and top-most points of the rhomboid polygon.
304
305 if(!item.integrationScopeSPtr->getBottomMostPoint(point))
306 qFatal("Failed to get point.");
307 m_lowestMz = std::min(m_lowestMz, point.y());
308
309 if(!item.integrationScopeSPtr->getTopMostPoint(point))
310 qFatal("Failed to get point.");
311 m_greatestMz = std::max(m_greatestMz, point.y());
312 }
313 }
314}

References m_greatestMz, m_integrationScopeSpecs, and m_lowestMz.

◆ FilterResampleKeepPointInPolygon() [4/4]

pappso::FilterResampleKeepPointInPolygon::FilterResampleKeepPointInPolygon ( const FilterResampleKeepPointInPolygon & other)

Definition at line 317 of file filterresample.cpp.

319{
320 // qDebug();
321
322 m_integrationScopeSpecs.assign(other.m_integrationScopeSpecs.begin(),
323 other.m_integrationScopeSpecs.end());
324
325 for(auto &&item : m_integrationScopeSpecs)
326 {
327 QPointF point;
328 if(!item.integrationScopeSPtr->getPoint(point))
329 qFatal("Failed to get point.");
330 m_lowestMz = std::min(m_lowestMz, point.y());
331
332 double height;
333 if(!item.integrationScopeSPtr->getHeight(height))
334 qFatal("Failed to get height.");
335 m_greatestMz = std::max(m_greatestMz, m_lowestMz + height);
336 }
337}

References m_greatestMz, m_integrationScopeSpecs, and m_lowestMz.

◆ ~FilterResampleKeepPointInPolygon()

virtual pappso::FilterResampleKeepPointInPolygon::~FilterResampleKeepPointInPolygon ( )
inlinevirtual

Definition at line 121 of file filterresample.h.

121{};

Member Function Documentation

◆ filter() [1/2]

Trace & pappso::FilterResampleKeepPointInPolygon::filter ( Trace & trace) const
overridevirtual

Implements pappso::FilterInterface.

Definition at line 377 of file filterresample.cpp.

378{
379 qFatal("Programming error.");
380 return trace;
381}

◆ filter() [2/2]

Trace & pappso::FilterResampleKeepPointInPolygon::filter ( Trace & trace,
double dt_value,
double rt_value ) const

Definition at line 385 of file filterresample.cpp.

388{
389 // Each time a new integration scope spec is added, the lowest and greatest
390 // m/z values are computed. We use these values to remove from the spectrum
391 // all the points that are outside of that lowest-gratest range.
392
393 // Find the iterator to the most front of the DataPoint vector (mass
394 // spectrum).
395
396 // Note that the m_lowestMz and m_greatestMz are set during construction of
397 // this FilterResampleKeepPointInPolygon filter using the
398 // integration scope specs.
399
400 // qDebug() << "The lowest and greatest m/z values:" << m_lowestMz << "and"
401 //<< m_greatestMz;
402
403 // Start by filtering away all the data points outside of the
404 // [m_lowestMz--m_greatestMz] range.
405
406 FilterResampleKeepXRange the_filter(m_lowestMz, m_greatestMz);
407
408 trace = the_filter.filter(trace);
409
410 // Now iterate in all the data points remaining in the trace and for each
411 // point craft a "virtual" point using the dt|rt value and the m/z value of
412 // the data point (data_point.x).
413
414 auto begin_it = trace.begin();
415 auto end_it = trace.end();
416
417 // qDebug() << "Iterating in the m/z range:" << begin_it->x << "-"
418 //<< std::prev(end_it)->x;
419
420 // Start at the end of the range. The iter is outside of the requested range,
421 // in fact, as shown using iter-- below.
422 auto iter = end_it;
423
424 while(iter > begin_it)
425 {
426 // Immediately go to the last data point of the desired iteration range of
427 // the trace that we need to filter. Remember that end() is not pointing
428 // to any vector item, but past the last one.
429 iter--;
430
431 // qDebug() << "Iterating in trace data point with m/z value:" << iter->x;
432
433 // Now that we have the m/z value, we can check it, in combination with
434 // the value in the selection polygon spec (to make a point) against the
435 // various selection polygon specs in our member vector.
436
437 double checked_value;
438
439 for(auto &&spec : m_integrationScopeSpecs)
440 {
441 // qDebug() << "Iterating in selection polygon spec:" <<
442 // spec.toString();
443
444 if(spec.dataKind == DataKind::dt)
445 {
446 if(dt_value == -1)
447 qFatal("Programming error.");
448
449 checked_value = dt_value;
450
451 // qDebug() << "The data kind: dt.";
452 }
453 else if(spec.dataKind == DataKind::rt)
454 {
455 checked_value = rt_value;
456
457 // qDebug() << "The data kind: rt.";
458 }
459 else
460 qFatal("Programming error.");
461
462 // First version doing the whole computation on the basis of the
463 // selection polygon's all faces.
464 //
465 if(!spec.integrationScopeSPtr->contains(
466 QPointF(checked_value, iter->x)))
467 iter = trace.erase(iter);
468 }
469 // End of
470 // for(auto &&spec : m_selectionPolygonSpecs)
471 }
472 // End of
473 // while(iter > begin_it)
474
475 return trace;
476}
@ dt
Drift time.
@ rt
Retention time.

References pappso::dt, pappso::FilterResampleKeepXRange::filter(), m_greatestMz, m_integrationScopeSpecs, m_lowestMz, and pappso::rt.

◆ newSelectionPolygonSpec()

void pappso::FilterResampleKeepPointInPolygon::newSelectionPolygonSpec ( const IntegrationScopeSpec & integration_scope_spec)

Definition at line 341 of file filterresample.cpp.

343{
344
345 m_integrationScopeSpecs.push_back(integration_scope_spec);
346
347 QPointF point;
348 if(!m_integrationScopeSpecs.back().integrationScopeSPtr->getPoint(point))
349 qFatal("Failed to get point.");
350 m_lowestMz = std::min(m_lowestMz, point.y());
351
352 double height;
353 if(!m_integrationScopeSpecs.back().integrationScopeSPtr->getHeight(height))
354 qFatal("Failed to get height.");
355 m_greatestMz = std::max(m_greatestMz, m_lowestMz + height);
356}

References m_greatestMz, m_integrationScopeSpecs, and m_lowestMz.

◆ operator=()

FilterResampleKeepPointInPolygon & pappso::FilterResampleKeepPointInPolygon::operator= ( const FilterResampleKeepPointInPolygon & other)

Definition at line 360 of file filterresample.cpp.

362{
363 if(this == &other)
364 return *this;
365
366 m_integrationScopeSpecs.assign(other.m_integrationScopeSpecs.begin(),
367 other.m_integrationScopeSpecs.end());
368
369 m_lowestMz = other.m_lowestMz;
370 m_greatestMz = other.m_greatestMz;
371
372 return *this;
373}

References m_greatestMz, m_integrationScopeSpecs, and m_lowestMz.

Member Data Documentation

◆ m_greatestMz

double pappso::FilterResampleKeepPointInPolygon::m_greatestMz = std::numeric_limits<double>::min()
private

◆ m_integrationScopeSpecs

IntegrationScopeSpecVector pappso::FilterResampleKeepPointInPolygon::m_integrationScopeSpecs
private

◆ m_lowestMz

double pappso::FilterResampleKeepPointInPolygon::m_lowestMz = std::numeric_limits<double>::max()
private

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