Slicer  5.3
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 
61 
62  void UpdateScene(vtkMRMLScene *scene) override;
63 
64  // Description:
65  // alternative method to propagate events generated in Display nodes
66  void ProcessMRMLEvents ( vtkObject * /*caller*/,
67  unsigned long /*event*/,
68  void * /*callData*/ ) override;
69 
70  // vtkMRMLModelNode overrides it and it handles models only, while in annotations
71  // we have all kinds of nodes (e.g., screenshot), so we need to revert to the generic
72  // storable node implementation.
73  std::string GetDefaultStorageNodeClassName(const char* filename /* =nullptr */) override;
74 
75  // Description:
76  // Create default storage node or nullptr if does not have one
78 
81  bool CanApplyNonLinearTransforms()const override {return false;}
82 
83  int AddText(const char *newText,int selectedFlag, int visibleFlag);
84  void SetText(int id, const char *newText,int selectedFlag, int visibleFlag);
85  vtkStdString GetText(int id);
86  int DeleteText(int id);
87 
88  int GetNumberOfTexts();
89 
90  enum
91  {
92  TEXT_SELECTED = 0,
96  };
97  virtual const char *GetAttributeTypesEnumAsString(int val);
98  vtkDataArray* GetAnnotationAttributes(int att);
99  int GetAnnotationAttribute(vtkIdType id, int att);
100  void SetAnnotationAttribute(vtkIdType id, int att, double value);
101  int DeleteAttribute(vtkIdType idAttEntry, vtkIdType idAttType);
102 
103  // Description:
104  // Initializes all variables associated with annotations
105  virtual void ResetAnnotations();
106 
107  // Description:
108  // add display node if not already present
109  void CreateAnnotationTextDisplayNode();
110 
111  vtkMRMLAnnotationTextDisplayNode* GetAnnotationTextDisplayNode();
112 
114  void SetTextScale(double textScale);
116  double GetTextScale();
117 
118 
119  // Description:
120  // Reference of this annotation - can be an image, model, scene , ...
121  vtkGetStringMacro (ReferenceNodeID);
122  vtkSetStringMacro (ReferenceNodeID);
123 
127  vtkGetMacro(Locked, int);
128  void SetLocked(int init);
129 
130  virtual void Initialize(vtkMRMLScene* mrmlScene);
131 
132  // Functionality for backups of this node
134  void CreateBackup();
135  void ClearBackup();
137  vtkMRMLAnnotationNode * GetBackup();
139  void RestoreBackup();
140 
141  // Functionality to save the current view
143  void SaveView();
145  void RestoreView();
146 
147 protected:
149  ~vtkMRMLAnnotationNode() override;
151  void operator=(const vtkMRMLAnnotationNode&);
152 
153  // Description:
154  // Initializes Text as well as attributes
155  // void ResetAnnotations();
156 
157  // Description:
158  // Only initializes attributes with ID
159  void ResetAttributes(int id);
160  // Description:
161  // Initializes all attributes
162  void ResetTextAttributesAll();
163  void SetAttributeSize(vtkIdType id, vtkIdType n);
164 
165  void CreatePolyData();
166  vtkPoints* GetPoints();
167  vtkCellArray* GetLines();
168 
169  vtkStringArray *TextList;
171 
172  int Locked;
173 
175 
176  vtkSmartPointer<vtkMRMLSliceNode> m_RedSliceNode;
177  vtkSmartPointer<vtkMRMLSliceNode> m_YellowSliceNode;
178  vtkSmartPointer<vtkMRMLSliceNode> m_GreenSliceNode;
179  vtkSmartPointer<vtkMRMLCameraNode> m_CameraNode;
180 
181 };
182 
183 #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.
vtkMRMLCopyContentMacro(vtkMRMLModelNode)
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:57
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:167
vtkSmartPointer< vtkMRMLSliceNode > m_YellowSliceNode