20 #ifndef MIRTK_SurfaceBoundary_H 21 #define MIRTK_SurfaceBoundary_H 23 #include "mirtk/Object.h" 25 #include "mirtk/Memory.h" 26 #include "mirtk/Array.h" 27 #include "mirtk/UnorderedMap.h" 28 #include "mirtk/Point.h" 30 #include "mirtk/EdgeTable.h" 31 #include "mirtk/BoundarySegment.h" 33 #include "vtkSmartPointer.h" 34 #include "vtkPolyData.h" 51 typedef SharedPtr<class EdgeTable> EdgeTablePointer;
54 typedef UnorderedMap<int, int> PointIdToIndexMap;
60 mirtkPublicAttributeMacro(vtkSmartPointer<vtkPolyData>, Surface);
63 mirtkPublicAttributeMacro(EdgeTablePointer,
EdgeTable);
66 mirtkReadOnlyAttributeMacro(Array<int>,
PointIds);
69 mirtkAttributeMacro(PointIdToIndexMap, Index);
72 mirtkReadOnlyAttributeMacro(Array<BoundarySegment>, Segments);
120 void GetPoint(
int i,
double p[3])
const;
127 class Point Point(int i) const;
134 int Find(
int ptId)
const;
192 const Array<int> &
PointIds(
int n)
const;
200 int PointId(
int n,
int i)
const;
240 bool Write(
const char *)
const;
254 return static_cast<int>(_PointIds.size());
267 _Surface->GetPoint(static_cast<vtkIdType>(ptId), p);
281 return Find(ptId) != -1;
291 return static_cast<int>(_Segments.size());
340 for (
auto it = i.begin(); it != i.end(); ++it) {
362 #endif // MIRTK_SurfaceBoundary_H int PointIndex(int n, int i) const
void InitializeIndex()
Pre-compute maps of surface point ID to boundary (segment) point index.
void PointIndices(int n, Array< int > &i) const
void InitializeLengths()
Pre-compute boundary edge lengths and length of each segment.
class Point Point(int i) const
bool Write(const char *) const
Write boundary lines to polygonal data set file.
void DeselectPoint(int i)
int NumberOfPoints() const
Number of surface boundary points.
int NumberOfSegments() const
Number of boundary segments.
const Array< int > & PointIds(int n) const
BoundarySegment & Segment(int n)
virtual ~SurfaceBoundary()
Destructor.
SurfaceBoundary(vtkPolyData *, EdgeTablePointer=nullptr)
Constructor.
const BoundarySegment & LargestSegment() const
Get boundary segment which contains the most boundary points.
int FindLongestSegment() const
Get index of longest boundary segment.
const BoundarySegment & LongestSegment() const
Get longest boundary segment.
int FindLargestSegment() const
Get index of boundary segment which contains the most boundary points.
bool Contains(int ptId) const
int FindSegment(int ptId, int *i=nullptr) const
void GetPoint(int i, double p[3]) const
int NumberOfPoints() const
Number of boundary segment points.
SurfaceBoundary & operator=(const SurfaceBoundary &)
Assignment operator.