Slicer  4.8
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
vtkMRMLVolumePropertyNode.h
Go to the documentation of this file.
1 
6 #ifndef __vtkMRMLVolumePropertyNode_h
7 #define __vtkMRMLVolumePropertyNode_h
8 
9 // VolumeRendering includes
10 #include "vtkSlicerVolumeRenderingModuleMRMLExport.h"
11 
12 // MRML includes
13 #include "vtkMRMLStorableNode.h"
14 
15 // VTK includes
16 class vtkColorTransferFunction;
17 class vtkIntArray;
18 class vtkPiecewiseFunction;
19 class vtkVolumeProperty;
20 
21 // STD includes
22 #include <string>
23 #include <vector>
24 
25 #define COUNT_CROPPING_REGION_PLANES 6
26 
29 class VTK_SLICER_VOLUMERENDERING_MODULE_MRML_EXPORT vtkMRMLVolumePropertyNode
30  : public vtkMRMLStorableNode
31 {
32 public:
33  //--------------------------------------------------------------------------
35  //--------------------------------------------------------------------------
36 
38  static vtkMRMLVolumePropertyNode *New();
40  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
41 
44  vtkGetObjectMacro(VolumeProperty,vtkVolumeProperty);
45 
49  void SetScalarOpacity(vtkPiecewiseFunction* newScalarOpacity, int component = 0);\
53  vtkPiecewiseFunction* GetScalarOpacity(int component = 0);
54 
58  void SetGradientOpacity(vtkPiecewiseFunction* newGradientOpacity, int component = 0);
62  vtkPiecewiseFunction* GetGradientOpacity(int component = 0);
63 
67  void SetColor(vtkColorTransferFunction* newColorFunction, int component = 0);
71  vtkColorTransferFunction* GetColor(int component = 0);
72 
79  static std::string GetPiecewiseFunctionString(vtkPiecewiseFunction* function);
80 
87  static std::string GetColorTransferFunctionString(vtkColorTransferFunction* function);
88 
93  static void GetPiecewiseFunctionFromString(const std::string& str,
94  vtkPiecewiseFunction* result);
95 
100  static void GetColorTransferFunctionFromString(const std::string& str,
101  vtkColorTransferFunction* result);
102 
107  static inline void GetPiecewiseFunctionFromString(const char *str,
108  vtkPiecewiseFunction* result);
109 
115  static inline void GetColorTransferFunctionFromString(const char *str,
116  vtkColorTransferFunction* result);
117 
121  static double NextHigher(double value);
126  static double HigherAndUnique(double value, double & previousValue);
127 
128  //--------------------------------------------------------------------------
130  //--------------------------------------------------------------------------
131  virtual vtkMRMLNode* CreateNodeInstance() VTK_OVERRIDE;
132 
134  virtual void ReadXMLAttributes( const char** atts) VTK_OVERRIDE;
135 
137  virtual void WriteXML(ostream& of, int indent) VTK_OVERRIDE;
138 
140  virtual void Copy(vtkMRMLNode *node) VTK_OVERRIDE;
141 
144  void CopyParameterSet(vtkMRMLNode *node);
145 
147  virtual const char* GetNodeTagName() VTK_OVERRIDE {return "VolumeProperty";}
148 
150  virtual void ProcessMRMLEvents ( vtkObject *caller, unsigned long event, void *callData) VTK_OVERRIDE;
151 
153  virtual vtkMRMLStorageNode* CreateDefaultStorageNode() VTK_OVERRIDE;
154 
156  virtual bool GetModifiedSinceRead() VTK_OVERRIDE;
157 
158 protected:
161 
162  static int NodesFromString(const std::string& dataString, double* &data, int nodeSize);
163  static int DataFromString(const std::string& dataString, double* &data);
164  static std::string DataToString(double* data, int size);
165 
167  vtkIntArray* ObservedEvents;
168 
170  vtkVolumeProperty* VolumeProperty;
171 
172 private:
174  vtkMRMLVolumePropertyNode(const vtkMRMLVolumePropertyNode&);//Not implemented
176 
177 };
178 
179 //---------------------------------------------------------------------------
182  vtkPiecewiseFunction* result)
183 {
185  std::string(str), result);
186 }
187 
188 //---------------------------------------------------------------------------
191  vtkColorTransferFunction* result)
192 {
194  std::string (str), result);
195 }
196 
197 #endif
virtual vtkMRMLStorageNode * CreateDefaultStorageNode()
virtual bool GetModifiedSinceRead()
virtual void ProcessMRMLEvents(vtkObject *, unsigned long, void *) VTK_OVERRIDE
alternative method to propagate events generated in Storage nodes
vtkVolumeProperty * VolumeProperty
Main parameters for visualization.
virtual vtkMRMLNode * CreateNodeInstance() VTK_OVERRIDE=0
MRMLNode methods.
MRML node to represent a 3D surface model.
vtkIntArray * ObservedEvents
Events observed on the transfer functions.
A supercalss for other storage nodes.
static void GetPiecewiseFunctionFromString(const std::string &str, vtkPiecewiseFunction *result)
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
static void GetColorTransferFunctionFromString(const std::string &str, vtkColorTransferFunction *result)
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
void operator=(const vtkMRMLStorableNode &)
vtkMRMLVolumePropertyNode contains the transfer functions (scalar opacity, color and gradient opacity...