ISegmentManager.hpp
1 #ifndef OPALS_ISEGMENTMANAGER_HPP_INCLUDED
2 #define OPALS_ISEGMENTMANAGER_HPP_INCLUDED
3 
4 #include "DM/IPoint.hpp"
5 #include "DM/IBox.hpp"
6 #include "DM/IPolyline.hpp"
7 #include "opals/Vector.hpp"
8 #include "opals/SegmentationMethod.hpp"
9 #include "opals/ObjectBase.hpp"
10 
11 #ifdef _MSC_VER
12  #pragma once
13 #endif
14 
15 
16 namespace opals
17 {
18  /** \brief Segment interface
19 
20  A segment objects provides an objects representation of the segments that have been created by ModuleSegmentation. Plane parameters and plane moments
21  are only available if the plane extraction mode was applied. Alpha shape objects additionally required the alphaRadius parameter being set.
22 
23  \author MPOECHTR, JO
24  \date 29.01.2019
25  */
26  class ISegment
27  {
28  public:
29  /// returns id of segment
30  virtual unsigned getID() const = 0;
31 
32  /// number of points that have been assigned to segment
33  virtual size_t sizePoints() const = 0;
34  /// get point id at index position of the point vector
35  virtual int64_t getPoint(int64_t index) const = 0;
36  /// get point id vector of segment
37  virtual opals::Vector<int64_t> getPoints() const = 0;
38 
39  /// get center of gravity of segment points
40  virtual const DM::PointHandle & getCoG() const = 0;
41  /// get bounding box of segment points
42  virtual const DM::BoxHandle & getBBox() const = 0;
43 
44  /// get plane parameters (a,b,c,d and sigma0) of the extracted plane (in plane extraction mode only. plane equation: a*x + b*y + c*z + d == 0)
45  virtual const opals::Vector<double> & getPlaneParams() const = 0;
46  /// get plane moments (Mxx, Myy, Mzz, Mxy, Mxz, Myz) of the extracted plane (in plane extraction mode only)
47  virtual const opals::Vector<double> & getPlaneMoments() const = 0;
48 
49  /// get alpha shape of segment (only available in plane extraction mode and set alpha radius)
50  virtual const DM::PolylineHandle & getAlphaShape() const = 0;
51  };
52 
53 
54  /** \brief Segment manager interface
55 
56  A segment manager objects stored all segments that have been created by an ModuleSegmentation run.
57 
58  \author MPOECHTR, JO
59  \date 29.01.2019
60  */
61  class ISegmentManager : public ObjectBase
62  {
63  public:
64  /// get number of segments
65  virtual int64_t sizeSegments() const = 0;
66 
67  /// \brief get vector of all segments.
68  /// the lifetime of the segments is attached to the manager. Hence, if the ISegmentManager is deleted, the segment objects are deleted too
69  virtual opals::Vector<opals::ISegment*> getSegments() const = 0;
70 
71  /// get a segement by ids id
72  virtual opals::ISegment* getSegment(unsigned seg_id) const = 0;
73  };
74 }
75 
76 #endif