Slicer 5.6
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
56class VTK_SLICER_VOLUMERENDERING_MODULE_LOGIC_EXPORT vtkSlicerVolumeRenderingLogic
58{
59public:
60
63 void PrintSelf(ostream& os, vtkIndent indent) override;
64
69 void RegisterRenderingMethod(const char* methodName,
70 const char* displayNodeClassName);
72 std::map<std::string, std::string> GetRenderingMethods();
77 vtkSetStringMacro(DefaultRenderingMethod);
78 vtkGetStringMacro(DefaultRenderingMethod);
79
84 vtkSetMacro(UseLinearRamp, bool);
85 vtkGetMacro(UseLinearRamp, bool);
86
99
111 vtkMRMLVolumeRenderingDisplayNode* CreateVolumeRenderingDisplayNode(const char* renderingClassName = nullptr);
112
120
124
128
132
135 void ChangeVolumeRenderingMethod(const char* displayNodeClassName = nullptr);
136
142
154 vtkMRMLVolumeDisplayNode* displayNode = nullptr);
155
162 vtkMRMLVolumeRenderingDisplayNode* volumeRenderingDisplayNode,
163 vtkMRMLScalarVolumeDisplayNode* scalarDisplayNode = nullptr);
164
171 vtkMRMLVolumeRenderingDisplayNode* volumeRenderingDisplayNode,
172 vtkMRMLLabelMapVolumeDisplayNode* labelMapDisplayNode = nullptr);
173
190 double scalarRange[2], double threshold[2],
191 vtkVolumeProperty* node,
192 bool linearRamp = false, bool stayUpAtUpperLimit = false);
193
217 double scalarRange[2], double windowLevel[2],
218 vtkScalarsToColors* lut, vtkVolumeProperty* node);
219
224 double scalarRange[2], vtkVolumeProperty* node);
225
230 vtkScalarsToColors* colors, vtkVolumeProperty* node);
231
237 vtkMRMLVolumeNode *volumeNode,
238 vtkMRMLVolumePropertyNode *propNode = nullptr,
239 vtkMRMLNode *roiNode = nullptr,
240 bool createROI=true);
241
244
247 vtkMRMLViewNode *viewNode);
248
251 char *displayNodeID);
252
255 vtkMRMLVolumeNode *volumeNode,
256 vtkMRMLViewNode *viewNode);
257
260 vtkMRMLViewNode *viewNode);
261
264
267
269
274
278
282
290
297 void AddPreset(vtkMRMLVolumePropertyNode* preset, vtkImageData* icon = nullptr, bool appendToEnd=false);
298
302
305 int LoadCustomPresetsScene(const char* sceneFilePath);
306
310 static const char* GetIconVolumeReferenceRole() { return "IconVolume"; };
311
318
321 bool IsDifferentFunction(vtkPiecewiseFunction* function1,
322 vtkPiecewiseFunction* function2) const;
323
326 bool IsDifferentFunction(vtkColorTransferFunction* function1,
327 vtkColorTransferFunction* function2) const;
328
329 vtkSetMacro(DefaultROIClassName, std::string);
330 vtkGetMacro(DefaultROIClassName, std::string);
331
332protected:
335
336 void SetMRMLSceneInternal(vtkMRMLScene* scene) override;
337 // Register local MRML nodes
338 void RegisterNodes() override;
339
341 void ObserveMRMLScene() override;
342 void OnMRMLSceneNodeAdded(vtkMRMLNode* node) override;
344 void OnMRMLNodeModified(vtkMRMLNode* node) override;
345
346 // Update from
348
349 std::map<std::string, std::string> RenderingMethods;
357
359
360 typedef std::vector<vtkMRMLNode*> DisplayNodesType;
362
365
367private:
369 void operator=(const vtkSlicerVolumeRenderingLogic&) = delete;
370};
371
372#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