Slicer  4.10
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
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"
21 
22 // Slicer includes
23 #include "vtkSlicerModuleLogic.h"
24 
25 // MRML includes
28 class vtkMRMLNode;
31 class vtkMRMLViewNode;
33 class vtkMRMLVolumeNode;
35 
36 // VTK includes
37 class vtkColorTransferFunction;
38 class vtkLookupTable;
39 class vtkPiecewiseFunction;
40 class vtkScalarsToColors;
41 class vtkVolumeProperty;
42 
43 // STD includes
44 #include <map>
45 #include <vector>
46 
57 class VTK_SLICER_VOLUMERENDERING_MODULE_LOGIC_EXPORT vtkSlicerVolumeRenderingLogic
58  : public vtkSlicerModuleLogic
59 {
60 public:
61 
64  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
65 
70  void RegisterRenderingMethod(const char* methodName,
71  const char* displayNodeClassName);
73  std::map<std::string, std::string> GetRenderingMethods();
78  vtkSetStringMacro(DefaultRenderingMethod);
79  vtkGetStringMacro(DefaultRenderingMethod);
80 
85  vtkSetMacro(UseLinearRamp, bool);
86  vtkGetMacro(UseLinearRamp, bool);
87 
97  vtkMRMLVolumeRenderingDisplayNode* CreateDefaultVolumeRenderingNodes(vtkMRMLVolumeNode* volumeNode);
98 
110  vtkMRMLVolumeRenderingDisplayNode* CreateVolumeRenderingDisplayNode(const char* renderingClassName = 0);
111 
118  void AddVolumeRenderingDisplayNode(vtkMRMLVolumeRenderingDisplayNode* node);
119 
122  void RemoveVolumeRenderingDisplayNode(vtkMRMLVolumeRenderingDisplayNode* node);
123 
126  void AddAllVolumeRenderingDisplayNodes();
127 
130  void RemoveAllVolumeRenderingDisplayNodes();
131 
134  void ChangeVolumeRenderingMethod(const char* displayNodeClassName = 0);
135 
145  void CopyDisplayToVolumeRenderingDisplayNode(
147  vtkMRMLVolumeDisplayNode* displayNode = 0);
148 
154  void CopyScalarDisplayToVolumeRenderingDisplayNode(
155  vtkMRMLVolumeRenderingDisplayNode* volumeRenderingDisplayNode,
156  vtkMRMLScalarVolumeDisplayNode* scalarDisplayNode = 0);
157 
163  void CopyLabelMapDisplayToVolumeRenderingDisplayNode(
164  vtkMRMLVolumeRenderingDisplayNode* volumeRenderingDisplayNode,
165  vtkMRMLLabelMapVolumeDisplayNode* labelMapDisplayNode = 0);
166 
182  void SetThresholdToVolumeProp(
183  double scalarRange[2], double threshold[2],
184  vtkVolumeProperty* node,
185  bool linearRamp = false, bool stayUpAtUpperLimit = false);
186 
209  void SetWindowLevelToVolumeProp(
210  double scalarRange[2], double windowLevel[2],
211  vtkLookupTable* lut, vtkVolumeProperty* node);
212 
216  void SetGradientOpacityToVolumeProp(
217  double scalarRange[2], vtkVolumeProperty* node);
218 
222  void SetLabelMapToVolumeProp(
223  vtkScalarsToColors* lut, vtkVolumeProperty* node);
224 
229  void UpdateDisplayNodeFromVolumeNode(vtkMRMLVolumeRenderingDisplayNode *displayNode,
230  vtkMRMLVolumeNode *volumeNode,
231  vtkMRMLVolumePropertyNode *propNode = NULL,
232  vtkMRMLAnnotationROINode *roiNode = NULL);
233 
235  void RemoveViewFromVolumeDisplayNodes(vtkMRMLVolumeNode *volumeNode,
236  vtkMRMLViewNode *viewNode);
237 
239  vtkMRMLVolumeRenderingDisplayNode* GetVolumeRenderingDisplayNodeByID(vtkMRMLVolumeNode *volumeNode,
240  char *displayNodeID);
241 
243  vtkMRMLVolumeRenderingDisplayNode* GetVolumeRenderingDisplayNodeForViewNode(
244  vtkMRMLVolumeNode *volumeNode,
245  vtkMRMLViewNode *viewNode);
246 
248  vtkMRMLVolumeRenderingDisplayNode* GetVolumeRenderingDisplayNodeForViewNode(
249  vtkMRMLViewNode *viewNode);
250 
252  vtkMRMLVolumeRenderingDisplayNode* GetFirstVolumeRenderingDisplayNode(vtkMRMLVolumeNode *volumeNode);
253 
255  vtkMRMLVolumeRenderingDisplayNode* GetFirstVolumeRenderingDisplayNodeByROINode(vtkMRMLAnnotationROINode* roiNode);
256 
257  void UpdateTranferFunctionRangeFromImage(vtkMRMLVolumeRenderingDisplayNode* vspNode);
258 
262  void FitROIToVolume(vtkMRMLVolumeRenderingDisplayNode* vspNode);
263 
266  vtkMRMLVolumePropertyNode* AddVolumePropertyFromFile (const char* filename);
267 
274  vtkMRMLScene* GetPresetsScene();
275 
281  void AddPreset(vtkMRMLVolumePropertyNode* preset, vtkImageData* icon = NULL);
282 
285  void RemovePreset(vtkMRMLVolumePropertyNode* preset);
286 
289  int LoadCustomPresetsScene(const char* sceneFilePath);
290 
294  static const char* GetIconVolumeReferenceRole() { return "IconVolume"; };
295 
301  vtkMRMLVolumePropertyNode* GetPresetByName(const char *presetName);
302 
305  bool IsDifferentFunction(vtkPiecewiseFunction* function1,
306  vtkPiecewiseFunction* function2) const;
307 
310  bool IsDifferentFunction(vtkColorTransferFunction* function1,
311  vtkColorTransferFunction* function2) const;
312 
313 protected:
316 
317  virtual void SetMRMLSceneInternal(vtkMRMLScene* scene) VTK_OVERRIDE;
318  // Register local MRML nodes
319  virtual void RegisterNodes() VTK_OVERRIDE;
320 
322  void ObserveMRMLScene() VTK_OVERRIDE;
323  void OnMRMLSceneNodeAdded(vtkMRMLNode* node) VTK_OVERRIDE;
324  void OnMRMLSceneNodeRemoved(vtkMRMLNode* node) VTK_OVERRIDE;
325  void OnMRMLNodeModified(vtkMRMLNode* node) VTK_OVERRIDE;
326 
327  // Update from
328  void UpdateVolumeRenderingDisplayNode(vtkMRMLVolumeRenderingDisplayNode* node);
329 
330  std::map<std::string, std::string> RenderingMethods;
337  char* DefaultRenderingMethod;
338 
339  bool UseLinearRamp;
340 
341  typedef std::vector<vtkMRMLNode*> DisplayNodesType;
342  DisplayNodesType DisplayNodes;
343 
344  bool LoadPresets(vtkMRMLScene* scene);
345  vtkMRMLScene* PresetsScene;
346 
347 private:
349  void operator=(const vtkSlicerVolumeRenderingLogic&); // Not implemented
350 };
351 
352 #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.
LRU Cache.
std::vector< vtkMRMLNode * > DisplayNodesType
A set of MRML Nodes that supports serialization and undo/redo.
Definition: vtkMRMLScene.h:54
virtual void SetMRMLSceneInternal(vtkMRMLScene *newScene)
MRML node for representing a volume (image stack).
MRML node to represent a 3D view.
MRML node for representing a volume (image stack).
Abstract Superclass for all specific types of MRML nodes.
Definition: vtkMRMLNode.h:138
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.