Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkPlanarPolygon.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 
13 #ifndef mitkPlanarPolygon_h
14 #define mitkPlanarPolygon_h
15 
16 #include <mitkPlanarFigure.h>
18 
19 namespace mitk
20 {
21  class PlaneGeometry;
22 
38  {
39  public:
41 
42  itkFactorylessNewMacro(Self);
43 
44  itkCloneMacro(Self);
45 
50  virtual void SetClosed(bool closed);
51 
53  itkBooleanMacro(Closed);
54 
56  unsigned int GetMinimumNumberOfControlPoints() const override { return 3; }
58  unsigned int GetMaximumNumberOfControlPoints() const override { return 1000; }
59 
67  std::vector<mitk::Point2D> CheckForLineIntersection(const Point2D &p1, const Point2D &p2) const;
68 
74  bool Equals(const mitk::PlanarFigure &other) const override;
75 
76  protected:
78  PlanarPolygon(const Self& other);
79 
81 
83  void GeneratePolyLine() override;
84 
86  void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override;
87 
89  void EvaluateFeaturesInternal() override;
90 
92  const mitk::Point2D &p2,
93  const mitk::Point2D &p3,
94  const mitk::Point2D &p4,
95  Point2D &intersection) const;
97  const mitk::Point2D &p2,
98  const mitk::Point2D &p3,
99  const mitk::Point2D &p4) const;
100 
101  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
102 
103  const unsigned int FEATURE_ID_CIRCUMFERENCE;
104  const unsigned int FEATURE_ID_AREA;
105 
106  private:
107  };
108 
109 } // namespace mitk
110 
111 #endif
#define MITKPLANARFIGURE_EXPORT
Base-class for geometric planar (2D) figures, such as lines, circles, rectangles, polygons,...
Implementation of PlanarFigure representing a polygon.
void PrintSelf(std::ostream &os, itk::Indent indent) const override
const unsigned int FEATURE_ID_AREA
std::vector< mitk::Point2D > CheckForLineIntersection(const Point2D &p1, const Point2D &p2) const
Checks for intersections of a line segment with the polygon edges.
bool CheckForLineIntersection(const mitk::Point2D &p1, const mitk::Point2D &p2, const mitk::Point2D &p3, const mitk::Point2D &p4, Point2D &intersection) const
void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override
Generates the poly-lines that should be drawn the same size regardless of zoom.
bool Equals(const mitk::PlanarFigure &other) const override
Compares this PlanarPolygon with another PlanarFigure for equality.
const unsigned int FEATURE_ID_CIRCUMFERENCE
virtual void SetClosed(bool closed)
Sets whether the polygon is closed between the first and last control point.
bool CheckForLineIntersection(const mitk::Point2D &p1, const mitk::Point2D &p2, const mitk::Point2D &p3, const mitk::Point2D &p4) const
PlanarPolygon(const Self &other)
void EvaluateFeaturesInternal() override
Calculates feature quantities of the planar figure.
unsigned int GetMaximumNumberOfControlPoints() const override
Returns 1000 – polygon control points are practically unlimited.
unsigned int GetMinimumNumberOfControlPoints() const override
Returns 3 – a polygon requires at least three control points.
mitkClassMacro(PlanarPolygon, PlanarFigure)
void GeneratePolyLine() override
Generates the poly-line representation of the planar figure.
Find image slices visible on a given plane.