Slicer 5.4
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
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
24
25// MRML includes
28class vtkMRMLNode;
32class vtkMRMLViewNode;
36
37// VTK includes
38class vtkColorTransferFunction;
39class vtkPiecewiseFunction;
40class vtkScalarsToColors;
41class vtkVolumeProperty;
42
43// STD includes
44#include <map>
45#include <vector>
46
57class VTK_SLICER_VOLUMERENDERING_MODULE_LOGIC_EXPORT vtkSlicerVolumeRenderingLogic
59{
60public:
61
64 void PrintSelf(ostream& os, vtkIndent indent) 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
100
112 vtkMRMLVolumeRenderingDisplayNode* CreateVolumeRenderingDisplayNode(const char* renderingClassName = nullptr);
113
121
125
129
133
136 void ChangeVolumeRenderingMethod(const char* displayNodeClassName = nullptr);
137
143
155 vtkMRMLVolumeDisplayNode* displayNode = nullptr);
156
163 vtkMRMLVolumeRenderingDisplayNode* volumeRenderingDisplayNode,
164 vtkMRMLScalarVolumeDisplayNode* scalarDisplayNode = nullptr);
165
172 vtkMRMLVolumeRenderingDisplayNode* volumeRenderingDisplayNode,
173 vtkMRMLLabelMapVolumeDisplayNode* labelMapDisplayNode = nullptr);
174
191 double scalarRange[2], double threshold[2],
192 vtkVolumeProperty* node,
193 bool linearRamp = false, bool stayUpAtUpperLimit = false);
194
218 double scalarRange[2], double windowLevel[2],
219 vtkScalarsToColors* lut, vtkVolumeProperty* node);
220
225 double scalarRange[2], vtkVolumeProperty* node);
226
231 vtkScalarsToColors* colors, vtkVolumeProperty* node);
232
238 vtkMRMLVolumeNode *volumeNode,
239 vtkMRMLVolumePropertyNode *propNode = nullptr,
240 vtkMRMLNode *roiNode = nullptr,
241 bool createROI=true);
242
245
248 vtkMRMLViewNode *viewNode);
249
252 char *displayNodeID);
253
256 vtkMRMLVolumeNode *volumeNode,
257 vtkMRMLViewNode *viewNode);
258
261 vtkMRMLViewNode *viewNode);
262
265
268
270
275
279
283
291
298 void AddPreset(vtkMRMLVolumePropertyNode* preset, vtkImageData* icon = nullptr, bool appendToEnd=false);
299
303
306 int LoadCustomPresetsScene(const char* sceneFilePath);
307
311 static const char* GetIconVolumeReferenceRole() { return "IconVolume"; };
312
319
322 bool IsDifferentFunction(vtkPiecewiseFunction* function1,
323 vtkPiecewiseFunction* function2) const;
324
327 bool IsDifferentFunction(vtkColorTransferFunction* function1,
328 vtkColorTransferFunction* function2) const;
329
330 vtkSetMacro(DefaultROIClassName, std::string);
331 vtkGetMacro(DefaultROIClassName, std::string);
332
333protected:
336
337 void SetMRMLSceneInternal(vtkMRMLScene* scene) override;
338 // Register local MRML nodes
339 void RegisterNodes() override;
340
342 void ObserveMRMLScene() override;
343 void OnMRMLSceneNodeAdded(vtkMRMLNode* node) override;
345 void OnMRMLNodeModified(vtkMRMLNode* node) override;
346
347 // Update from
349
350 std::map<std::string, std::string> RenderingMethods;
358
360
361 typedef std::vector<vtkMRMLNode*> DisplayNodesType;
363
366
368private:
370 void operator=(const vtkSlicerVolumeRenderingLogic&) = delete;
371};
372
373#endif
MRML node for representing a volume display attributes.
Abstract Superclass for all specific types of MRML nodes.
MRML node for representing a volume display attributes.
MRML node for representing a volume (image stack).
A set of MRML Nodes that supports serialization and undo/redo.
vtkMRMLShaderPropertyNode volume shader custom code and custom uniform variables defined by users or ...
MRML node to represent a 3D view.
MRML node for representing a volume display attributes.
MRML node for representing a volume (image stack).
vtkMRMLVolumePropertyNode contains the transfer functions (scalar opacity, color and gradient opacity...
vtkMRMLVolumePropertyNode * GetPresetByName(const char *presetName)
std::map< std::string, std::string > GetRenderingMethods()
void PrintSelf(ostream &os, vtkIndent indent) override
void UpdateDisplayNodeFromVolumeNode(vtkMRMLVolumeRenderingDisplayNode *displayNode, vtkMRMLVolumeNode *volumeNode, vtkMRMLVolumePropertyNode *propNode=nullptr, vtkMRMLNode *roiNode=nullptr, bool createROI=true)
void UpdateTranferFunctionRangeFromImage(vtkMRMLVolumeRenderingDisplayNode *vspNode)
void ObserveMRMLScene() override
Reimplemented to initialize display nodes in the scene.
void SetThresholdToVolumeProp(double scalarRange[2], double threshold[2], vtkVolumeProperty *node, bool linearRamp=false, bool stayUpAtUpperLimit=false)
void OnMRMLSceneNodeAdded(vtkMRMLNode *node) override
void OnMRMLSceneNodeRemoved(vtkMRMLNode *node) override
bool LoadPresets(vtkMRMLScene *scene)
void SetWindowLevelToVolumeProp(double scalarRange[2], double windowLevel[2], vtkScalarsToColors *lut, vtkVolumeProperty *node)
void SetLabelMapToVolumeProp(vtkScalarsToColors *colors, vtkVolumeProperty *node)
vtkMRMLVolumePropertyNode * AddVolumePropertyFromFile(const char *filename)
void UpdateVolumeRenderingDisplayNode(vtkMRMLVolumeRenderingDisplayNode *node)
vtkMRMLVolumeRenderingDisplayNode * GetFirstVolumeRenderingDisplayNodeByROINode(vtkMRMLNode *roiNode)
Find the first volume rendering display node that uses the ROI.
void RegisterRenderingMethod(const char *methodName, const char *displayNodeClassName)
vtkMRMLVolumeRenderingDisplayNode * CreateVolumeRenderingDisplayNode(const char *renderingClassName=nullptr)
bool SetRecommendedVolumeRenderingProperties(vtkMRMLVolumeRenderingDisplayNode *vrDisplayNode)
std::vector< vtkMRMLNode * > DisplayNodesType
std::map< std::string, std::string > RenderingMethods
vtkMRMLVolumeRenderingDisplayNode * CreateDefaultVolumeRenderingNodes(vtkMRMLVolumeNode *volumeNode)
void SetMRMLSceneInternal(vtkMRMLScene *scene) override
void SetGradientOpacityToVolumeProp(double scalarRange[2], vtkVolumeProperty *node)
bool IsDifferentFunction(vtkPiecewiseFunction *function1, vtkPiecewiseFunction *function2) const
void CopyDisplayToVolumeRenderingDisplayNode(vtkMRMLVolumeRenderingDisplayNode *node, vtkMRMLVolumeDisplayNode *displayNode=nullptr)
void CopyScalarDisplayToVolumeRenderingDisplayNode(vtkMRMLVolumeRenderingDisplayNode *volumeRenderingDisplayNode, vtkMRMLScalarVolumeDisplayNode *scalarDisplayNode=nullptr)
vtkMRMLDisplayableNode * CreateROINode(vtkMRMLVolumeRenderingDisplayNode *displayNode)
Create cropping ROI node, if does not exist yet.
vtkMRMLShaderPropertyNode * AddShaderPropertyFromFile(const char *filename)
void RemoveViewFromVolumeDisplayNodes(vtkMRMLVolumeNode *volumeNode, vtkMRMLViewNode *viewNode)
Remove ViewNode from VolumeRenderingDisplayNode for a VolumeNode,.
vtkMRMLScene * GetPresetsScene()
void CopyLabelMapDisplayToVolumeRenderingDisplayNode(vtkMRMLVolumeRenderingDisplayNode *volumeRenderingDisplayNode, vtkMRMLLabelMapVolumeDisplayNode *labelMapDisplayNode=nullptr)
void FitROIToVolume(vtkMRMLVolumeRenderingDisplayNode *vspNode)
static vtkSlicerVolumeRenderingLogic * New()
void OnMRMLNodeModified(vtkMRMLNode *node) override
int LoadCustomPresetsScene(const char *sceneFilePath)
vtkMRMLVolumeRenderingDisplayNode * GetVolumeRenderingDisplayNodeForViewNode(vtkMRMLVolumeNode *volumeNode, vtkMRMLViewNode *viewNode)
Find volume rendering display node referencing the view node and volume node.
void AddVolumeRenderingDisplayNode(vtkMRMLVolumeRenderingDisplayNode *node)
void ChangeVolumeRenderingMethod(const char *displayNodeClassName=nullptr)
~vtkSlicerVolumeRenderingLogic() override
void RemovePreset(vtkMRMLVolumePropertyNode *preset)
void RemoveVolumeRenderingDisplayNode(vtkMRMLVolumeRenderingDisplayNode *node)
vtkMRMLVolumeRenderingDisplayNode * GetVolumeRenderingDisplayNodeForViewNode(vtkMRMLViewNode *viewNode)
Find volume rendering display node referencing the view node in the scene.
vtkMRMLVolumeRenderingDisplayNode * GetVolumeRenderingDisplayNodeByID(vtkMRMLVolumeNode *volumeNode, char *displayNodeID)
Find volume rendering display node reference in the volume.
vtkMRMLVolumeRenderingDisplayNode * GetFirstVolumeRenderingDisplayNode(vtkMRMLVolumeNode *volumeNode)
Find first volume rendering display node.
void AddPreset(vtkMRMLVolumePropertyNode *preset, vtkImageData *icon=nullptr, bool appendToEnd=false)
bool IsDifferentFunction(vtkColorTransferFunction *function1, vtkColorTransferFunction *function2) const