Slicer  4.11
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) 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  vtkMRMLNode* CreateNodeInstance() override;
45  // Description:
46  // Get node XML tag name (like Volume, Model)
47  const char* GetNodeTagName() override {return "Annotation";}
48 
49  // Description:
50  // Read node attributes from XML file
51  void ReadXMLAttributes( const char** atts) override;
52 
53  // Description:
54  // Write this node's information to a MRML file in XML format.
55  void WriteXML(ostream& of, int indent) override;
56 
57 
58  // Description:
59  // Copy the node's attributes to this object
60  void Copy(vtkMRMLNode *node) override;
61 
62 
63  void UpdateScene(vtkMRMLScene *scene) override;
64 
65  // Description:
66  // alternative method to propagate events generated in Display nodes
67  void ProcessMRMLEvents ( vtkObject * /*caller*/,
68  unsigned long /*event*/,
69  void * /*callData*/ ) 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  std::string GetDefaultStorageNodeClassName(const char* filename /* =nullptr */) override;
75 
76  // Description:
77  // Create default storage node or nullptr if does not have one
79 
82  bool CanApplyNonLinearTransforms()const 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:
150  ~vtkMRMLAnnotationNode() override;
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 ReadXMLAttributes(const char **atts) override
Read node attributes from XML file
vtkSmartPointer< vtkMRMLCameraNode > m_CameraNode
void PrintSelf(ostream &os, vtkIndent indent) override
std::string GetDefaultStorageNodeClassName(const char *filename) override
MRML node to represent a 3D surface model.
MRML node for storing a slice through RAS space.
bool CanApplyNonLinearTransforms() const override
void WriteXML(ostream &of, int indent) override
Write this node&#39;s information to a MRML file in XML format.
vtkMRMLAnnotationNode * m_Backup
static vtkMRMLModelNode * New()
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:56
void operator=(const vtkMRMLModelNode &)
vtkSmartPointer< vtkMRMLSliceNode > m_GreenSliceNode
A superclass for other storage nodes.
vtkMRMLStorageNode * CreateDefaultStorageNode() override
MRML node to represent camera node.
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
alternative method to propagate events generated in Display nodes
vtkSmartPointer< vtkMRMLSliceNode > m_RedSliceNode
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
void UpdateScene(vtkMRMLScene *scene) override
Finds the storage node and read the data
virtual const char * GetIcon()
vtkMRMLNode * CreateNodeInstance() override
MRMLNode methods.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:139
void Copy(vtkMRMLNode *node) override
Copy the node&#39;s attributes to this object.
vtkSmartPointer< vtkMRMLSliceNode > m_YellowSliceNode