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
vtkMRMLAnnotationDisplayNode.h
Go to the documentation of this file.
1// .NAME vtkMRMLAnnotationDisplayNode - MRML node to represent display properties for tractography.
2// .SECTION Description
3// vtkMRMLAnnotationDisplayNode nodes store display properties of trajectories
4// from tractography in diffusion MRI data, including color type (by bundle, by fiber,
5// or by scalar invariants), display on/off for tensor glyphs and display of
6// trajectory as a line or tube.
7//
8
9#ifndef __vtkMRMLAnnotationDisplayNode_h
10#define __vtkMRMLAnnotationDisplayNode_h
11
12#include "vtkMRML.h"
15#include "vtkMRMLDisplayNode.h"
16#include "vtkSlicerAnnotationsModuleMRMLExport.h"
17
18#define vtkSetAndPropagateVector3Macro(name,type) \
19virtual void SetAndPropagateSuper##name (type _arg1, type _arg2, type _arg3) \
20{ \
21 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Super" << #name " to (" << _arg1 << "," << _arg2 << "," << _arg3 << ")"); \
22 if ((this->Super##name[0] != _arg1)||(this->Super##name[1] != _arg2)||(this->Super##name[2] != _arg3)) \
23 { \
24 this->name[0] = _arg1; \
25 this->name[1] = _arg2; \
26 this->name[2] = _arg3; \
27 this->Super##name[0] = _arg1; \
28 this->Super##name[1] = _arg2; \
29 this->Super##name[2] = _arg3; \
30 vtkMRMLDisplayableNode *displayableNode = this->GetDisplayableNode(); \
31 if (!displayableNode) \
32 { \
33 return; \
34 } \
35 for (int i=0; i<displayableNode->GetNumberOfDisplayNodes(); i++) \
36 { \
37 vtkMRMLDisplayNode *displayNode = displayableNode->GetNthDisplayNode(i); \
38 if (!displayNode || displayNode==this) \
39 { \
40 continue; \
41 } \
42 displayNode->Set##name(this->Super##name); \
43 } \
44 this->Modified(); \
45 } \
46}; \
47virtual void SetAndPropagateSuper##name (type _arg[3]) \
48{ \
49 this->SetAndPropagateSuper##name (_arg[0], _arg[1], _arg[2]);\
50}
51
52#define vtkSetAndPropagateMacro(name,type) \
53virtual void SetAndPropagateSuper##name (type _arg) \
54{ \
55 vtkDebugMacro(<< this->GetClassName() << " (" << this << "): setting Super" << #name " to (" << _arg << ")"); \
56 if (this->Super##name != _arg) \
57 { \
58 this->name = _arg; \
59 this->Super##name = _arg; \
60 vtkMRMLDisplayableNode *displayableNode = this->GetDisplayableNode(); \
61 if (!displayableNode) \
62 { \
63 return; \
64 } \
65 for (int i=0; i<displayableNode->GetNumberOfDisplayNodes(); i++) \
66 { \
67 vtkMRMLDisplayNode *displayNode = displayableNode->GetNthDisplayNode(i); \
68 if (!displayNode || displayNode==this) \
69 { \
70 continue; \
71 } \
72 displayNode->Set##name(this->Super##name); \
73 } \
74 this->Modified(); \
75 } \
76}; \
77
78
79class VTK_SLICER_ANNOTATIONS_MODULE_MRML_EXPORT vtkMRMLAnnotationDisplayNode : public vtkMRMLModelDisplayNode
80{
81 public:
84 void PrintSelf ( ostream& os, vtkIndent indent ) override;
85
86 //--------------------------------------------------------------------------
87 // MRMLNode methods
88 //--------------------------------------------------------------------------
89
91
92 // Description:
93 // Read node attributes from XML (MRML) file
94 void ReadXMLAttributes ( const char** atts ) override;
95
96 // Description:
97 // Write this node's information to a MRML file in XML format.
98 void WriteXML ( ostream& of, int indent ) override;
99
100
101 // Description:
102 // Copy the node's attributes to this object
103 void Copy ( vtkMRMLNode *node ) override;
104
105 // Description:
106 // Get node XML tag name (like Volume, Annotation)
107 const char* GetNodeTagName() override {return "AnnotationDisplay";}
108
109 // Description:
110 // Finds the storage node and read the data
111 void UpdateScene(vtkMRMLScene *scene) override;
112
113 // Description:
114 // alternative method to propagate events generated in Display nodes
115 void ProcessMRMLEvents ( vtkObject * /*caller*/,
116 unsigned long /*event*/,
117 void * /*callData*/ ) override;
118
119 // Functionality for backups of this node
121 virtual void CreateBackup(){};
122 virtual void RestoreBackup(){};
126
127 //
128 // Set and propagate attributes to all other displayNodes
129 //
130
132 vtkGetVector3Macro(SuperColor, double);
133
135 vtkGetVector3Macro(SuperSelectedColor, double);
136
138 vtkGetMacro(SuperOpacity, double);
139
141 vtkGetMacro(SuperAmbient, double);
142
144 vtkGetMacro(SuperDiffuse, double);
145
147 vtkGetMacro(SuperSpecular, double);
148
150 vtkGetMacro(SuperPower, double);
151
153 vtkGetMacro(SuperSelectedAmbient, double);
154
156 vtkGetMacro(SuperSelectedSpecular, double);
157
163 vtkSetMacro(SliceProjection, int);
164 vtkGetMacro(SliceProjection, int);
165
168 {
171 };
172
174 inline void SliceProjectionOn();
175
177 inline void SliceProjectionOff();
178
181 vtkSetVector3Macro(ProjectedColor, double);
182 vtkGetVector3Macro(ProjectedColor, double);
183
186 vtkSetMacro(ProjectedOpacity, double);
187 vtkGetMacro(ProjectedOpacity, double);
188
189 protected:
194
196
197 double SuperColor[3];
199
207
208
210 double ProjectedColor[3];
212};
213
214//----------------------------------------------------------------------------
215void vtkMRMLAnnotationDisplayNode
216::SliceProjectionOn()
217{
220}
221
222//----------------------------------------------------------------------------
223void vtkMRMLAnnotationDisplayNode
224::SliceProjectionOff()
225{
228}
229
230#endif
vtkSetAndPropagateMacro(SelectedAmbient, double)
vtkSetAndPropagateVector3Macro(Color, double)
vtkSetAndPropagateMacro(Specular, double)
static vtkMRMLAnnotationDisplayNode * New()
vtkSetAndPropagateMacro(Diffuse, double)
void ProcessMRMLEvents(vtkObject *, unsigned long, void *) override
Propagate events generated in mrml.
vtkSetAndPropagateMacro(Ambient, double)
vtkMRMLAnnotationDisplayNode * GetBackup()
Returns the associated backup of this node.
virtual int GetSliceProjection()
vtkSetAndPropagateVector3Macro(SelectedColor, double)
void WriteXML(ostream &of, int indent) override
~vtkMRMLAnnotationDisplayNode() override
vtkSetAndPropagateMacro(Opacity, double)
vtkSetAndPropagateMacro(SelectedSpecular, double)
vtkSetAndPropagateMacro(Power, double)
void PrintSelf(ostream &os, vtkIndent indent) override
void ReadXMLAttributes(const char **atts) override
void Copy(vtkMRMLNode *node) override
Copy node contents from another node of the same type. Does not copy node ID and Scene....
vtkMRMLAnnotationDisplayNode * m_Backup
vtkMRMLAnnotationDisplayNode(const vtkMRMLAnnotationDisplayNode &)
void UpdateScene(vtkMRMLScene *scene) override
virtual void SetSliceProjection(int)
virtual void CreateBackup()
Creates a backup of the current MRML state of this node and keeps a reference.
vtkMRMLNode * CreateNodeInstance() override
Create instance of the default node. Like New only virtual.
void operator=(const vtkMRMLModelDisplayNode &)
friend class vtkMRMLScene