Slicer  5.3
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 
21 // STD includes
22 #include <vector>
23 
24 class vtkAlgorithmOutput;
25 class vtkDataSet;
26 class vtkImageData;
27 class vtkMRMLColorNode;
29 class vtkPolyData;
30 class vtkTextProperty;
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,
58  PBRInterpolation
59  } InterpolationType;
60 
73  typedef enum {
74  UseManualScalarRange = 0,
79  // insert types above this line
80  NUM_SCALAR_RANGE_FLAGS
81  } ScalarRangeFlagType;
82 
84  typedef enum {
85  ShowDefault = 0,
87  ShowMode_Last
88  } ShowModeType;
89 
90  enum
91  {
92  MenuEvent = 16100,
94  };
95 
98  static const char* GetScalarRangeFlagTypeAsString(int flag);
100  static int GetScalarRangeFlagTypeFromString(const char* name);
101 
104  virtual vtkMRMLDisplayableNode* GetDisplayableNode();
105 
108  void ReadXMLAttributes( const char** atts) override;
109 
112  void WriteXML(ostream& of, int indent) override;
113 
117 
121  void ProcessMRMLEvents(vtkObject *caller, unsigned long event,
122  void *callData) override;
123 
125  void SetSceneReferences() override;
126 
129  void UpdateReferences() override;
130 
132  void UpdateScene(vtkMRMLScene *scene) override;
133 
135  void UpdateReferenceID(const char *oldID, const char *newID) override;
136 
139  vtkSetVector3Macro(Color, double);
142  vtkGetVector3Macro(Color, double);
143 
146  vtkSetVector3Macro(EdgeColor, double);
149  vtkGetVector3Macro(EdgeColor, double);
150 
153  vtkSetVector3Macro(SelectedColor, double);
156  vtkGetVector3Macro(SelectedColor, double);
157 
160  vtkSetMacro(SelectedAmbient, double);
163  vtkGetMacro(SelectedAmbient, double);
164 
167  vtkSetMacro(SelectedSpecular, double);
170  vtkGetMacro(SelectedSpecular, double);
171 
174  vtkSetMacro(PointSize, double);
177  vtkGetMacro(PointSize, double);
178 
181  vtkSetMacro(LineWidth, double);
184  vtkGetMacro(LineWidth, double);
185 
188  vtkSetMacro(Representation, int);
191  vtkGetMacro(Representation, int);
192 
195  vtkSetMacro(Opacity, double);
198  vtkGetMacro(Opacity, double);
199 
202  vtkSetMacro(SliceIntersectionOpacity, double);
205  vtkGetMacro(SliceIntersectionOpacity, double);
206 
209  vtkSetMacro(Ambient, double);
212  vtkGetMacro(Ambient, double);
213 
216  vtkSetMacro(Diffuse, double);
219  vtkGetMacro(Diffuse, double);
220 
223  vtkSetMacro(Specular, double);
226  vtkGetMacro(Specular, double);
227 
230  vtkSetMacro(Power, double);
233  vtkGetMacro(Power, double);
234 
236  vtkSetMacro(Metallic, double);
239  vtkGetMacro(Metallic, double);
241 
243  vtkSetMacro(Roughness, double);
246  vtkGetMacro(Roughness, double);
248 
251  vtkSetMacro(Visibility, int);
254  vtkGetMacro(Visibility, int);
257  vtkBooleanMacro(Visibility, int);
265  virtual bool GetVisibility(const char* viewNodeID);
266 
270  vtkSetMacro(Visibility2D, int);
274  vtkGetMacro(Visibility2D, int);
278  vtkBooleanMacro(Visibility2D, int);
279 
283  vtkSetMacro(Visibility3D, int);
287  vtkGetMacro(Visibility3D, int);
291  vtkBooleanMacro(Visibility3D, int);
292 
295  vtkSetMacro(EdgeVisibility, int);
296  vtkBooleanMacro(EdgeVisibility, int);
299  vtkGetMacro(EdgeVisibility, int);
300 
303  vtkSetMacro(Clipping, int);
306  vtkGetMacro(Clipping, int);
309  vtkBooleanMacro(Clipping, int);
310 
316  void SetSliceIntersectionVisibility(int on);
322  int GetSliceIntersectionVisibility();
328  void SliceIntersectionVisibilityOn();
334  void SliceIntersectionVisibilityOff();
335 
338  vtkSetMacro(SliceIntersectionThickness, int);
341  vtkGetMacro(SliceIntersectionThickness, int);
342 
351  vtkSetMacro(FrontfaceCulling, int);
352  vtkGetMacro(FrontfaceCulling, int);
353  vtkBooleanMacro(FrontfaceCulling, int);
354  vtkSetMacro(BackfaceCulling, int);
355  vtkGetMacro(BackfaceCulling, int);
356  vtkBooleanMacro(BackfaceCulling, int);
358 
362  vtkSetMacro(Lighting, int);
366  vtkGetMacro(Lighting, int);
369  vtkBooleanMacro(Lighting, int);
370 
373  vtkSetMacro(Interpolation, int);
376  vtkGetMacro(Interpolation, int);
377 
380  vtkSetMacro(Shading, int);
383  vtkGetMacro(Shading, int);
384 
388  vtkSetMacro(ScalarVisibility, int);
392  vtkGetMacro(ScalarVisibility, int);
395  vtkBooleanMacro(ScalarVisibility, int);
396 
400  vtkSetMacro(VectorVisibility, int);
404  vtkGetMacro(VectorVisibility, int);
407  vtkBooleanMacro(VectorVisibility, int);
408 
412  vtkSetMacro(TensorVisibility, int);
416  vtkGetMacro(TensorVisibility, int);
419  vtkBooleanMacro(TensorVisibility, int);
420 
425  void SetAutoScalarRange(int b);
430  int GetAutoScalarRange();
434  void AutoScalarRangeOn();
435  void AutoScalarRangeOff();
440  virtual void UpdateAssignedAttribute() {};
444  virtual void UpdateScalarRange();
445 
448  vtkSetVector2Macro(ScalarRange, double);
451  vtkGetVector2Macro(ScalarRange, double);
452 
456  virtual void SetScalarRangeFlag(int flag);
459  vtkGetMacro(ScalarRangeFlag, int);
462  const char* GetScalarRangeFlagAsString();
465  void SetScalarRangeFlagFromString(const char* str);
466 
469  vtkSetMacro(FolderDisplayOverrideAllowed, bool);
472  vtkGetMacro(FolderDisplayOverrideAllowed, bool);
475  vtkBooleanMacro(FolderDisplayOverrideAllowed, bool);
476 
478  vtkSetMacro(ShowMode, int);
487  vtkGetMacro(ShowMode, int);
488  bool IsShowModeDefault() { return this->GetShowMode() == vtkMRMLDisplayNode::ShowDefault; }
490 
492  static const char* GetShowModeAsString(int flag);
495  static int GetShowModeFromString(const char* name);
497 
500  virtual void SetTextureImageDataConnection(vtkAlgorithmOutput *ImageDataConnection);
503  vtkGetObjectMacro(TextureImageDataConnection, vtkAlgorithmOutput);
504 
508  vtkSetMacro(InterpolateTexture, int);
512  vtkGetMacro(InterpolateTexture, int);
515  vtkBooleanMacro(InterpolateTexture, int);
516 
519  virtual void SetAndObserveColorNodeID(const char *ColorNodeID);
523  void SetAndObserveColorNodeID(const std::string& ColorNodeID);
526  vtkGetStringMacro(ColorNodeID);
527 
531  virtual vtkMRMLColorNode* GetColorNode();
532 
535  vtkSetStringMacro(ActiveScalarName);
538  vtkGetStringMacro(ActiveScalarName);
539 
543  vtkSetMacro(ActiveAttributeLocation, int);
546  vtkGetMacro(ActiveAttributeLocation, int);
549  const char* GetActiveAttributeLocationAsString();
552  void SetActiveAttributeLocationFromString(const char* str);
557  virtual void SetActiveScalar(const char *scalarName, int location);
558 
561  virtual vtkDataSet* GetScalarDataSet() { return nullptr; };
564  virtual vtkDataArray* GetActiveScalarArray() { return nullptr; };
565 
568  void AddViewNodeID(const char* viewNodeID);
576  void RemoveViewNodeID(char* viewNodeID);
579  void RemoveAllViewNodeIDs();
583  inline int GetNumberOfViewNodeIDs()const;
587  const char* GetNthViewNodeID(unsigned int index);
591  inline std::vector< std::string > GetViewNodeIDs()const;
595  bool IsViewNodeIDPresent(const char* viewNodeID)const;
600  bool IsDisplayableInView(const char* viewNodeID)const;
605  void SetDisplayableOnlyInView(const char *viewNodeID);
609  void SetViewNodeIDs(const std::vector< std::string >& viewNodeIDs);
610 
612  static const char* GetAttributeLocationAsString(int id);
614  static int GetAttributeLocationFromString(const char* name);
615 
618  static std::string GetTextPropertyAsString(vtkTextProperty* property);
619 
622  static void UpdateTextPropertyFromString(std::string inputString, vtkTextProperty* property);
623 
624 protected:
626  ~vtkMRMLDisplayNode() override;
628  void operator=(const vtkMRMLDisplayNode&);
629 
634  virtual void SetColorNodeInternal(vtkMRMLColorNode* newColorNode);
635 
638  static void GetColorFromString(const std::string& colorString, double color[4]);
639 
645  vtkAlgorithmOutput *TextureImageDataConnection;
646 
654  char *ColorNodeID;
660 
675 
680  double Opacity;
690  double Ambient;
695  double Diffuse;
700  double Specular;
705  double Power;
710 
711  double Metallic;
712  double Roughness;
713 
720 
724  double PointSize;
725 
729  double LineWidth;
730 
735 
740  int Lighting;
741 
750 
755  int Shading;
756 
781  int Clipping;
828 
834  double ScalarRange[2];
835 
840  double Color[3];
846  double EdgeColor[3];
851  double SelectedColor[3];
852 
862  std::vector< std::string > ViewNodeIDs;
863 
870 
875 
877  int ShowMode;
878 
880  vtkWeakPointer<vtkMRMLDisplayableNode> LastFoundDisplayableNode;
881 private:
882  void SetColorNodeID(const char* id);
883 };
884 
885 //----------------------------------------------------------------------------
887 {
888  return static_cast<int>(this->ViewNodeIDs.size());
889 }
890 
891 //----------------------------------------------------------------------------
892 std::vector< std::string > vtkMRMLDisplayNode::GetViewNodeIDs()const
893 {
894  return this->ViewNodeIDs;
895 }
896 
897 #endif
int GetNumberOfViewNodeIDs() const
virtual vtkDataArray * GetActiveScalarArray()
vtkAlgorithmOutput * TextureImageDataConnection
vtkMRMLColorNode * ColorNode
std::vector< std::string > ViewNodeIDs
set visibility manually, useful for non-essential display nodes (e.g., color legend) ...
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.
set visibility of this node if user requests show of the displayable node
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:57
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