Slicer 5.9
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
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// An 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"
16
17// Annotations includes
18#include "vtkSlicerAnnotationsModuleMRMLExport.h"
20
21// VTK includes
22#include <vtkSmartPointer.h>
23class vtkCellArray;
24class vtkPoints;
25class vtkStringArray;
26
27// STD includes
28#include <string>
29
30class VTK_SLICER_ANNOTATIONS_MODULE_MRML_EXPORT vtkMRMLAnnotationNode : public vtkMRMLModelNode
31{
32public:
35 void PrintSelf(ostream& os, vtkIndent indent) override;
36 // Description:
37 // Just prints short summary
38 virtual void PrintAnnotationInfo(ostream& os, vtkIndent indent, int titleFlag = 1);
39
40 virtual const char* GetIcon() {return "";}
41
42 //--------------------------------------------------------------------------
43 // MRMLNode methods
44 //--------------------------------------------------------------------------
45
47 // Description:
48 // Get node XML tag name (like Volume, Model)
49 const char* GetNodeTagName() override {return "Annotation";}
50
51 // Description:
52 // Read node attributes from XML file
53 void ReadXMLAttributes( const char** atts) override;
54
55 // Description:
56 // Write this node's information to a MRML file in XML format.
57 void WriteXML(ostream& of, int indent) override;
58
59
63
64 void UpdateScene(vtkMRMLScene *scene) override;
65
66 // Description:
67 // alternative method to propagate events generated in Display nodes
68 void ProcessMRMLEvents ( vtkObject * /*caller*/,
69 unsigned long /*event*/,
70 void * /*callData*/ ) override;
71
72 // vtkMRMLModelNode overrides it and it handles models only, while in annotations
73 // we have all kinds of nodes (e.g., screenshot), so we need to revert to the generic
74 // storable node implementation.
75 std::string GetDefaultStorageNodeClassName(const char* filename /* =nullptr */) override;
76
77 // Description:
78 // Create default storage node or nullptr if does not have one
80
83 bool CanApplyNonLinearTransforms()const override {return false;}
84
85 int AddText(const char *newText,int selectedFlag, int visibleFlag);
86 void SetText(int id, const char *newText,int selectedFlag, int visibleFlag);
87 std::string GetText(int id);
88 int DeleteText(int id);
89
91
92 enum
93 {
98 };
99 virtual const char *GetAttributeTypesEnumAsString(int val);
100 vtkDataArray* GetAnnotationAttributes(int att);
101 int GetAnnotationAttribute(vtkIdType id, int att);
102 void SetAnnotationAttribute(vtkIdType id, int att, double value);
103 int DeleteAttribute(vtkIdType idAttEntry, vtkIdType idAttType);
104
105 // Description:
106 // Initializes all variables associated with annotations
107 virtual void ResetAnnotations();
108
109 // Description:
110 // add display node if not already present
112
114
116 void SetTextScale(double textScale);
118 double GetTextScale();
119
120
121 // Description:
122 // Reference of this annotation - can be an image, model, scene , ...
123 vtkGetStringMacro (ReferenceNodeID);
124 vtkSetStringMacro (ReferenceNodeID);
125
129 vtkGetMacro(Locked, int);
130 void SetLocked(int init);
131
132 virtual void Initialize(vtkMRMLScene* mrmlScene);
133
134protected:
139
140 // Description:
141 // Initializes Text as well as attributes
142 // void ResetAnnotations();
143
144 // Description:
145 // Only initializes attributes with ID
146 void ResetAttributes(int id);
147 // Description:
148 // Initializes all attributes
150 void SetAttributeSize(vtkIdType id, vtkIdType n);
151
153 vtkPoints* GetPoints();
154 vtkCellArray* GetLines();
155
156 vtkStringArray *TextList;
158
160
162
163 vtkSmartPointer<vtkMRMLSliceNode> m_RedSliceNode;
164 vtkSmartPointer<vtkMRMLSliceNode> m_YellowSliceNode;
165 vtkSmartPointer<vtkMRMLSliceNode> m_GreenSliceNode;
166 vtkSmartPointer<vtkMRMLCameraNode> m_CameraNode;
167
168};
169
170#endif
void SetAttributeSize(vtkIdType id, vtkIdType n)
vtkSmartPointer< vtkMRMLCameraNode > m_CameraNode
void SetAnnotationAttribute(vtkIdType id, int att, double value)
virtual const char * GetIcon()
virtual const char * GetAttributeTypesEnumAsString(int val)
bool CanApplyNonLinearTransforms() const override
int GetAnnotationAttribute(vtkIdType id, int att)
std::string GetDefaultStorageNodeClassName(const char *filename) override
vtkPoints * GetPoints()
const char * GetNodeTagName() override
Get node XML tag name (like Volume, Model)
int AddText(const char *newText, int selectedFlag, int visibleFlag)
virtual void ResetAnnotations()
vtkSmartPointer< vtkMRMLSliceNode > m_YellowSliceNode
virtual void Initialize(vtkMRMLScene *mrmlScene)
void SetText(int id, const char *newText, int selectedFlag, int visibleFlag)
vtkCellArray * GetLines()
vtkMRMLAnnotationNode * m_Backup
void SetLocked(int init)
int DeleteAttribute(vtkIdType idAttEntry, vtkIdType idAttType)
vtkDataArray * GetAnnotationAttributes(int att)
vtkMRMLCopyContentMacro(vtkMRMLAnnotationNode)
static vtkMRMLAnnotationNode * New()
void CreateAnnotationTextDisplayNode()
void UpdateScene(vtkMRMLScene *scene) override
vtkMRMLAnnotationTextDisplayNode * GetAnnotationTextDisplayNode()
void SetTextScale(double textScale)
Set the text scale of the associated text.
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
Propagate events generated in mrml.
vtkMRMLNode * CreateNodeInstance() override
MRMLNode methods.
void ReadXMLAttributes(const char **atts) override
vtkSmartPointer< vtkMRMLSliceNode > m_GreenSliceNode
double GetTextScale()
Get the text scale of the associated text.
void WriteXML(ostream &of, int indent) override
~vtkMRMLAnnotationNode() override
vtkSmartPointer< vtkMRMLSliceNode > m_RedSliceNode
void ResetAttributes(int id)
int DeleteText(int id)
vtkMRMLAnnotationNode(const vtkMRMLAnnotationNode &)
void PrintSelf(ostream &os, vtkIndent indent) override
void operator=(const vtkMRMLAnnotationNode &)
vtkMRMLStorageNode * CreateDefaultStorageNode() override
std::string GetText(int id)
virtual void PrintAnnotationInfo(ostream &os, vtkIndent indent, int titleFlag=1)
MRML node to represent camera node.
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.
MRML node for storing a slice through RAS space.
A superclass for other storage nodes.