18 : FEATURE_ID_LONGESTDIAMETER(this->AddFeature(
"Longest Axis",
"mm")),
19 FEATURE_ID_SHORTAXISDIAMETER(this->AddFeature(
"Short Axis",
"mm"))
43 if (singleLineMode !=
nullptr)
123 unsigned int count = 0;
125 Point2D superclassConfinedPoint;
128 superclassConfinedPoint = Superclass::ApplyControlPointConstraints(index, confinedPoint);
129 confinedPoint = this->InternalApplyControlPointConstraints(index, superclassConfinedPoint);
131 }
while ((confinedPoint.EuclideanDistanceTo(superclassConfinedPoint) >
mitk::eps) && (count < 32));
133 return confinedPoint;
136 mitk::Point2D mitk::PlanarCross::InternalApplyControlPointConstraints(
unsigned int index,
const Point2D &point)
152 const double dotProduct = n1 * v1;
153 const Point2D crossPoint = p1 + n1 * dotProduct;
155 const Vector2D crossVector = point - crossPoint;
157 if (dotProduct < 0.0)
160 return (p1 + crossVector);
162 else if (dotProduct > p2.EuclideanDistanceTo(p1))
165 return (p2 + crossVector);
190 const double dotProduct1 = n1 * v1;
192 const Point2D pointOnLine = point - n1 * dotProduct1;
195 const Vector2D v2 = pointOnLine - p1;
196 double dotProduct2 = n1 * v2;
198 const Point2D crossingPoint = p1 + n1 * dotProduct2;
202 if ((pointOnLine.SquaredEuclideanDistanceTo(p3) > crossingPoint.SquaredEuclideanDistanceTo(p3)) &&
203 (pointOnLine.SquaredEuclideanDistanceTo(p3) > pointOnLine.SquaredEuclideanDistanceTo(crossingPoint)))
209 return crossingPoint;
260 const Point2D crossPoint = p1 + n1 * (n1 * v1);
262 const Vector2D v2 = crossPoint - p3;
263 if (v2.GetNorm() < 1.0)
287 double l1 = p0.EuclideanDistanceTo(p1);
295 l2 = p2.EuclideanDistanceTo(p3);
298 double longestDiameter;
299 double shortAxisDiameter;
302 longestDiameter = l1;
303 shortAxisDiameter = l2;
307 longestDiameter = l2;
308 shortAxisDiameter = l1;
317 Superclass::PrintSelf(os, indent);
325 return Superclass::Equals(other);
bool Equals(const mitk::PlanarFigure &other) const override
Compare two PlanarFigure objects Note: all subclasses have to implement the method on their own...
Point< ScalarType, 2 > Point2D
Point2D ApplyControlPointConstraints(unsigned int index, const Point2D &point) override
Spatially constrain control points of second (orthogonal) line.
bool GetSingleLineMode() const
Indicates whether the PlanarFigure shall represent only a single line instead of an orthogonal cross...
const unsigned int FEATURE_ID_LONGESTDIAMETER
unsigned int GetNumberOfFeatures() const override
Returns the number of features available for this PlanarCross (1 or 2).
void PrintSelf(std::ostream &os, itk::Indent indent) const override
void SetProperty(const std::string &propertyKey, BaseProperty *property, const std::string &contextName="", bool fallBackOnDefaultContext=false) override
Add new or change existent property.
virtual T GetValue() const
bool ResetOnPointSelect() override
The cross shall be reset to a single line when a control point is selected.
void SetSingleLineMode(bool singleLineMode)
Indicates whether the PlanarFigure shall represent only a single line instead of an orthogonal cross...
bool ResetOnPointSelectNeeded() const override
mitk::BaseProperty::Pointer GetProperty(const char *propertyKey) const
Get the property (instance of BaseProperty) with key propertyKey from the PropertyList, and set it to this, respectively;.
Implementation of PlanarFigure modeling a cross with two orthogonal lines on a plane.
void GeneratePolyLine() override
Generates the poly-line representation of the planar figure.
MITKCORE_EXPORT const ScalarType eps
void GenerateHelperPolyLine(double mmPerDisplayUnit, unsigned int displayHeight) override
Generates the poly-lines that should be drawn the same size regardless of zoom.
void EvaluateFeaturesInternal() override
Calculates feature quantities of the planar figure.
const unsigned int FEATURE_ID_SHORTAXISDIAMETER