Slicer 5.9
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) \
19 virtual 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 }; \
47 virtual void SetAndPropagateSuper##name(type _arg[3]) \
48 { \
49 this->SetAndPropagateSuper##name(_arg[0], _arg[1], _arg[2]); \
50 }
51
52#define vtkSetAndPropagateMacro(name, type) \
53 virtual 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
78class VTK_SLICER_ANNOTATIONS_MODULE_MRML_EXPORT vtkMRMLAnnotationDisplayNode : public vtkMRMLModelDisplayNode
79{
80public:
83 void PrintSelf(ostream& os, vtkIndent indent) override;
84
85 //--------------------------------------------------------------------------
86 // MRMLNode methods
87 //--------------------------------------------------------------------------
88
90
91 // Description:
92 // Read node attributes from XML (MRML) file
93 void ReadXMLAttributes(const char** atts) override;
94
95 // Description:
96 // Write this node's information to a MRML file in XML format.
97 void WriteXML(ostream& of, int indent) override;
98
99 // Description:
100 // Copy the node's attributes to this object
101 void Copy(vtkMRMLNode* node) override;
102
103 // Description:
104 // Get node XML tag name (like Volume, Annotation)
105 const char* GetNodeTagName() override { return "AnnotationDisplay"; }
106
107 // Description:
108 // Finds the storage node and read the data
109 void UpdateScene(vtkMRMLScene* scene) override;
110
111 // Description:
112 // alternative method to propagate events generated in Display nodes
113 void ProcessMRMLEvents(vtkObject* /*caller*/, unsigned long /*event*/, void* /*callData*/) override;
114
115 // Functionality for backups of this node
117 virtual void CreateBackup() {};
118 virtual void RestoreBackup() {};
122
123 //
124 // Set and propagate attributes to all other displayNodes
125 //
126
128 vtkGetVector3Macro(SuperColor, double);
129
131 vtkGetVector3Macro(SuperSelectedColor, double);
132
134 vtkGetMacro(SuperOpacity, double);
135
137 vtkGetMacro(SuperAmbient, double);
138
140 vtkGetMacro(SuperDiffuse, double);
141
143 vtkGetMacro(SuperSpecular, double);
144
146 vtkGetMacro(SuperPower, double);
147
149 vtkGetMacro(SuperSelectedAmbient, double);
150
152 vtkGetMacro(SuperSelectedSpecular, double);
153
159 vtkSetMacro(SliceProjection, int);
160 vtkGetMacro(SliceProjection, int);
161
164 {
167 };
168
170 inline void SliceProjectionOn();
171
173 inline void SliceProjectionOff();
174
177 vtkSetVector3Macro(ProjectedColor, double);
178 vtkGetVector3Macro(ProjectedColor, double);
179
182 vtkSetMacro(ProjectedOpacity, double);
183 vtkGetMacro(ProjectedOpacity, double);
184
185protected:
190
192
193 double SuperColor[3];
195
203
205 double ProjectedColor[3];
207};
208
209//----------------------------------------------------------------------------
214
215//----------------------------------------------------------------------------
220
221#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
void SliceProjectionOff()
Set SliceProjection to Off.
vtkSetAndPropagateMacro(Opacity, double)
vtkSetAndPropagateMacro(SelectedSpecular, double)
vtkSetAndPropagateMacro(Power, double)
void PrintSelf(ostream &os, vtkIndent indent) override
void SliceProjectionOn()
Set SliceProjection to On.
void ReadXMLAttributes(const char **atts) override
void operator=(const vtkMRMLAnnotationDisplayNode &)
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.
friend class vtkMRMLScene