Slicer 5.4
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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
80class VTK_SLICER_ANNOTATIONS_MODULE_MRML_EXPORT vtkMRMLAnnotationDisplayNode : public vtkMRMLModelDisplayNode
81{
82 public:
85 void PrintSelf ( ostream& os, vtkIndent indent ) override;
86
87 //--------------------------------------------------------------------------
88 // MRMLNode methods
89 //--------------------------------------------------------------------------
90
92
93 // Description:
94 // Read node attributes from XML (MRML) file
95 void ReadXMLAttributes ( const char** atts ) override;
96
97 // Description:
98 // Write this node's information to a MRML file in XML format.
99 void WriteXML ( ostream& of, int indent ) override;
100
101
102 // Description:
103 // Copy the node's attributes to this object
104 void Copy ( vtkMRMLNode *node ) override;
105
106 // Description:
107 // Get node XML tag name (like Volume, Annotation)
108 const char* GetNodeTagName() override {return "AnnotationDisplay";}
109
110 // Description:
111 // Finds the storage node and read the data
112 void UpdateScene(vtkMRMLScene *scene) override;
113
114 // Description:
115 // alternative method to propagate events generated in Display nodes
116 void ProcessMRMLEvents ( vtkObject * /*caller*/,
117 unsigned long /*event*/,
118 void * /*callData*/ ) override;
119
120 // Functionality for backups of this node
122 virtual void CreateBackup(){};
123 virtual void RestoreBackup(){};
127
128 //
129 // Set and propagate attributes to all other displayNodes
130 //
131
133 vtkGetVector3Macro(SuperColor, double);
134
135 vtkSetAndPropagateVector3Macro(SelectedColor, double);
136 vtkGetVector3Macro(SuperSelectedColor, double);
137
138 vtkSetAndPropagateMacro(Opacity, double);
139 vtkGetMacro(SuperOpacity, double);
140
141 vtkSetAndPropagateMacro(Ambient, double);
142 vtkGetMacro(SuperAmbient, double);
143
144 vtkSetAndPropagateMacro(Diffuse, double);
145 vtkGetMacro(SuperDiffuse, double);
146
147 vtkSetAndPropagateMacro(Specular, double);
148 vtkGetMacro(SuperSpecular, double);
149
151 vtkGetMacro(SuperPower, double);
152
153 vtkSetAndPropagateMacro(SelectedAmbient, double);
154 vtkGetMacro(SuperSelectedAmbient, double);
155
156 vtkSetAndPropagateMacro(SelectedSpecular, double);
157 vtkGetMacro(SuperSelectedSpecular, double);
158
164 vtkSetMacro(SliceProjection, int);
165 vtkGetMacro(SliceProjection, int);
166
169 {
170 ProjectionOff = 0x00,
171 ProjectionOn = 0x01
172 };
173
175 inline void SliceProjectionOn();
176
178 inline void SliceProjectionOff();
179
182 vtkSetVector3Macro(ProjectedColor, double);
183 vtkGetVector3Macro(ProjectedColor, double);
184
187 vtkSetMacro(ProjectedOpacity, double);
188 vtkGetMacro(ProjectedOpacity, double);
189
190 protected:
194 void operator= ( const vtkMRMLAnnotationDisplayNode& );
195
197
198 double SuperColor[3];
199 double SuperSelectedColor[3];
200
208
209
211 double ProjectedColor[3];
213};
214
215//----------------------------------------------------------------------------
216void vtkMRMLAnnotationDisplayNode
217::SliceProjectionOn()
218{
219 this->SetSliceProjection( this->GetSliceProjection() |
221}
222
223//----------------------------------------------------------------------------
224void vtkMRMLAnnotationDisplayNode
225::SliceProjectionOff()
226{
227 this->SetSliceProjection( this->GetSliceProjection() &
229}
230
231#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.
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 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.
MRML node to represent a display property of 3D surface model.
Abstract Superclass for all specific types of MRML nodes.
A set of MRML Nodes that supports serialization and undo/redo.