Medical Imaging Interaction Toolkit  2025.12.02
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 
28  {
29  public:
31 
32  itkFactorylessNewMacro(Self);
33 
34  itkCloneMacro(Self);
35 
37  virtual void SetClosed(bool closed);
38 
39  itkBooleanMacro(Closed); // Calls SetClosed(); no need to re-implement
40 
46  // virtual void Initialize();
47 
49  unsigned int GetMinimumNumberOfControlPoints() const override { return 3; }
51  unsigned int GetMaximumNumberOfControlPoints() const override { return 1000; }
52  std::vector<mitk::Point2D> CheckForLineIntersection(const Point2D &p1, const Point2D &p2) const;
53 
54  bool Equals(const mitk::PlanarFigure &other) const override;
55 
56  protected:
58 
60 
62  void GeneratePolyLine() override;
63 
65  void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override;
66 
68  void EvaluateFeaturesInternal() override;
69 
71  const mitk::Point2D &p2,
72  const mitk::Point2D &p3,
73  const mitk::Point2D &p4,
74  Point2D &intersection) const;
76  const mitk::Point2D &p2,
77  const mitk::Point2D &p3,
78  const mitk::Point2D &p4) const;
79 
80  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
81 
82  const unsigned int FEATURE_ID_CIRCUMFERENCE;
83  const unsigned int FEATURE_ID_AREA;
84 
85  private:
86  };
87 
88 } // namespace mitk
89 
90 #endif
#define MITKPLANARFIGURE_EXPORT
Base-class for geometric planar (2D) figures, such as lines, circles, rectangles, polygons,...
Implementation of PlanarFigure representing a polygon with two or more control points.
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
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
Compare two PlanarFigure objects Note: all subclasses have to implement the method on their own.
const unsigned int FEATURE_ID_CIRCUMFERENCE
virtual void SetClosed(bool closed)
Set whether the polygon should be closed between first and last control point or not.
bool CheckForLineIntersection(const mitk::Point2D &p1, const mitk::Point2D &p2, const mitk::Point2D &p3, const mitk::Point2D &p4) const
void EvaluateFeaturesInternal() override
Calculates feature quantities of the planar figure.
unsigned int GetMaximumNumberOfControlPoints() const override
Polygon maximum number of control points is principally not limited.
unsigned int GetMinimumNumberOfControlPoints() const override
Place figure in its minimal configuration (a point at least) onto the given 2D geometry.
mitkClassMacro(PlanarPolygon, PlanarFigure)
void GeneratePolyLine() override
Generates the poly-line representation of the planar figure.
Find image slices visible on a given plane.