Medical Imaging Interaction Toolkit  2026.06.00
Medical Imaging Interaction Toolkit
mitkPlanarCross.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 mitkPlanarCross_h
14 #define mitkPlanarCross_h
15 
16 #include <mitkPlanarFigure.h>
18 
19 namespace mitk
20 {
21  class PlaneGeometry;
22 
51  {
52  public:
54 
55  itkFactorylessNewMacro(Self);
56 
57  itkCloneMacro(Self);
58 
63  void SetSingleLineMode(bool singleLineMode);
64 
69  bool GetSingleLineMode() const;
70 
76  itkBooleanMacro(SingleLineMode);
77 
79  unsigned int GetMinimumNumberOfControlPoints() const override { return this->GetSingleLineMode() ? 2 : 4; }
81  unsigned int GetMaximumNumberOfControlPoints() const override { return this->GetSingleLineMode() ? 2 : 4; }
82 
91  bool ResetOnPointSelect() override;
92 
97  bool ResetOnPointSelectNeeded() const override;
98 
103  unsigned int GetNumberOfFeatures() const override;
104 
110  bool Equals(const mitk::PlanarFigure &other) const override;
111 
112  protected:
114  PlanarCross(const Self& other);
116 
118  Point2D ApplyControlPointConstraints(unsigned int index, const Point2D &point) override;
119 
121  void GeneratePolyLine() override;
122 
124  void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override;
125 
127  void EvaluateFeaturesInternal() override;
128 
129  void PrintSelf(std::ostream &os, itk::Indent indent) const override;
130 
131  // Feature identifiers
132  const unsigned int FEATURE_ID_LONGESTDIAMETER;
133  const unsigned int FEATURE_ID_SHORTAXISDIAMETER;
134 
135  private:
137  virtual Point2D InternalApplyControlPointConstraints(unsigned int index, const Point2D &point);
138  };
139 
140 } // namespace mitk
141 
142 #endif
#define MITKPLANARFIGURE_EXPORT
Implementation of PlanarFigure modeling a cross with two orthogonal lines on a plane.
void PrintSelf(std::ostream &os, itk::Indent indent) const override
void SetSingleLineMode(bool singleLineMode)
Sets whether the PlanarFigure represents a single line or an orthogonal cross.
Point2D ApplyControlPointConstraints(unsigned int index, const Point2D &point) override
Spatially constrain control points of second (orthogonal) line.
bool GetSingleLineMode() const
Returns whether the PlanarFigure represents a single line or an orthogonal cross.
void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override
Generates the poly-lines that should be drawn the same size regardless of zoom.
const unsigned int FEATURE_ID_SHORTAXISDIAMETER
const unsigned int FEATURE_ID_LONGESTDIAMETER
unsigned int GetNumberOfFeatures() const override
Returns 1 in single-line mode, 2 in cross mode (longest + shortest diameter).
unsigned int GetMinimumNumberOfControlPoints() const override
Returns 2 in single-line mode, 4 in cross mode.
void GeneratePolyLine() override
Generates the poly-line representation of the planar figure.
mitkClassMacro(PlanarCross, PlanarFigure)
PlanarCross(const Self &other)
bool ResetOnPointSelectNeeded() const override
Returns whether a reset is needed when a control point is selected.
unsigned int GetMaximumNumberOfControlPoints() const override
Returns 2 in single-line mode, 4 in cross mode.
void EvaluateFeaturesInternal() override
Calculates feature quantities of the planar figure.
bool ResetOnPointSelect() override
Resets the cross to a single line when a control point is selected.
bool Equals(const mitk::PlanarFigure &other) const override
Compares this PlanarCross with another PlanarFigure for equality.
Base-class for geometric planar (2D) figures, such as lines, circles, rectangles, polygons,...
Find image slices visible on a given plane.