21#ifndef __vtkMRMLMarkupsPlaneNode_h
22#define __vtkMRMLMarkupsPlaneNode_h
30#include "vtkSlicerMarkupsModuleMRMLExport.h"
33#include <vtkMatrix4x4.h>
61 void PrintSelf(ostream& os, vtkIndent indent)
override;
63 const char*
GetIcon()
override {
return ":/Icons/MarkupsPlane.png";}
64 const char*
GetAddIcon()
override {
return ":/Icons/MarkupsPlaneMouseModePlace.png";}
65 const char*
GetPlaceAddIcon()
override {
return ":/Icons/MarkupsPlaneMouseModePlaceAdd.png";}
98 void WriteXML(ostream& of,
int indent)
override;
105 using Superclass::ApplyTransform;
106 void ApplyTransform(vtkAbstractTransform* transform,
bool applyToLockedControlPoints)
override;
114 vtkGetMacro(SizeMode,
int);
122 vtkGetMacro(AutoSizeScalingFactor,
double);
123 vtkSetMacro(AutoSizeScalingFactor,
double);
133 virtual
void SetSize(
double x,
double y);
134 virtual
void SetSize(
double size[2]) { this->
SetSize(size[0], size[1]); }
144 void SetSizeWorld(const
double normal[2]);
145 void SetSizeWorld(
double x,
double y);
150 vtkGetVector4Macro(PlaneBounds,
double);
151 virtual
void SetPlaneBounds(
double x0,
double x1,
double y0,
double y1);
152 virtual
void SetPlaneBounds(
double bounds[4]) { this->
SetPlaneBounds(bounds[0], bounds[1], bounds[2], bounds[3]); };
159 void GetNormalWorld(
double normal[3]);
160 double* GetNormalWorld() VTK_SIZEHINT(3);
161 void SetNormal(const
double normal[3]);
162 void SetNormal(
double x,
double y,
double z);
163 void SetNormalWorld(const
double normal[3]);
164 void SetNormalWorld(
double x,
double y,
double z);
169 void GetOrigin(
double origin[3]);
170 double* GetOrigin() VTK_SIZEHINT(3);
171 void GetOriginWorld(
double origin[3]);
172 double* GetOriginWorld() VTK_SIZEHINT(3);
173 void SetOrigin(const
double origin[3]);
174 void SetOrigin(
double x,
double y,
double z);
175 void SetOriginWorld(const
double origin[3]);
176 void SetOriginWorld(
double x,
double y,
double z);
181 void GetCenter(
double origin[3]) { this->GetOrigin(origin); };
182 double*
GetCenter() VTK_SIZEHINT(3) {
return this->GetOrigin(); };
185 void SetCenter(
const double origin[3]) { this->SetOrigin(origin); };
186 void SetCenter(
double x,
double y,
double z) { this->SetOrigin(x, y, z); };
188 void SetCenterWorld(
double x,
double y,
double z) { this->SetOriginWorld(x, y, z); };
197 void GetAxes(
double x[3],
double y[3],
double z[3]);
198 void SetAxes(
const double x[3],
const double y[3],
const double z[3]);
200 void SetAxesWorld(
const double x[3],
const double y[3],
const double z[3]);
247 vtkGetMacro(PlaneType,
int);
254 vtkGetMacro(IsPlaneValid,
bool);
260 vtkMatrix4x4* outputMatrix, vtkAbstractTransform* transform =
nullptr,
bool applyScaling =
true);
262 vtkMatrix4x4* outputMatrix, vtkAbstractTransform* transform =
nullptr,
bool applyScaling =
true);
276 vtkSetMacro(MaximumNumberOfControlPoints,
int);
277 vtkSetMacro(RequiredNumberOfControlPoints,
int);
280 vtkSetMacro(IsPlaneValid,
bool);
286 void CalculateAxesFromPoints(
const double point0[3],
const double point1[3],
const double point2[3],
double x[3],
double y[3],
double z[3]);
314 vtkGetMacro(NormalPointRequired,
bool);
320 bool IsUpdatingControlPointsFromPlane{
false };
321 bool IsUpdatingPlaneFromControlPoints{
false };
323 int SizeMode{ SizeModeAuto };
324 double AutoSizeScalingFactor{ 1.0 };
329 double Size[2] = { 100.0, 100.0 };
330 double PlaneBounds[4] = { -50.0, 50.0, -50.0, 50.0 };
333 double Normal[3] = { 0.0, 0.0, 0.0 };
334 double NormalWorld[3] = { 0.0, 0.0, 0.0 };
335 double Origin[3] = { 0.0, 0.0, 0.0 };
336 double OriginWorld[3] = { 0.0, 0.0, 0.0 };
337 double SizeWorld[2] = { 0.0, 0.0 };
339 int PlaneType{ PlaneTypePointNormal };
340 bool IsPlaneValid{
false };
341 bool NormalPointRequired{
false };
MRML node to represent a plane markup Plane Markups nodes contain three control points....
void operator=(const vtkMRMLMarkupsPlaneNode &)
virtual void UpdateControlPointsFromPlaneFit()
static vtkMRMLMarkupsPlaneNode * New()
virtual void UpdateControlPointsFrom3Points()
void SetAxes(const double x[3], const double y[3], const double z[3])
vtkSmartPointer< vtkMatrix4x4 > BaseToNodeMatrix
void UpdateInteractionHandleToWorldMatrix() override
Calculates the handle to world matrix based on the current control points.
virtual void GetBaseToWorldMatrix(vtkMatrix4x4 *baseToWorldMatrix)
Mapping from Base plane coordinates to world coordinates.
void CalculatePlaneBounds(vtkPoints *cornerPoints, double bounds[6])
Calculates the axis-aligned bounds defined by the corners of the plane.
virtual void UpdatePlaneFromPointNormal()
virtual void GetObjectToNodeMatrix(vtkMatrix4x4 *objectToNodeMatrix)
Mapping from XYZ plane coordinates to local coordinates.
vtkSmartPointer< vtkMatrix4x4 > ObjectToBaseMatrix
void SetSizeMode(int sizeMode)
vtkMRMLCopyContentMacro(vtkMRMLMarkupsPlaneNode)
virtual void UpdateControlPointsFromPlane()
Calculate the position of control points from the ROI.
double * GetSize() VTK_SIZEHINT(2)
virtual void GetObjectToWorldMatrix(vtkMatrix4x4 *objectToWorldMatrix)
Mapping from XYZ plane coordinates to world coordinates.
void UpdateImplicitFunction()
static const char * GetSizeModeAsString(int sizeMode)
const char * GetPlaceAddIcon() override
void GetNormal(double normal[3])
Get/Set the normal vector for the plane in object or world coordinate system.
vtkMRMLMarkupsPlaneNode()
void WriteXML(ostream &of, int indent) override
Write this node's information to a MRML file in XML format.
bool GetClosestFitPlaneFromControlPoints(vtkMatrix4x4 *closestFitPlane)
void GetAxesWorld(double x[3], double y[3], double z[3])
void ApplyTransform(vtkAbstractTransform *transform, bool applyToLockedControlPoints) override
double * GetCenterWorld() VTK_SIZEHINT(3)
virtual void SetNormalPointRequired(bool)
~vtkMRMLMarkupsPlaneNode() override
void SetAxesWorld(const double x[3], const double y[3], const double z[3])
void CalculatePlaneCornerPoints(vtkPoints *points, double xAxis[3], double yAxis[3], double center[3], double size[2])
Calculates the axis-aligned bounds defined by the corners of the plane.
virtual void SetSize(double size[2])
static int GetSizeModeFromString(const char *sizeMode)
virtual void GetBaseToNodeMatrix(vtkMatrix4x4 *matrix)
Mapping from Base plane coordinates to local coordinates.
void ProcessMRMLEvents(vtkObject *caller, unsigned long event, void *callData) override
Re-implemented to react to changes in internal matrices or control points.
void GetRASBounds(double bounds[6]) override
virtual void UpdateControlPointsFromPointNormal()
void GetAxes(double x[3], double y[3], double z[3])
void SetCenterWorld(double x, double y, double z)
void OnTransformNodeReferenceChanged(vtkMRMLTransformNode *transformNode) override
Reimplemented to recalculate InteractionHandleToWorld matrix when parent transform is changed.
void SetCenterWorld(const double origin[3])
void GetPlaneCornerPointsWorld(vtkPoints *points_World)
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file.
void CreateDefaultDisplayNodes() override
Create default display node or nullptr if does not have one.
double GetClosestPointOnPlaneWorld(const double posWorld[3], double closestPosWorld[3], bool infinitePlane=true)
static void GenerateOrthogonalMatrix(vtkMatrix4x4 *inputMatrix, vtkMatrix4x4 *outputMatrix, vtkAbstractTransform *transform=nullptr, bool applyScaling=true)
vtkMRMLNode * CreateNodeInstance() override
MRMLNode methods.
virtual void UpdatePlaneSize()
double * GetCenter() VTK_SIZEHINT(3)
virtual void UpdatePlaneFromPlaneFit()
static const char * GetPlaneTypeAsString(int planeType)
virtual void UpdatePlaneFromControlPoints()
Updates the plane based on plane type and control point position.
vtkMRMLMarkupsPlaneNode(const vtkMRMLMarkupsPlaneNode &)
const char * GetMarkupType() override
Get markup type internal name.
virtual vtkMatrix4x4 * GetObjectToBaseMatrix()
virtual void SetPlaneBounds(double bounds[4])
double * GetSizeWorld() VTK_SIZEHINT(2)
void SetCenter(const double origin[3])
const char * GetAddIcon() override
virtual void UpdatePlaneFrom3Points()
vtkImplicitFunction * GetImplicitFunctionWorld() override
static void GenerateOrthogonalMatrix(double xAxis[3], double yAxis[3], double zAxis[3], double origin[3], vtkMatrix4x4 *outputMatrix, vtkAbstractTransform *transform=nullptr, bool applyScaling=true)
const char * GetIcon() override
void GetCenterWorld(double origin[3])
vtkMRMLStorageNode * CreateDefaultStorageNode() override
Create default storage node or nullptr if does not have one.
static int GetPlaneTypeFromString(const char *planeType)
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
void PrintSelf(ostream &os, vtkIndent indent) override
Print out the node information to the output stream.
void SetCenter(double x, double y, double z)
vtkSmartPointer< vtkPlane > ImplicitPlaneWorld
void SetPlaneType(int planeType)
double * GetNormal() VTK_SIZEHINT(3)
void GetBounds(double bounds[6]) override
void GetSizeWorld(double size[2])
void GetSize(double size[2])
void GetPlaneCornerPoints(vtkPoints *points_Node)
Retrieves the list of points that define the corners of the plane.
virtual vtkMatrix4x4 * GetBaseToNodeMatrix()
void CalculateAxesFromPoints(const double point0[3], const double point1[3], const double point2[3], double x[3], double y[3], double z[3])
Calculates the x y and z axis of the plane from the 3 input points.
Abstract Superclass for all specific types of MRML nodes.
A superclass for other storage nodes.
Default representation for the plane widget.
Default representation for the plane widget.