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;
80 itkFactorylessNewMacro(Self);
139 bool frontside =
true,
140 bool rotated =
false,
158 bool frontside =
true,
159 bool rotated =
false);
184 bool frontside =
true,
185 bool rotated =
false,
198 bool frontside =
true,
199 bool rotated =
false,
327 virtual bool IsAbove(
const Point3D &pt3d_mm,
bool considerBoundingBox =
false)
const;
352 return (pt3d_mm -
GetOrigin()) * GetNormal() / len;
370 if (IsParallel(plane))
372 return SignedDistance(plane->
GetOrigin());
592 void PrintSelf(std::ostream &os, itk::Indent indent)
const override;
std::tuple< double, double, double > GetOrigin(const mitk::TimeGeometry *tg, mitk::TimeStepType t)
Returns the origin (x, y, z) at the given time step.
Abstract base class describing the geometry of a data object.
Point3D GetOrigin() const
Get the origin of the geometry in world coordinates (mm).
BoundingBoxType::BoundsArrayType BoundsArrayType
Fixed-size array of six ScalarType values representing axis-aligned bounds [xmin,xmax,...
Describes a line in N-dimensional space.
Base class for all operations in the undo/redo framework.
Describes the geometry of a plane object.
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 2D index coordinates of a vector to world coordinates (mm).
virtual void WorldToIndex(const Point2D &pt_mm, Point2D &pt_units) const
Convert 2D world coordinates (mm) to 2D index coordinates (units).
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
Execute an operation to re-orient or reposition the plane.
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
Determine whether a point is above (in the normal direction of) the plane.
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
Check whether a reference geometry has been set.
ScalarType DistanceFromPlane(const Point3D &pt3d_mm) const
Unsigned distance of a point from the infinite plane.
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
Get the normal vector of the plane as a 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
Convert 2D index coordinates (units) to 2D world coordinates (mm).
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
Compute the signed distance of a point from the plane.
virtual void WorldToIndex(const mitk::Vector2D &vec_mm, mitk::Vector2D &vec_units) const
Convert world coordinates (mm) of a 2D vector to continuous index coordinates.
void CheckBounds(const BoundsArrayType &bounds) override
CheckBounds.
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
Unsigned distance of a point from the geometry.
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
Get the normal vector of the plane.
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)
Find image slices visible on a given plane.
Line< ScalarType, 3 > Line3D
itk::ScalableAffineTransform< ScalarType, 3 > AffineTransform3D
3D affine transform type used throughout MITK.
MITKCORE_EXPORT bool operator!=(const InteractionEvent &a, const InteractionEvent &b)
MITKCORE_EXPORT bool operator==(const InteractionEvent &a, const InteractionEvent &b)
AnatomicalPlane
Enumeration of standard anatomical image planes.
@ Axial
Transverse plane (top-down view, perpendicular to body's long axis).
vnl_vector< ScalarType > VnlVector
double ScalarType
Scalar type used throughout MITK for geometric computations.