Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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"
14 #include "vtkMRMLDisplayableNode.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 
78 
80 class VTK_SLICER_ANNOTATIONS_MODULE_MRML_EXPORT vtkMRMLAnnotationDisplayNode : public vtkMRMLModelDisplayNode
81 {
82  public:
85  void PrintSelf ( ostream& os, vtkIndent indent ) VTK_OVERRIDE;
86 
87  //--------------------------------------------------------------------------
88  // MRMLNode methods
89  //--------------------------------------------------------------------------
90 
91  virtual vtkMRMLNode* CreateNodeInstance () VTK_OVERRIDE;
92 
93  // Description:
94  // Read node attributes from XML (MRML) file
95  virtual void ReadXMLAttributes ( const char** atts ) VTK_OVERRIDE;
96 
97  // Description:
98  // Write this node's information to a MRML file in XML format.
99  virtual void WriteXML ( ostream& of, int indent ) VTK_OVERRIDE;
100 
101 
102  // Description:
103  // Copy the node's attributes to this object
104  virtual void Copy ( vtkMRMLNode *node ) VTK_OVERRIDE;
105 
106  // Description:
107  // Get node XML tag name (like Volume, Annotation)
108  virtual const char* GetNodeTagName() VTK_OVERRIDE {return "AnnotationDisplay";}
109 
110  // Description:
111  // Finds the storage node and read the data
112  virtual void UpdateScene(vtkMRMLScene *scene) VTK_OVERRIDE;
113 
114  // Description:
115  // alternative method to propagate events generated in Display nodes
116  virtual void ProcessMRMLEvents ( vtkObject * /*caller*/,
117  unsigned long /*event*/,
118  void * /*callData*/ ) VTK_OVERRIDE;
119 
120  // Functionality for backups of this node
122  virtual void CreateBackup(){};
123  virtual void RestoreBackup(){};
124  void ClearBackup();
126  vtkMRMLAnnotationDisplayNode * GetBackup();
127 
128  //
129  // Set and propagate attributes to all other displayNodes
130  //
131 
132  vtkSetAndPropagateVector3Macro(Color, double);
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 
150  vtkSetAndPropagateMacro(Power, double);
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:
195 
197 
198  double SuperColor[3];
199  double SuperSelectedColor[3];
200 
201  double SuperOpacity;
202  double SuperAmbient;
203  double SuperDiffuse;
205  double SuperPower;
208 
209 
211  double ProjectedColor[3];
213 };
214 
215 //----------------------------------------------------------------------------
218 {
219  this->SetSliceProjection( this->GetSliceProjection() |
221 }
222 
223 //----------------------------------------------------------------------------
226 {
227  this->SetSliceProjection( this->GetSliceProjection() &
229 }
230 
231 #endif
static vtkMRMLModelDisplayNode * New()
MRML node to represent a display property of 3D surface model.
void SliceProjectionOn()
Set SliceProjection to On.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
virtual void CreateBackup()
Creates a backup of the current MRML state of this node and keeps a reference.
vtkMRMLAnnotationDisplayNode * m_Backup
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
virtual void ProcessMRMLEvents(vtkObject *caller, unsigned long event, void *callData) VTK_OVERRIDE
#define vtkSetAndPropagateVector3Macro(name, type)
void SliceProjectionOff()
Set SliceProjection to Off.
virtual vtkMRMLNode * CreateNodeInstance() VTK_OVERRIDE
Create instance of the default node. Like New only virtual.
void operator=(const vtkMRMLModelDisplayNode &)
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:138
virtual void UpdateScene(vtkMRMLScene *scene) VTK_OVERRIDE
Finds the storage node and read the data.
#define vtkSetAndPropagateMacro(name, type)