Slicer  4.11
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLMarkupsPlaneNode.h
Go to the documentation of this file.
1 /*==============================================================================
2 
3  Copyright (c) Laboratory for Percutaneous Surgery (PerkLab)
4  Queen's University, Kingston, ON, Canada. All Rights Reserved.
5 
6  See COPYRIGHT.txt
7  or http://www.slicer.org/copyright/copyright.txt for details.
8 
9  Unless required by applicable law or agreed to in writing, software
10  distributed under the License is distributed on an "AS IS" BASIS,
11  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  See the License for the specific language governing permissions and
13  limitations under the License.
14 
15  This file was originally developed by Kyle Sunderland, PerkLab, Queen's University
16  and was supported through CANARIE's Research Software Program, Cancer
17  Care Ontario, OpenAnatomy, and Brigham and Women's Hospital through NIH grant R01MH112748.
18 
19 ==============================================================================*/
20 
21 #ifndef __vtkMRMLMarkupsPlaneNode_h
22 #define __vtkMRMLMarkupsPlaneNode_h
23 
24 // MRML includes
25 #include "vtkMRMLDisplayableNode.h"
26 
27 // Markups includes
28 #include "vtkSlicerMarkupsModuleMRMLExport.h"
30 #include "vtkMRMLMarkupsNode.h"
31 
32 // VTK includes
33 #include <vtkMatrix4x4.h>
34 
47 class VTK_SLICER_MARKUPS_MODULE_MRML_EXPORT vtkMRMLMarkupsPlaneNode : public vtkMRMLMarkupsNode
48 {
49 public:
50  static vtkMRMLMarkupsPlaneNode *New();
53  void PrintSelf(ostream& os, vtkIndent indent) override;
54 
55  const char* GetIcon() override {return ":/Icons/MarkupsPlaneMouseModePlace.png";}
56 
57  //--------------------------------------------------------------------------
58  // MRMLNode methods
59  //--------------------------------------------------------------------------
60 
61  enum
62  {
66  };
67 
68  vtkMRMLNode* CreateNodeInstance() override;
70  const char* GetNodeTagName() override {return "MarkupsPlane";}
71 
73  void ReadXMLAttributes( const char** atts) override;
74 
76  void WriteXML(ostream& of, int indent) override;
77 
81 
86  vtkSetMacro(SizeMode, int);
87  vtkGetMacro(SizeMode, int);
88  const char* GetSizeModeAsString(int sizeMode);
89  int GetSizeModeFromString(const char* sizeMode);
90 
94  vtkGetMacro(AutoSizeScalingFactor, double);
95  vtkSetMacro(AutoSizeScalingFactor, double);
96 
100  void GetPlaneBounds(double bounds[6]);
101  vtkSetVector6Macro(PlaneBounds, double);
102 
105  void GetNormal(double normal[3]);
106  void SetNormal(const double normal[3]);
107  void GetNormalWorld(double normal[3]);
108  void SetNormalWorld(const double normal[3]);
109 
112  void GetOrigin(double origin[3]);
113  void SetOrigin(const double origin[3]);
114  void GetOriginWorld(double origin[3]);
115  void SetOriginWorld(const double origin[3]);
116 
122  void GetAxes(double x[3], double y[3], double z[3]);
123  void SetAxes(const double x[3], const double y[3], const double z[3]);
124  void GetAxesWorld(double x[3], double y[3], double z[3]);
125  void SetAxesWorld(const double x[3], const double y[3], const double z[3]);
126 
127  // Mapping from XYZ plane coordinates to local coordinates
128  virtual void GetPlaneToLocalMatrix(vtkMatrix4x4* planeToLocalMatrix);
129  // Mapping from XYZ plane coordinates to world coordinates
130  virtual void GetPlaneToWorldMatrix(vtkMatrix4x4* planeToWorldMatrix);
131 
134  virtual vtkMatrix4x4* GetPlaneToPlaneOffsetMatrix();
135 
143  double GetClosestPointOnPlaneWorld(const double posWorld[3], double closestPosWorld[3], bool infinitePlane = true);
144 
145 protected:
146 
148  void CalculateAxesFromPoints(const double point0[3], const double point1[3], const double point2[3], double x[3], double y[3], double z[3]);
149 
150  int SizeMode;
152  double PlaneBounds[6];
153  vtkSmartPointer<vtkMatrix4x4> PlaneToPlaneOffsetMatrix;
154 
158  void CreatePlane();
159 
161  void UpdateInteractionHandleToWorldMatrix() override;
162 
164  ~vtkMRMLMarkupsPlaneNode() override;
166  void operator=(const vtkMRMLMarkupsPlaneNode&);
167 };
168 
169 #endif
static vtkMRMLMarkupsNode * New()
const char * GetIcon() override
vtkSmartPointer< vtkMatrix4x4 > PlaneToPlaneOffsetMatrix
void operator=(const vtkMRMLMarkupsNode &)
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
virtual void UpdateInteractionHandleToWorldMatrix()
Calculates the handle to world matrix based on the current control points.
MRML node to represent a plane markup Plane Markups nodes contain three control points. Visualization parameters are set in the vtkMRMLMarkupsDisplayNode class.
vtkMRMLCopyContentMacro(vtkMRMLMarkupsNode)
vtkMRMLNode * CreateNodeInstance() override
MRMLNode methods.
void ReadXMLAttributes(const char **atts) override
Read node attributes from XML file.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
void WriteXML(ostream &of, int indent) override
Write this node&#39;s information to a MRML file in XML format.
void PrintSelf(ostream &os, vtkIndent indent) override