19 : FEATURE_ID_RADIUS(this->AddFeature(
"Radius",
"mm")),
20 FEATURE_ID_DIAMETER(this->AddFeature(
"Diameter",
"mm")),
21 FEATURE_ID_AREA(this->AddFeature(
"Area",
"mm2")),
24 m_MinMaxRadiusContraintsActive(false),
57 const vnl_vector<ScalarType> vec = (point.GetVnlVector() - centerPoint.GetVnlVector());
59 boundaryPoint[0] += vec[0];
60 boundaryPoint[1] += vec[1];
85 if (indexPoint[0] < bounds[0])
87 indexPoint[0] = bounds[0];
89 if (indexPoint[0] > bounds[1])
91 indexPoint[0] = bounds[1];
93 if (indexPoint[1] < bounds[2])
95 indexPoint[1] = bounds[2];
97 if (indexPoint[1] > bounds[3])
99 indexPoint[1] = bounds[3];
110 const double euclideanDinstanceFromCenterToPoint1 = centerPoint.EuclideanDistanceTo(point);
112 Vector2D vectorProjectedPoint = point - centerPoint;
113 vectorProjectedPoint.Normalize();
115 if (euclideanDinstanceFromCenterToPoint1 >
m_MaxRadius)
118 constrainedPoint = centerPoint;
119 constrainedPoint += vectorProjectedPoint;
121 else if (euclideanDinstanceFromCenterToPoint1 <
m_MinRadius)
124 constrainedPoint = centerPoint;
125 constrainedPoint += vectorProjectedPoint;
130 return constrainedPoint;
147 radius = centerPoint.EuclideanDistanceTo(boundaryPoint);
151 for (
int t = 0; t < 64; ++t)
153 const double alpha = (double)t * vnl_math::pi / 32.0;
157 polyLinePoint[0] = centerPoint[0] + radius * cos(alpha);
158 polyLinePoint[1] = centerPoint[1] + radius * sin(alpha);
180 radius = p0.EuclideanDistanceTo(p1);
183 const double area = vnl_math::pi * radius * radius;
192 Superclass::PrintSelf(os, indent);
210 return Superclass::Equals(other);
Point2D ApplyControlPointConstraints(unsigned int index, const Point2D &point) override
Spatially constrain control points of second (orthogonal) line.
const unsigned int FEATURE_ID_DIAMETER
bool m_MinMaxRadiusContraintsActive
virtual void IndexToWorld(const Point2D &pt_units, Point2D &pt_mm) const
void GeneratePolyLine() override
Generates the poly-line representation of the planar figure.
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
bool SetControlPoint(unsigned int index, const Point2D &point, bool createIfDoesNotExist=false) override
Place figure in its minimal configuration (a point at least) onto the given 2D geometry.
const unsigned int FEATURE_ID_RADIUS
bool SetCurrentControlPoint(const Point2D &point) override
virtual void WorldToIndex(const Point2D &pt_mm, Point2D &pt_units) const
void EvaluateFeaturesInternal() override
Calculates feature quantities of the planar figure.
void PrintSelf(std::ostream &os, itk::Indent indent) const override
bool Equals(const mitk::PlanarFigure &other) const override
Compare two PlanarFigure objects Note: all subclasses have to implement the method on their own...
Implementation of PlanarFigure representing a circle either through two control points or by one cont...
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_AREA
const BoundsArrayType GetBounds() const
BoundingBoxType::BoundsArrayType BoundsArrayType