13 #ifndef mitkPlaneGeometry_h
14 #define mitkPlaneGeometry_h
22 #include <vnl/vnl_cross.h>
26 template <
class TCoordRep,
unsigned int NPo
intDimension>
28 typedef Line<ScalarType, 3>
Line3D;
84 itkFactorylessNewMacro(Self);
143 bool frontside =
true,
144 bool rotated =
false,
162 bool frontside =
true,
163 bool rotated =
false);
188 bool frontside =
true,
189 bool rotated =
false,
202 bool frontside =
true,
203 bool rotated =
false,
310 virtual bool IsAbove(
const Point3D &pt3d_mm,
bool considerBoundingBox =
false)
const;
332 return (pt3d_mm - GetOrigin()) * GetNormal() / len;
350 if (IsParallel(plane))
352 return SignedDistance(plane->
GetOrigin());
563 void PrintSelf(std::ostream &os, itk::Indent indent)
const override;
BaseGeometry Describes the geometry of a data object.
Point3D GetOrigin() const
Get the origin, e.g. the upper-left corner of the plane.
BoundingBoxType::BoundsArrayType BoundsArrayType
Base class of all Operation-classes.
Describes a two-dimensional, rectangular plane.
virtual void InitializeStandardPlane(ScalarType width, ScalarType height, const VnlVector &rightVector, const VnlVector &downVector, const Vector3D *spacing=nullptr)
Initialize plane by width and height in pixels, right-/down-vector (vnl) to describe orientation in w...
static bool CheckRotationMatrix(AffineTransform3D *transform, double epsilon=1e-6)
Check if matrix is a rotation matrix:
virtual void IndexToWorld(const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const
Convert (continuous or discrete) index coordinates of a vector vec_units to world coordinates (in mm)...
itk::LightObject::Pointer InternalClone() const override
virtual void WorldToIndex(const Point2D &pt_mm, Point2D &pt_units) const
bool IsParallel(const PlaneGeometry *plane) const
Returns whether the plane is parallel to another plane.
ScalarType DistanceFromPlane(const PlaneGeometry *plane) const
Distance of the plane from another plane (bounding-box not considered)
void CheckIndexToWorldTransform(mitk::AffineTransform3D *transform) override
CheckIndexToWorldTransform.
void ExecuteOperation(Operation *operation) override
virtual void InitializeStandardPlane(ScalarType width, ScalarType height, const Vector3D &rightVector, const Vector3D &downVector, const Vector3D *spacing=nullptr)
Initialize plane by width and height in pixels, right-/down-vector (itk) to describe orientation in w...
virtual bool IsAbove(const Point3D &pt3d_mm, bool considerBoundingBox=false) const
Calculates, whether a point is below or above the plane. There are two different calculation methods,...
virtual void InitializePlane(const Point3D &origin, const Vector3D &normal)
Initialize plane by origin and normal (size is 1.0 mm in all directions, direction of right-/down-vec...
mitkClassMacro(PlaneGeometry, BaseGeometry)
double Angle(const PlaneGeometry *plane) const
Calculate the angle between two planes.
void PrintSelf(std::ostream &os, itk::Indent indent) const override
void SetMatrixByVectors(const VnlVector &rightVector, const VnlVector &downVector, ScalarType thickness=1.0)
Initialize plane by right-/down-vector.
bool IntersectionPointParam(const Line3D &line, double &t) const
Calculate line parameter of intersection point between the plane and a line.
virtual void SetSizeInUnits(mitk::ScalarType width, mitk::ScalarType height)
Set the width and height of this 2D-geometry in units by calling SetBounds. This does not change the ...
ScalarType SignedDistanceFromPlane(const Point3D &pt3d_mm) const
Signed distance of the point from the plane (bounding-box not considered)
void PreSetSpacing(const mitk::Vector3D &aSpacing) override
PreSetSpacing.
PlaneGeometry(const PlaneGeometry &other)
bool IsOnPlane(const PlaneGeometry *plane) const
Returns whether the plane is on the plane (bounding-box not considered)
unsigned int IntersectWithPlane2D(const PlaneGeometry *plane, Point2D &lineFrom, Point2D &lineTo) const
Calculate two points where another plane intersects the border of this plane.
double Angle(const Line3D &line) const
Calculate the angle between the plane and a line.
bool HasReferenceGeometry() const
ScalarType DistanceFromPlane(const Point3D &pt3d_mm) const
Distance of the point from the plane (bounding-box not considered)
virtual bool Project(const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const
Project a 3D vector given in mm (vec3d_mm) onto the 2D geometry. The result is a 3D vector in mm (pro...
VnlVector GetNormalVnl() const
Normal of the plane as VnlVector.
const BaseGeometry * GetReferenceGeometry() const
Get the geometrical frame of reference for this PlaneGeometry.
virtual void InitializeStandardPlane(ScalarType width, ScalarType height, const Vector3D &spacing, AnatomicalPlane planeorientation=AnatomicalPlane::Axial, ScalarType zPosition=0, bool frontside=true, bool rotated=false, bool top=true)
Initialize plane with orientation AnatomicalPlane (default: axial) given width, height and spacing.
virtual void IndexToWorld(const Point2D &pt_units, Point2D &pt_mm) const
ScalarType SignedDistanceFromPlane(const PlaneGeometry *plane) const
Signed distance of the plane from another plane (bounding-box not considered)
virtual bool Map(const mitk::Point3D &atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector2D &vec2d_mm) const
Project a 3D vector given in mm (vec3d_mm) onto the 2D geometry. The result is a 2D vector in mm (vec...
bool IsOnPlane(const Point3D &point) const
Returns whether the point is on the plane (bounding-box not considered)
virtual bool Project(const mitk::Point3D &pt3d_mm, mitk::Point3D &projectedPt3d_mm) const
Project a 3D point given in mm (pt3d_mm) onto the 2D geometry. The result is a 3D point in mm (projec...
virtual ScalarType SignedDistance(const Point3D &pt3d_mm) const
virtual void WorldToIndex(const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const
Convert world coordinates (in mm) of a vector vec_mm to (continuous!) index coordinates....
void CheckBounds(const BoundsArrayType &bounds) override
CheckBounds.
virtual void WorldToIndex(const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const
Convert world coordinates (in mm) of a vector vec_mm to (continuous!) index coordinates.
virtual void InitializeStandardPlane(const Vector3D &rightVector, const Vector3D &downVector, const Vector3D *spacing=nullptr)
Initialize plane by right-/down-vector (itk) and spacing (default: 1.0 mm in all directions).
Point3D ProjectPointOntoPlane(const Point3D &pt) const
Returns the lot from the point to the plane.
virtual void InitializeStandardPlane(const VnlVector &rightVector, const VnlVector &downVector, const Vector3D *spacing=nullptr)
Initialize plane by right-/down-vector (vnl) and spacing (default: 1.0 mm in all directions).
virtual void InitializeStandardPlane(const BaseGeometry *geometry3D, AnatomicalPlane planeorientation=AnatomicalPlane::Axial, ScalarType zPosition=0, bool frontside=true, bool rotated=false, bool top=true)
Initialize a plane with orientation AnatomicalPlane (default: axial) with respect to BaseGeometry (de...
void SetReferenceGeometry(const mitk::BaseGeometry *geometry)
Set the geometrical frame of reference in which this PlaneGeometry is placed.
const mitk::BaseGeometry * m_ReferenceGeometry
~PlaneGeometry() override
virtual void InitializeStandardPlane(ScalarType width, ScalarType height, const AffineTransform3D *transform=nullptr, AnatomicalPlane planeorientation=AnatomicalPlane::Axial, ScalarType zPosition=0, bool frontside=true, bool rotated=false, bool top=true)
Initialize a plane with orientation AnatomicalPlane (default: axial) with respect to transform (defau...
virtual void Map(const mitk::Point2D &pt2d_mm, mitk::Point3D &pt3d_mm) const
Converts a 2D point given in mm (pt2d_mm) relative to the upper-left corner of the geometry into the ...
ScalarType Distance(const Point3D &pt3d_mm) const
Distance of the point from the geometry (bounding-box not considered)
virtual void Map(const mitk::Point2D &atPt2d_mm, const mitk::Vector2D &vec2d_mm, mitk::Vector3D &vec3d_mm) const
Converts a 2D vector given in mm (vec2d_mm) relative to the upper-left corner of the geometry into th...
bool IntersectionLine(const PlaneGeometry *plane, Line3D &crossline) const
Calculate the intersecting line of two planes.
bool IntersectionPoint(const Line3D &line, Point3D &intersectionPoint) const
Calculate intersection point between the plane and a line.
virtual bool Map(const mitk::Point3D &pt3d_mm, mitk::Point2D &pt2d_mm) const
Project a 3D point given in mm (pt3d_mm) onto the 2D geometry. The result is a 2D point in mm (pt2d_m...
Vector3D GetNormal() const
Normal of the plane.
virtual bool Project(const mitk::Point3D &atPt3d_mm, const mitk::Vector3D &vec3d_mm, mitk::Vector3D &projectedVec3d_mm) const
Project a 3D vector given in mm (vec3d_mm) onto the 2D geometry. The result is a 3D vector in mm (pro...
virtual void InitializeStandardPlane(const BaseGeometry *geometry3D, bool top, AnatomicalPlane planeorientation=AnatomicalPlane::Axial, bool frontside=true, bool rotated=false)
Initialize a plane with orientation AnatomicalPlane (default: axial) with respect to BaseGeometry (de...
bool IsOnPlane(const Line3D &line) const
Returns whether the line is on the plane (bounding-box not considered)
virtual void IndexToWorld(const mitk::Point2D &atPt2d_untis, const mitk::Vector2D &vec_units, mitk::Vector2D &vec_mm) const
Convert (continuous or discrete) index coordinates of a vector vec_units to world coordinates (in mm)
Find image slices visible on a given plane.
Line< ScalarType, 3 > Line3D
itk::ScalableAffineTransform< ScalarType, 3 > AffineTransform3D
MITKCORE_EXPORT bool operator!=(const InteractionEvent &a, const InteractionEvent &b)
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
vnl_vector< ScalarType > VnlVector