Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
vtkMRMLDisplayNode.h
Go to the documentation of this file.
1 /*=auto=========================================================================
2 
3  Portions (c) Copyright 2005 Brigham and Women's Hospital (BWH) All Rights Reserved.
4 
5  See COPYRIGHT.txt
6  or http://www.slicer.org/copyright/copyright.txt for details.
7 
8  Program: 3D Slicer
9  Module: $RCSfile: vtkMRMLDisplayNode.h,v $
10  Date: $Date: 2006/03/19 17:12:29 $
11  Version: $Revision: 1.3 $
12 
13 =========================================================================auto=*/
14 
15 #ifndef __vtkMRMLDisplayNode_h
16 #define __vtkMRMLDisplayNode_h
17 
18 // MRML includes
19 #include "vtkMRMLNode.h"
20 class vtkMRMLColorNode;
22 
23 // VTK includes
24 class vtkAlgorithmOutput;
25 class vtkImageData;
26 class vtkPolyData;
27 
28 // STD includes
29 #include <vector>
30 
37 class VTK_MRML_EXPORT vtkMRMLDisplayNode : public vtkMRMLNode
38 {
39 public:
41  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
42 
45  typedef enum {
46  PointsRepresentation = 0,
48  SurfaceRepresentation
49  } RepresentationType;
50 
53  typedef enum {
54  FlatInterpolation = 0,
56  PhongInterpolation
57  } InterpolationType;
58 
71  typedef enum {
72  UseManualScalarRange = 0,
77  // insert types above this line
78  NUM_SCALAR_RANGE_FLAGS
79  } ScalarRangeFlagType;
80 
83  static const char* GetScalarRangeFlagTypeAsString(int flag);
84 
86  static int GetScalarRangeFlagTypeFromString(const char* name);
87 
90  virtual vtkMRMLDisplayableNode* GetDisplayableNode();
91 
94  virtual void ReadXMLAttributes( const char** atts) VTK_OVERRIDE;
95 
98  virtual void WriteXML(ostream& of, int indent) VTK_OVERRIDE;
99 
101  virtual void Copy(vtkMRMLNode *node) VTK_OVERRIDE;
102 
106  virtual void ProcessMRMLEvents(vtkObject *caller, unsigned long event,
107  void *callData) VTK_OVERRIDE;
108 
110  virtual void SetSceneReferences() VTK_OVERRIDE;
111 
114  virtual void UpdateReferences() VTK_OVERRIDE;
115 
117  virtual void UpdateScene(vtkMRMLScene *scene) VTK_OVERRIDE;
118 
120  virtual void UpdateReferenceID(const char *oldID, const char *newID) VTK_OVERRIDE;
121 
124  vtkSetVector3Macro(Color, double);
127  vtkGetVector3Macro(Color, double);
128 
131  vtkSetVector3Macro(EdgeColor, double);
134  vtkGetVector3Macro(EdgeColor, double);
135 
138  vtkSetVector3Macro(SelectedColor, double);
141  vtkGetVector3Macro(SelectedColor, double);
142 
145  vtkSetMacro(SelectedAmbient, double);
148  vtkGetMacro(SelectedAmbient, double);
149 
152  vtkSetMacro(SelectedSpecular, double);
155  vtkGetMacro(SelectedSpecular, double);
156 
159  vtkSetMacro(PointSize, double);
162  vtkGetMacro(PointSize, double);
163 
166  vtkSetMacro(LineWidth, double);
169  vtkGetMacro(LineWidth, double);
170 
173  vtkSetMacro(Representation, int);
176  vtkGetMacro(Representation, int);
177 
180  vtkSetMacro(Opacity, double);
183  vtkGetMacro(Opacity, double);
184 
187  vtkSetMacro(SliceIntersectionOpacity, double);
190  vtkGetMacro(SliceIntersectionOpacity, double);
191 
194  vtkSetMacro(Ambient, double);
197  vtkGetMacro(Ambient, double);
198 
201  vtkSetMacro(Diffuse, double);
204  vtkGetMacro(Diffuse, double);
205 
208  vtkSetMacro(Specular, double);
211  vtkGetMacro(Specular, double);
212 
215  vtkSetMacro(Power, double);
218  vtkGetMacro(Power, double);
219 
222  vtkSetMacro(Visibility, int);
225  vtkGetMacro(Visibility, int);
228  vtkBooleanMacro(Visibility, int);
234  virtual bool GetVisibility(const char* viewNodeID);
235 
238  vtkSetMacro(EdgeVisibility, int);
239  vtkBooleanMacro(EdgeVisibility, int);
242  vtkGetMacro(EdgeVisibility, int);
243 
246  vtkSetMacro(Clipping, int);
249  vtkGetMacro(Clipping, int);
252  vtkBooleanMacro(Clipping, int);
253 
257  vtkSetMacro(SliceIntersectionVisibility, int);
261  vtkGetMacro(SliceIntersectionVisibility, int);
265  vtkBooleanMacro(SliceIntersectionVisibility, int);
266 
269  vtkSetMacro(SliceIntersectionThickness, int);
272  vtkGetMacro(SliceIntersectionThickness, int);
273 
277  vtkSetMacro(FrontfaceCulling, int);
281  vtkGetMacro(FrontfaceCulling, int);
284  vtkBooleanMacro(FrontfaceCulling, int);
288  vtkSetMacro(BackfaceCulling, int);
292  vtkGetMacro(BackfaceCulling, int);
295  vtkBooleanMacro(BackfaceCulling, int);
296 
300  vtkSetMacro(Lighting, int);
304  vtkGetMacro(Lighting, int);
307  vtkBooleanMacro(Lighting, int);
308 
311  vtkSetMacro(Interpolation, int);
314  vtkGetMacro(Interpolation, int);
315 
318  vtkSetMacro(Shading, int);
321  vtkGetMacro(Shading, int);
322 
326  vtkSetMacro(ScalarVisibility, int);
330  vtkGetMacro(ScalarVisibility, int);
333  vtkBooleanMacro(ScalarVisibility, int);
334 
338  vtkSetMacro(VectorVisibility, int);
342  vtkGetMacro(VectorVisibility, int);
345  vtkBooleanMacro(VectorVisibility, int);
346 
350  vtkSetMacro(TensorVisibility, int);
354  vtkGetMacro(TensorVisibility, int);
357  vtkBooleanMacro(TensorVisibility, int);
358 
363  void SetAutoScalarRange(int b);
368  int GetAutoScalarRange();
372  void AutoScalarRangeOn();
373  void AutoScalarRangeOff();
374 
377  vtkSetVector2Macro(ScalarRange, double);
380  vtkGetVector2Macro(ScalarRange, double);
381 
384  vtkSetMacro(ScalarRangeFlag, int);
387  vtkGetMacro(ScalarRangeFlag, int);
388 
391  virtual void SetTextureImageDataConnection(vtkAlgorithmOutput *ImageDataConnection);
394  vtkGetObjectMacro(TextureImageDataConnection, vtkAlgorithmOutput);
395 
399  vtkSetMacro(InterpolateTexture, int);
403  vtkGetMacro(InterpolateTexture, int);
406  vtkBooleanMacro(InterpolateTexture, int);
407 
410  virtual void SetAndObserveColorNodeID(const char *ColorNodeID);
414  void SetAndObserveColorNodeID(const std::string& ColorNodeID);
417  vtkGetStringMacro(ColorNodeID);
418 
422  virtual vtkMRMLColorNode* GetColorNode();
423 
426  vtkSetStringMacro(ActiveScalarName);
429  vtkGetStringMacro(ActiveScalarName);
430 
434  vtkSetMacro(ActiveAttributeLocation, int);
437  vtkGetMacro(ActiveAttributeLocation, int);
438 
441  void AddViewNodeID(const char* viewNodeID);
444  void RemoveViewNodeID(char* viewNodeID);
447  void RemoveAllViewNodeIDs();
451  inline int GetNumberOfViewNodeIDs()const;
455  const char* GetNthViewNodeID(unsigned int index);
459  inline std::vector< std::string > GetViewNodeIDs()const;
463  bool IsViewNodeIDPresent(const char* viewNodeID)const;
468  bool IsDisplayableInView(const char* viewNodeID)const;
473  void SetDisplayableOnlyInView(const char *viewNodeID);
477  void SetViewNodeIDs(const std::vector< std::string >& viewNodeIDs);
478 
480  static const char* GetAttributeLocationAsString(int id);
481 
483  static int GetAttributeLocationFromString(const char* name);
484 
485 protected:
489  void operator=(const vtkMRMLDisplayNode&);
490 
495  virtual void SetColorNodeInternal(vtkMRMLColorNode* newColorNode);
496 
502  vtkAlgorithmOutput *TextureImageDataConnection;
503 
511  char *ColorNodeID;
516  vtkMRMLColorNode *ColorNode;
517 
525  char *ActiveScalarName;
531  int ActiveAttributeLocation;
532 
537  double Opacity;
542  double SliceIntersectionOpacity;
547  double Ambient;
552  double Diffuse;
557  double Specular;
562  double Power;
567  double SelectedAmbient;
572  double SelectedSpecular;
573 
577  double PointSize;
578 
582  double LineWidth;
583 
587  int Representation;
588 
593  int Lighting;
594 
602  int Interpolation;
603 
608  int Shading;
609 
614  int Visibility;
621  int EdgeVisibility;
626  int Clipping;
633  int SliceIntersectionVisibility;
640  int SliceIntersectionThickness;
646  int FrontfaceCulling;
652  int BackfaceCulling;
659  int ScalarVisibility;
666  int VectorVisibility;
673  int TensorVisibility;
679  int InterpolateTexture;
680 
686  double ScalarRange[2];
687 
692  double Color[3];
698  double EdgeColor[3];
703  double SelectedColor[3];
704 
714  std::vector< std::string > ViewNodeIDs;
715 
721  int ScalarRangeFlag;
722 
724  vtkWeakPointer<vtkMRMLDisplayableNode> LastFoundDisplayableNode;
725 private:
726  void SetColorNodeID(const char* id);
727 };
728 
729 //----------------------------------------------------------------------------
730 int vtkMRMLDisplayNode::GetNumberOfViewNodeIDs()const
731 {
732  return static_cast<int>(this->ViewNodeIDs.size());
733 }
734 
735 //----------------------------------------------------------------------------
736 std::vector< std::string > vtkMRMLDisplayNode::GetViewNodeIDs()const
737 {
738  return this->ViewNodeIDs;
739 }
740 
741 #endif
LRU Cache.
virtual void ReadXMLAttributes(const char **atts)
virtual void ProcessMRMLEvents(vtkObject *caller, unsigned long event, void *callData)
Propagate events generated in mrml.
std::vector< std::string > GetViewNodeIDs() const
virtual void SetSceneReferences()
Update the references of the node to the scene.
virtual void Copy(vtkMRMLNode *node)
Copy parameters (not including ID and Scene) from another node of the same type.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
Abstract MRML node to represent color information.
virtual void WriteXML(ostream &of, int indent)
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
Abstract class that contains graphical display properties for displayable nodes.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:138