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
vtkSlicerVolumeRenderingLogic.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: vtkSlicerVolumeRenderingLogic.h,v $
10  Date: $Date: 2006/01/08 04:48:05 $
11  Version: $Revision: 1.45 $
12 
13 =========================================================================auto=*/
14 
15 #ifndef __vtkSlicerVolumeRenderingLogic_h
16 #define __vtkSlicerVolumeRenderingLogic_h
17 
18 // VolumeRendering includes
19 #include "vtkSlicerVolumeRenderingModuleLogicExport.h"
22 
23 // Slicer includes
24 #include "vtkSlicerModuleLogic.h"
25 
26 // MRML includes
29 class vtkMRMLNode;
32 class vtkMRMLViewNode;
34 class vtkMRMLVolumeNode;
36 
37 // VTK includes
38 class vtkColorTransferFunction;
39 class vtkLookupTable;
40 class vtkPiecewiseFunction;
41 class vtkScalarsToColors;
42 class vtkVolumeProperty;
43 
44 // STD includes
45 #include <map>
46 #include <vector>
47 
48 class vtkStringArray;
49 
60 class VTK_SLICER_VOLUMERENDERING_MODULE_LOGIC_EXPORT vtkSlicerVolumeRenderingLogic
61  : public vtkSlicerModuleLogic
62 {
63 public:
64 
67  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
68 
73  void RegisterRenderingMethod(const char* methodName,
74  const char* displayNodeClassName);
76  std::map<std::string, std::string> GetRenderingMethods();
81  vtkSetStringMacro(DefaultRenderingMethod);
82  vtkGetStringMacro(DefaultRenderingMethod);
83 
88  vtkSetMacro(UseLinearRamp, bool);
89  vtkGetMacro(UseLinearRamp, bool);
90 
102  vtkMRMLVolumeRenderingDisplayNode* CreateVolumeRenderingDisplayNode(const char* renderingClassName = 0);
103 
110  void AddVolumeRenderingDisplayNode(vtkMRMLVolumeRenderingDisplayNode* node);
111 
114  void RemoveVolumeRenderingDisplayNode(vtkMRMLVolumeRenderingDisplayNode* node);
115 
118  void AddAllVolumeRenderingDisplayNodes();
119 
122  void RemoveAllVolumeRenderingDisplayNodes();
123 
133  void CopyDisplayToVolumeRenderingDisplayNode(
135  vtkMRMLVolumeDisplayNode* displayNode = 0);
136 
142  void CopyScalarDisplayToVolumeRenderingDisplayNode(
143  vtkMRMLVolumeRenderingDisplayNode* volumeRenderingDisplayNode,
144  vtkMRMLScalarVolumeDisplayNode* scalarDisplayNode = 0);
145 
151  void CopyLabelMapDisplayToVolumeRenderingDisplayNode(
152  vtkMRMLVolumeRenderingDisplayNode* volumeRenderingDisplayNode,
153  vtkMRMLLabelMapVolumeDisplayNode* labelMapDisplayNode = 0);
154 
170  void SetThresholdToVolumeProp(
171  double scalarRange[2], double threshold[2],
172  vtkVolumeProperty* node,
173  bool linearRamp = false, bool stayUpAtUpperLimit = false);
174 
197  void SetWindowLevelToVolumeProp(
198  double scalarRange[2], double windowLevel[2],
199  vtkLookupTable* lut, vtkVolumeProperty* node);
200 
204  void SetGradientOpacityToVolumeProp(
205  double scalarRange[2], vtkVolumeProperty* node);
206 
210  void SetLabelMapToVolumeProp(
211  vtkScalarsToColors* lut, vtkVolumeProperty* node);
212 
217  void UpdateDisplayNodeFromVolumeNode(vtkMRMLVolumeRenderingDisplayNode *displayNode,
218  vtkMRMLVolumeNode *volumeNode,
219  vtkMRMLVolumePropertyNode *propNode = NULL,
220  vtkMRMLAnnotationROINode *roiNode = NULL);
221 
224  vtkMRMLVolumeRenderingScenarioNode* CreateScenarioNode();
225 
227  void RemoveViewFromVolumeDisplayNodes(vtkMRMLVolumeNode *volumeNode,
228  vtkMRMLViewNode *viewNode);
229 
231  vtkMRMLVolumeRenderingDisplayNode* GetVolumeRenderingDisplayNodeByID(vtkMRMLVolumeNode *volumeNode,
232  char *displayNodeID);
233 
235  vtkMRMLVolumeRenderingDisplayNode* GetVolumeRenderingDisplayNodeForViewNode(
236  vtkMRMLVolumeNode *volumeNode,
237  vtkMRMLViewNode *viewNode);
238 
240  vtkMRMLVolumeRenderingDisplayNode* GetVolumeRenderingDisplayNodeForViewNode(
241  vtkMRMLViewNode *viewNode);
242 
244  vtkMRMLVolumeRenderingDisplayNode* GetFirstVolumeRenderingDisplayNode(vtkMRMLVolumeNode *volumeNode);
245 
247  vtkMRMLVolumeRenderingDisplayNode* GetFirstVolumeRenderingDisplayNodeByROINode(vtkMRMLAnnotationROINode* roiNode);
248 
249  void UpdateTranferFunctionRangeFromImage(vtkMRMLVolumeRenderingDisplayNode* vspNode);
250 
251  //void UpdateFgTranferFunctionRangeFromImage(vtkMRMLVolumeRenderingDisplayNode* vspNode);
252 
253  //void UpdateVolumePropertyFromImageData(vtkMRMLVolumeRenderingDisplayNode* vspNode);
254 
255  //void SetupFgVolumePropertyFromImageData(vtkMRMLVolumeRenderingDisplayNode* vspNode);
256 
260  void FitROIToVolume(vtkMRMLVolumeRenderingDisplayNode* vspNode);
261 
264  vtkMRMLVolumePropertyNode* AddVolumePropertyFromFile (const char* filename);
265 
272  vtkMRMLScene* GetPresetsScene();
273 
279  void AddPreset(vtkMRMLVolumePropertyNode* preset, vtkImageData* icon = NULL);
280 
283  void RemovePreset(vtkMRMLVolumePropertyNode* preset);
284 
288  static const char* GetIconVolumeReferenceRole() { return "IconVolume"; };
289 
295  vtkMRMLVolumePropertyNode* GetPresetByName(const char *presetName);
296 
299  bool IsDifferentFunction(vtkPiecewiseFunction* function1,
300  vtkPiecewiseFunction* function2) const;
301 
304  bool IsDifferentFunction(vtkColorTransferFunction* function1,
305  vtkColorTransferFunction* function2) const;
306 
307 protected:
310 
311  virtual void SetMRMLSceneInternal(vtkMRMLScene* scene) VTK_OVERRIDE;
312  // Register local MRML nodes
313  virtual void RegisterNodes() VTK_OVERRIDE;
314 
316  void ObserveMRMLScene() VTK_OVERRIDE;
317  void OnMRMLSceneNodeAdded(vtkMRMLNode* node) VTK_OVERRIDE;
318  void OnMRMLSceneNodeRemoved(vtkMRMLNode* node) VTK_OVERRIDE;
319  void OnMRMLNodeModified(vtkMRMLNode* node) VTK_OVERRIDE;
320 
321  // Update from
322  void UpdateVolumeRenderingDisplayNode(vtkMRMLVolumeRenderingDisplayNode* node);
323 
324  std::map<std::string, std::string> RenderingMethods;
333 
334  typedef std::vector<vtkMRMLNode*> DisplayNodesType;
335  DisplayNodesType DisplayNodes;
336 
337  bool LoadPresets(vtkMRMLScene* scene);
339 
340 private:
342  void operator=(const vtkSlicerVolumeRenderingLogic&); // Not implemented
343 };
344 
345 #endif
static vtkSlicerModuleLogic * New()
The Usual vtk class functions.
void PrintSelf(ostream &os, vtkIndent indent) VTK_OVERRIDE
MRML node for representing a volume display attributes.
std::vector< vtkMRMLNode * > DisplayNodesType
virtual void OnMRMLNodeModified(vtkMRMLNode *)
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
virtual void OnMRMLSceneNodeAdded(vtkMRMLNode *)
virtual void OnMRMLSceneNodeRemoved(vtkMRMLNode *)
virtual void ObserveMRMLScene()
virtual void SetMRMLSceneInternal(vtkMRMLScene *newScene)
MRML node for representing a volume (image stack).
MRML node to represent a 3D view.
std::map< std::string, std::string > RenderingMethods
MRML node for representing a volume (image stack).
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:135
vtkMRMLVolumePropertyNode contains the transfer functions (scalar opacity, color and gradient opacity...
MRML node for representing a volume display attributes.
MRML node for representing a volume display attributes.