Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkPlanarEllipse.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 mitkPlanarEllipse_h
14 #define mitkPlanarEllipse_h
15 
16 #include <mitkPlanarFigure.h>
18 
19 namespace mitk
20 {
21  class PlaneGeometry;
22 
39  {
40  public:
42  itkFactorylessNewMacro(Self);
43  itkCloneMacro(Self);
44 
49  void PlaceFigure(const Point2D &point) override;
50 
59  bool SetControlPoint(unsigned int index, const Point2D &point, bool createIfDoesNotExist = true) override;
60 
62  unsigned int GetMinimumNumberOfControlPoints() const override { return 4; }
64  unsigned int GetMaximumNumberOfControlPoints() const override { return 4; }
65 
70  void SetMinimumRadius(double radius) { m_MinRadius = radius; }
75  double GetMinimumRadius() { return m_MinRadius; }
80  void SetMaximumRadius(double radius) { m_MaxRadius = radius; }
85  double GetMaximumRadius() { return m_MaxRadius; }
86 
91  void ActivateMinMaxRadiusContstraints(bool active) { m_MinMaxRadiusContraintsActive = active; }
92 
97  void SetTreatAsCircle(bool active) { m_TreatAsCircle = active; }
98 
104  bool Equals(const mitk::PlanarFigure &other) const override;
105 
107  const unsigned int FEATURE_ID_MAJOR_AXIS;
109  const unsigned int FEATURE_ID_MINOR_AXIS;
111  const unsigned int FEATURE_ID_AREA;
112 
113  protected:
115  PlanarEllipse(const Self& other);
116 
118 
120  void GeneratePolyLine() override;
121 
123  void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override;
124 
126  Point2D ApplyControlPointConstraints(unsigned int index, const Point2D &point) override;
127 
129  void EvaluateFeaturesInternal() override;
130 
131  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
132 
133  // Member variables:
134  double m_MinRadius;
135  double m_MaxRadius;
138 
139  private:
140  };
141 
142 } // namespace mitk
143 
144 #endif
#define MITKPLANARFIGURE_EXPORT
Implementation of PlanarFigure representing an ellipse.
unsigned int GetMinimumNumberOfControlPoints() const override
Returns 4 – an ellipse requires exactly four control points.
void ActivateMinMaxRadiusContstraints(bool active)
Activates or deactivates minimum/maximum radius constraints.
void PrintSelf(std::ostream &os, itk::Indent indent) const override
void PlaceFigure(const Point2D &point) override
Places the figure at the given point and initializes all four control points.
void GeneratePolyLine() override
Generates the poly-line representation of the planar figure.
mitkClassMacro(PlanarEllipse, PlanarFigure)
const unsigned int FEATURE_ID_MAJOR_AXIS
Feature identifier for the major axis length.
bool Equals(const mitk::PlanarFigure &other) const override
Compares this PlanarEllipse with another PlanarFigure for equality.
bool SetControlPoint(unsigned int index, const Point2D &point, bool createIfDoesNotExist=true) override
Sets a control point position, enforcing ellipse constraints.
unsigned int GetMaximumNumberOfControlPoints() const override
Returns 4 – an ellipse requires exactly four control points.
void SetMinimumRadius(double radius)
Sets the minimum allowed radius.
void SetMaximumRadius(double radius)
Sets the maximum allowed radius.
void EvaluateFeaturesInternal() override
Calculates feature quantities of the planar figure.
void SetTreatAsCircle(bool active)
Sets whether the ellipse should be constrained to a circle (equal radii).
Point2D ApplyControlPointConstraints(unsigned int index, const Point2D &point) override
Spatially constrain control points of second (orthogonal) line.
const unsigned int FEATURE_ID_MINOR_AXIS
Feature identifier for the minor axis length.
double GetMinimumRadius()
Returns the minimum allowed radius.
PlanarEllipse(const Self &other)
double GetMaximumRadius()
Returns the maximum allowed radius.
const unsigned int FEATURE_ID_AREA
Feature identifier for the ellipse area.
void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override
Generates the poly-lines that should be drawn the same size regardless of zoom.
Base-class for geometric planar (2D) figures, such as lines, circles, rectangles, polygons,...
Find image slices visible on a given plane.