Slicer  4.11
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
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 vtkDataSet;
26 class vtkImageData;
27 class vtkPolyData;
28 
29 // STD includes
30 #include <vector>
31 
38 class VTK_MRML_EXPORT vtkMRMLDisplayNode : public vtkMRMLNode
39 {
40 public:
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
46  typedef enum {
47  PointsRepresentation = 0,
49  SurfaceRepresentation
50  } RepresentationType;
51 
54  typedef enum {
55  FlatInterpolation = 0,
57  PhongInterpolation
58  } InterpolationType;
59 
72  typedef enum {
73  UseManualScalarRange = 0,
78  // insert types above this line
79  NUM_SCALAR_RANGE_FLAGS
80  } ScalarRangeFlagType;
81 
82  enum
83  {
84  MenuEvent = 16100,
86  };
87 
90  static const char* GetScalarRangeFlagTypeAsString(int flag);
92  static int GetScalarRangeFlagTypeFromString(const char* name);
93 
96  virtual vtkMRMLDisplayableNode* GetDisplayableNode();
97 
100  void ReadXMLAttributes( const char** atts) override;
101 
104  void WriteXML(ostream& of, int indent) override;
105 
109 
113  void ProcessMRMLEvents(vtkObject *caller, unsigned long event,
114  void *callData) override;
115 
117  void SetSceneReferences() override;
118 
121  void UpdateReferences() override;
122 
124  void UpdateScene(vtkMRMLScene *scene) override;
125 
127  void UpdateReferenceID(const char *oldID, const char *newID) override;
128 
131  vtkSetVector3Macro(Color, double);
134  vtkGetVector3Macro(Color, double);
135 
138  vtkSetVector3Macro(EdgeColor, double);
141  vtkGetVector3Macro(EdgeColor, double);
142 
145  vtkSetVector3Macro(SelectedColor, double);
148  vtkGetVector3Macro(SelectedColor, double);
149 
152  vtkSetMacro(SelectedAmbient, double);
155  vtkGetMacro(SelectedAmbient, double);
156 
159  vtkSetMacro(SelectedSpecular, double);
162  vtkGetMacro(SelectedSpecular, double);
163 
166  vtkSetMacro(PointSize, double);
169  vtkGetMacro(PointSize, double);
170 
173  vtkSetMacro(LineWidth, double);
176  vtkGetMacro(LineWidth, double);
177 
180  vtkSetMacro(Representation, int);
183  vtkGetMacro(Representation, int);
184 
187  vtkSetMacro(Opacity, double);
190  vtkGetMacro(Opacity, double);
191 
194  vtkSetMacro(SliceIntersectionOpacity, double);
197  vtkGetMacro(SliceIntersectionOpacity, double);
198 
201  vtkSetMacro(Ambient, double);
204  vtkGetMacro(Ambient, double);
205 
208  vtkSetMacro(Diffuse, double);
211  vtkGetMacro(Diffuse, double);
212 
215  vtkSetMacro(Specular, double);
218  vtkGetMacro(Specular, double);
219 
222  vtkSetMacro(Power, double);
225  vtkGetMacro(Power, double);
226 
229  vtkSetMacro(Visibility, int);
232  vtkGetMacro(Visibility, int);
235  vtkBooleanMacro(Visibility, int);
241  virtual bool GetVisibility(const char* viewNodeID);
242 
246  vtkSetMacro(Visibility2D, int);
250  vtkGetMacro(Visibility2D, int);
254  vtkBooleanMacro(Visibility2D, int);
255 
259  vtkSetMacro(Visibility3D, int);
263  vtkGetMacro(Visibility3D, int);
267  vtkBooleanMacro(Visibility3D, int);
268 
271  vtkSetMacro(EdgeVisibility, int);
272  vtkBooleanMacro(EdgeVisibility, int);
275  vtkGetMacro(EdgeVisibility, int);
276 
279  vtkSetMacro(Clipping, int);
282  vtkGetMacro(Clipping, int);
285  vtkBooleanMacro(Clipping, int);
286 
292  void SetSliceIntersectionVisibility(int on);
298  int GetSliceIntersectionVisibility();
304  void SliceIntersectionVisibilityOn();
310  void SliceIntersectionVisibilityOff();
311 
314  vtkSetMacro(SliceIntersectionThickness, int);
317  vtkGetMacro(SliceIntersectionThickness, int);
318 
327  vtkSetMacro(FrontfaceCulling, int);
328  vtkGetMacro(FrontfaceCulling, int);
329  vtkBooleanMacro(FrontfaceCulling, int);
330  vtkSetMacro(BackfaceCulling, int);
331  vtkGetMacro(BackfaceCulling, int);
332  vtkBooleanMacro(BackfaceCulling, int);
334 
338  vtkSetMacro(Lighting, int);
342  vtkGetMacro(Lighting, int);
345  vtkBooleanMacro(Lighting, int);
346 
349  vtkSetMacro(Interpolation, int);
352  vtkGetMacro(Interpolation, int);
353 
356  vtkSetMacro(Shading, int);
359  vtkGetMacro(Shading, int);
360 
364  vtkSetMacro(ScalarVisibility, int);
368  vtkGetMacro(ScalarVisibility, int);
371  vtkBooleanMacro(ScalarVisibility, int);
372 
376  vtkSetMacro(VectorVisibility, int);
380  vtkGetMacro(VectorVisibility, int);
383  vtkBooleanMacro(VectorVisibility, int);
384 
388  vtkSetMacro(TensorVisibility, int);
392  vtkGetMacro(TensorVisibility, int);
395  vtkBooleanMacro(TensorVisibility, int);
396 
401  void SetAutoScalarRange(int b);
406  int GetAutoScalarRange();
410  void AutoScalarRangeOn();
411  void AutoScalarRangeOff();
416  virtual void UpdateAssignedAttribute() {};
420  virtual void UpdateScalarRange();
421 
424  vtkSetVector2Macro(ScalarRange, double);
427  vtkGetVector2Macro(ScalarRange, double);
428 
432  virtual void SetScalarRangeFlag(int flag);
435  vtkGetMacro(ScalarRangeFlag, int);
438  const char* GetScalarRangeFlagAsString();
441  void SetScalarRangeFlagFromString(const char* str);
442 
445  vtkSetMacro(FolderDisplayOverrideAllowed, bool);
448  vtkGetMacro(FolderDisplayOverrideAllowed, bool);
451  vtkBooleanMacro(FolderDisplayOverrideAllowed, bool);
452 
455  virtual void SetTextureImageDataConnection(vtkAlgorithmOutput *ImageDataConnection);
458  vtkGetObjectMacro(TextureImageDataConnection, vtkAlgorithmOutput);
459 
463  vtkSetMacro(InterpolateTexture, int);
467  vtkGetMacro(InterpolateTexture, int);
470  vtkBooleanMacro(InterpolateTexture, int);
471 
474  virtual void SetAndObserveColorNodeID(const char *ColorNodeID);
478  void SetAndObserveColorNodeID(const std::string& ColorNodeID);
481  vtkGetStringMacro(ColorNodeID);
482 
486  virtual vtkMRMLColorNode* GetColorNode();
487 
490  vtkSetStringMacro(ActiveScalarName);
493  vtkGetStringMacro(ActiveScalarName);
494 
498  vtkSetMacro(ActiveAttributeLocation, int);
501  vtkGetMacro(ActiveAttributeLocation, int);
504  const char* GetActiveAttributeLocationAsString();
507  void SetActiveAttributeLocationFromString(const char* str);
512  virtual void SetActiveScalar(const char *scalarName, int location);
513 
516  virtual vtkDataSet* GetScalarDataSet() { return nullptr; };
519  virtual vtkDataArray* GetActiveScalarArray() { return nullptr; };
520 
523  void AddViewNodeID(const char* viewNodeID);
531  void RemoveViewNodeID(char* viewNodeID);
534  void RemoveAllViewNodeIDs();
538  inline int GetNumberOfViewNodeIDs()const;
542  const char* GetNthViewNodeID(unsigned int index);
546  inline std::vector< std::string > GetViewNodeIDs()const;
550  bool IsViewNodeIDPresent(const char* viewNodeID)const;
555  bool IsDisplayableInView(const char* viewNodeID)const;
560  void SetDisplayableOnlyInView(const char *viewNodeID);
564  void SetViewNodeIDs(const std::vector< std::string >& viewNodeIDs);
565 
567  static const char* GetAttributeLocationAsString(int id);
569  static int GetAttributeLocationFromString(const char* name);
570 
571 protected:
573  ~vtkMRMLDisplayNode() override;
575  void operator=(const vtkMRMLDisplayNode&);
576 
581  virtual void SetColorNodeInternal(vtkMRMLColorNode* newColorNode);
582 
588  vtkAlgorithmOutput *TextureImageDataConnection;
589 
597  char *ColorNodeID;
603 
618 
623  double Opacity;
633  double Ambient;
638  double Diffuse;
643  double Specular;
648  double Power;
659 
663  double PointSize;
664 
668  double LineWidth;
669 
674 
679  int Lighting;
680 
689 
694  int Shading;
695 
720  int Clipping;
767 
773  double ScalarRange[2];
774 
779  double Color[3];
785  double EdgeColor[3];
790  double SelectedColor[3];
791 
801  std::vector< std::string > ViewNodeIDs;
802 
809 
814 
816  vtkWeakPointer<vtkMRMLDisplayableNode> LastFoundDisplayableNode;
817 private:
818  void SetColorNodeID(const char* id);
819 };
820 
821 //----------------------------------------------------------------------------
823 {
824  return static_cast<int>(this->ViewNodeIDs.size());
825 }
826 
827 //----------------------------------------------------------------------------
828 std::vector< std::string > vtkMRMLDisplayNode::GetViewNodeIDs()const
829 {
830  return this->ViewNodeIDs;
831 }
832 
833 #endif
int GetNumberOfViewNodeIDs() const
virtual vtkDataArray * GetActiveScalarArray()
vtkAlgorithmOutput * TextureImageDataConnection
vtkMRMLColorNode * ColorNode
std::vector< std::string > ViewNodeIDs
virtual void UpdateReferences()
The method should remove all pointers and observations to all nodes that are not in the scene anymore...
virtual void ReadXMLAttributes(const char **atts)
void operator=(const vtkMRMLNode &)
virtual void UpdateReferenceID(const char *oldID, const char *newID)
Update the stored reference to another node in the scene.
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.
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:61
vtkWeakPointer< vtkMRMLDisplayableNode > LastFoundDisplayableNode
Cached value of last found displayable node (it is expensive to determine it)
virtual vtkDataSet * GetScalarDataSet()
Abstract MRML node to represent color information.
virtual void WriteXML(ostream &of, int indent)
void PrintSelf(ostream &os, vtkIndent indent) override
#define vtkMRMLCopyContentMacro(thisClassName)
Definition: vtkMRMLNode.h:142
Abstract class that contains graphical display properties for displayable nodes.
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:167
virtual void UpdateAssignedAttribute()
virtual void UpdateScene(vtkMRMLScene *)
Definition: vtkMRMLNode.h:206