Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLAnnotationNode.h
Go to the documentation of this file.
1 // .NAME vtkMRMLAnnotationNode - MRML node to represent a fiber bundle from tractography in DTI data.
2 // .SECTION Description
3 // Annotation nodes contains control points, internally represented as vtkPolyData.
4 // A Annotation node contains many control points and forms the smallest logical unit of tractography
5 // that MRML will manage/read/write. Each control point has accompanying data.
6 // Visualization parameters for these nodes are controlled by the vtkMRMLAnnotationTextDisplayNode class.
7 //
8 
9 #ifndef __vtkMRMLAnnotationNode_h
10 #define __vtkMRMLAnnotationNode_h
11 
12 // MRML includes
13 #include "vtkMRMLModelNode.h"
14 class vtkMRMLCameraNode;
15 class vtkMRMLSliceNode;
16 
17 // Annotations includes
18 #include "vtkSlicerAnnotationsModuleMRMLExport.h"
20 
21 // VTK includes
22 #include <vtkSmartPointer.h>
23 class vtkCellArray;
24 class vtkPoints;
25 class vtkStringArray;
26 
28 class VTK_SLICER_ANNOTATIONS_MODULE_MRML_EXPORT vtkMRMLAnnotationNode : public vtkMRMLModelNode
29 {
30 public:
31  static vtkMRMLAnnotationNode *New();
33  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
34  // Description:
35  // Just prints short summary
36  virtual void PrintAnnotationInfo(ostream& os, vtkIndent indent, int titleFlag = 1);
37 
38  virtual const char* GetIcon() {return "";}
39 
40  //--------------------------------------------------------------------------
41  // MRMLNode methods
42  //--------------------------------------------------------------------------
43 
44  virtual vtkMRMLNode* CreateNodeInstance() VTK_OVERRIDE;
45  // Description:
46  // Get node XML tag name (like Volume, Model)
47  virtual const char* GetNodeTagName() VTK_OVERRIDE {return "Annotation";}
48 
49  // Description:
50  // Read node attributes from XML file
51  virtual void ReadXMLAttributes( const char** atts) VTK_OVERRIDE;
52 
53  // Description:
54  // Write this node's information to a MRML file in XML format.
55  virtual void WriteXML(ostream& of, int indent) VTK_OVERRIDE;
56 
57 
58  // Description:
59  // Copy the node's attributes to this object
60  virtual void Copy(vtkMRMLNode *node) VTK_OVERRIDE;
61 
62 
63  void UpdateScene(vtkMRMLScene *scene) VTK_OVERRIDE;
64 
65  // Description:
66  // alternative method to propagate events generated in Display nodes
67  virtual void ProcessMRMLEvents ( vtkObject * /*caller*/,
68  unsigned long /*event*/,
69  void * /*callData*/ ) VTK_OVERRIDE;
70 
71  // vtkMRMLModelNode overrides it and it handles models only, while in annotations
72  // we have all kinds of nodes (e.g., screenshot), so we need to revert to the generic
73  // storable node implementation.
74  virtual std::string GetDefaultStorageNodeClassName(const char* filename /* =NULL */) VTK_OVERRIDE;
75 
76  // Description:
77  // Create default storage node or NULL if does not have one
78  virtual vtkMRMLStorageNode* CreateDefaultStorageNode() VTK_OVERRIDE;
79 
82  virtual bool CanApplyNonLinearTransforms()const VTK_OVERRIDE {return false;}
83 
84  int AddText(const char *newText,int selectedFlag, int visibleFlag);
85  void SetText(int id, const char *newText,int selectedFlag, int visibleFlag);
86  vtkStdString GetText(int id);
87  int DeleteText(int id);
88 
89  int GetNumberOfTexts();
90 
91  enum
92  {
93  TEXT_SELECTED = 0,
97  };
98  virtual const char *GetAttributeTypesEnumAsString(int val);
99  vtkDataArray* GetAnnotationAttributes(int att);
100  int GetAnnotationAttribute(vtkIdType id, int att);
101  void SetAnnotationAttribute(vtkIdType id, int att, double value);
102  int DeleteAttribute(vtkIdType idAttEntry, vtkIdType idAttType);
103 
104  // Description:
105  // Initializes all variables associated with annotations
106  virtual void ResetAnnotations();
107 
108  // Description:
109  // add display node if not already present
110  void CreateAnnotationTextDisplayNode();
111 
112  vtkMRMLAnnotationTextDisplayNode* GetAnnotationTextDisplayNode();
113 
115  void SetTextScale(double textScale);
117  double GetTextScale();
118 
119 
120  // Description:
121  // Reference of this annotation - can be an image, model, scene , ...
122  vtkGetStringMacro (ReferenceNodeID);
123  vtkSetStringMacro (ReferenceNodeID);
124 
128  vtkGetMacro(Locked, int);
129  void SetLocked(int init);
130 
131  virtual void Initialize(vtkMRMLScene* mrmlScene);
132 
133  // Functionality for backups of this node
135  void CreateBackup();
136  void ClearBackup();
138  vtkMRMLAnnotationNode * GetBackup();
140  void RestoreBackup();
141 
142  // Functionality to save the current view
144  void SaveView();
146  void RestoreView();
147 
148 protected:
152  void operator=(const vtkMRMLAnnotationNode&);
153 
154  // Description:
155  // Initializes Text as well as attributes
156  // void ResetAnnotations();
157 
158  // Description:
159  // Only initializes attributes with ID
160  void ResetAttributes(int id);
161  // Description:
162  // Initializes all attributes
163  void ResetTextAttributesAll();
164  void SetAttributeSize(vtkIdType id, vtkIdType n);
165 
166  void CreatePolyData();
167  vtkPoints* GetPoints();
168  vtkCellArray* GetLines();
169 
170  vtkStringArray *TextList;
172 
173  int Locked;
174 
176 
177  vtkSmartPointer<vtkMRMLSliceNode> m_RedSliceNode;
178  vtkSmartPointer<vtkMRMLSliceNode> m_YellowSliceNode;
179  vtkSmartPointer<vtkMRMLSliceNode> m_GreenSliceNode;
180  vtkSmartPointer<vtkMRMLCameraNode> m_CameraNode;
181 
182 };
183 
184 #endif
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
vtkSmartPointer< vtkMRMLCameraNode > m_CameraNode
virtual void Copy(vtkMRMLNode *node) VTK_OVERRIDE
Copy the node&#39;s attributes to this object.
MRML node to represent a 3D surface model.
MRML node for storing a slice through RAS space.
virtual vtkMRMLStorageNode * CreateDefaultStorageNode() VTK_OVERRIDE
vtkMRMLAnnotationNode * m_Backup
static vtkMRMLModelNode * New()
virtual vtkMRMLNode * CreateNodeInstance() VTK_OVERRIDE
MRMLNode methods.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
void operator=(const vtkMRMLModelNode &)
virtual void ProcessMRMLEvents(vtkObject *, unsigned long, void *) VTK_OVERRIDE
alternative method to propagate events generated in Display nodes
virtual void ReadXMLAttributes(const char **atts) VTK_OVERRIDE
Read node attributes from XML file
vtkSmartPointer< vtkMRMLSliceNode > m_GreenSliceNode
A superclass for other storage nodes.
virtual std::string GetDefaultStorageNodeClassName(const char *filename) VTK_OVERRIDE
MRML node to represent camera node.
virtual void WriteXML(ostream &of, int indent) VTK_OVERRIDE
Write this node&#39;s information to a MRML file in XML format.
vtkSmartPointer< vtkMRMLSliceNode > m_RedSliceNode
virtual const char * GetIcon()
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:138
virtual void UpdateScene(vtkMRMLScene *scene) VTK_OVERRIDE
Finds the storage node and read the data
vtkSmartPointer< vtkMRMLSliceNode > m_YellowSliceNode