Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Modules Pages
vtkMRMLAnnotationAngleNode.h
Go to the documentation of this file.
1 #ifndef __vtkMRMLAnnotationAngleNode_h
2 #define __vtkMRMLAnnotationAngleNode_h
3 
4 #include "vtkSlicerAnnotationsModuleMRMLExport.h"
6 
7 class vtkMatrix4x4;
8 class vtkAbstractTransform;
9 class vtkMRMLScene;
10 
12 class VTK_SLICER_ANNOTATIONS_MODULE_MRML_EXPORT vtkMRMLAnnotationAngleNode : public vtkMRMLAnnotationLinesNode
13 {
14 public:
17  // Description:
18  // Just prints short summary
19  virtual void PrintAnnotationInfo(ostream& os, vtkIndent indent, int titleFlag = 1) VTK_OVERRIDE;
20 
21  //--------------------------------------------------------------------------
22  // MRMLNode methods
23  //--------------------------------------------------------------------------
24 
25  virtual vtkMRMLNode* CreateNodeInstance() VTK_OVERRIDE;
26  // Description:
27  // Get node XML tag name (like Volume, Model)
28  virtual const char* GetNodeTagName() VTK_OVERRIDE {return "AnnotationAngle";}
29 
30  // Description:
31  // Read node attributes from XML file
32  virtual void ReadXMLAttributes( const char** atts) VTK_OVERRIDE;
33 
34  // Description:
35  // Write this node's information to a MRML file in XML format.
36  virtual void WriteXML(ostream& of, int indent) VTK_OVERRIDE;
37 
38 
39  // Description:
40  // Copy the node's attributes to this object
41  virtual void Copy(vtkMRMLNode *node) VTK_OVERRIDE;
42 
43  void UpdateScene(vtkMRMLScene *scene) VTK_OVERRIDE;
44 
45  // Description:
46  // alternative method to propagate events generated in Display nodes
47  virtual void ProcessMRMLEvents ( vtkObject * /*caller*/,
48  unsigned long /*event*/,
49  void * /*callData*/ ) VTK_OVERRIDE;
50 
51  // Legacy code
52  // Description:
53  // get/set the first point position
54  double* GetPosition1() {return this->GetControlPointCoordinates(0);}
55 
56  int SetPosition1(double newControl[3]) { return this->SetControlPoint(0, newControl) ; }
57 
58  int SetPosition1(double nC1, double nC2, double nC3) {
59  double newControl[3] = {nC1,nC2,nC3};
60  return this->SetPosition1(newControl) ;
61  }
62 
63  double* GetPosition2() {return this->GetControlPointCoordinates(1);}
64  int SetPosition2(double newControl[3]) { return this->SetControlPoint(1, newControl);}
65 
66  int SetPosition2(double nC1, double nC2, double nC3) {
67  double newControl[3] = {nC1,nC2,nC3};
68  return this->SetPosition2(newControl) ;
69  }
70 
71  double* GetPositionCenter() { return this->GetControlPointCoordinates(2);}
72  int SetPositionCenter(double newControl[3]) { return this->SetControlPoint(2, newControl);}
73 
74  int SetPositionCenter(double nC1, double nC2, double nC3) {
75  double newControl[3] = {nC1,nC2,nC3};
76  return this->SetPositionCenter(newControl) ;
77  }
78 
79  // Description:
80  // get/set the distance annotation format, it's in standard sprintf notation
81  vtkGetStringMacro(LabelFormat);
82  vtkSetStringMacro(LabelFormat);
83 
84  // Description:
85  // KP Define - should be part of AnnotationAngleDisplayNode
86  double GetLabelScale();
87  void SetLabelScale(double init);
88 
89  // Description:
90  // get/set the distance annotation visbility
91  int GetLabelVisibility();
92  void SetLabelVisibility(int flag);
93 
94  int SetAngle(vtkIdType line1Id, vtkIdType line2Id, int sel, int vis);
95 
96  // Description:
101 
102  int GetArcVisibility() { return this->GetLabelVisibility();}
103  void SetArcVisibility(int flag) { this->SetLabelVisibility(flag);}
104 
105  // Description:
106  // get/set the resolution (number of subdivisions) of the line.
107  vtkGetMacro(Resolution, int);
108  vtkSetMacro(Resolution, int);
109 
110  // Description:
111  // get/set the point representation colour
112  double *GetPointColour();
113  void SetPointColour( double initColor[3]);
114 
115  // Description:
116  // get/set the line representation colour
117  double *GetLineColour();
118  void SetLineColour(double newColor[3]);
119 
120  // Description:
121  // get/set the distance annotation text colour
122  double *GetLabelTextColour();
123  void SetLabelTextColour(double initColor[3]);
124 
125  // Description:
126  // transform utility functions
127  virtual void ApplyTransform(vtkAbstractTransform* transform) VTK_OVERRIDE;
128 
129  // Description:
130  // Create default storage node or NULL if does not have one
131  virtual vtkMRMLStorageNode* CreateDefaultStorageNode() VTK_OVERRIDE;
132 
133  // void Initialize(vtkMRMLScene* mrmlScene);
134 
135  // Description:
136  // get/set the id of the model the ends of the widget are constrained upon
137  vtkGetStringMacro(ModelID1);
138  vtkSetStringMacro(ModelID1);
139  vtkGetStringMacro(ModelID2);
140  vtkSetStringMacro(ModelID2);
141  vtkGetStringMacro(ModelIDCenter);
142  vtkSetStringMacro(ModelIDCenter);
143 
144  void SetAngleMeasurement(double val);
145  double GetAngleMeasurement();
146 
147  enum
148  {
149  AngleNodeAddedEvent = 0,
151  };
152 
153 protected:
158 
159  // Description:
160  // number of subdivisions on the line
162  char* LabelFormat;
163 
164  int SetControlPoint(int id, double newControl[3]);
165 
166  int AddControlPoint(double newControl[3],int selectedFlag, int visibleFlag);
167 
168  // Description:
169  // the model ids for the models that the ends of the widget are constrained
170  // to
171  char *ModelID1;
172  char *ModelID2;
175 
176 };
177 
178 #endif
virtual void PrintAnnotationInfo(ostream &os, vtkIndent indent, int titleFlag=1) VTK_OVERRIDE
int AddControlPoint(double newControl[3], int selectedFlag, int visibleFlag)
void operator=(const vtkMRMLAnnotationLinesNode &)
virtual void ReadXMLAttributes(const char **atts) VTK_OVERRIDE
Read node attributes from XML file
int SetPosition1(double nC1, double nC2, double nC3)
int SetPosition2(double nC1, double nC2, double nC3)
int SetPosition1(double newControl[3])
int SetControlPoint(int id, double newControl[3], int selectedFlag, int visibleFlag)
int SetPositionCenter(double nC1, double nC2, double nC3)
int GetAnnotationAttribute(vtkIdType id, int att)
int SetPosition2(double newControl[3])
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
int SetPositionCenter(double newControl[3])
virtual void Copy(vtkMRMLNode *node) VTK_OVERRIDE
Copy the node's attributes to this object.
virtual void WriteXML(ostream &of, int indent) VTK_OVERRIDE
Write this node's information to a MRML file in XML format.
void SetAnnotationAttribute(vtkIdType id, int att, double value)
A superclass for other storage nodes.
double * GetControlPointCoordinates(vtkIdType id)
static vtkMRMLAnnotationLinesNode * New()
virtual void ApplyTransform(vtkAbstractTransform *transform) VTK_OVERRIDE
virtual vtkMRMLStorageNode * CreateDefaultStorageNode() VTK_OVERRIDE
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:138
virtual void ProcessMRMLEvents(vtkObject *, unsigned long, void *) VTK_OVERRIDE
alternative method to propagate events generated in Display nodes
void UpdateScene(vtkMRMLScene *scene) VTK_OVERRIDE
Finds the storage node and read the data