Slicer
5.1
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
|
#include <Modules/Loadable/VolumeRendering/Logic/vtkSlicerVolumeRenderingLogic.h>
Public Types | |
typedef vtkSlicerModuleLogic | Superclass |
Public Types inherited from vtkSlicerModuleLogic | |
typedef vtkMRMLAbstractLogic | Superclass |
Public Types inherited from vtkMRMLAbstractLogic | |
typedef vtkObject | Superclass |
typedef void(vtkMRMLAbstractLogic::* | TaskFunctionPointer) (void *clientdata) |
Public Member Functions | |
void | AddAllVolumeRenderingDisplayNodes () |
void | AddPreset (vtkMRMLVolumePropertyNode *preset, vtkImageData *icon=nullptr, bool appendToEnd=false) |
vtkMRMLShaderPropertyNode * | AddShaderPropertyFromFile (const char *filename) |
vtkMRMLVolumePropertyNode * | AddVolumePropertyFromFile (const char *filename) |
void | AddVolumeRenderingDisplayNode (vtkMRMLVolumeRenderingDisplayNode *node) |
void | ChangeVolumeRenderingMethod (const char *displayNodeClassName=nullptr) |
void | CopyDisplayToVolumeRenderingDisplayNode (vtkMRMLVolumeRenderingDisplayNode *node, vtkMRMLVolumeDisplayNode *displayNode=nullptr) |
void | CopyLabelMapDisplayToVolumeRenderingDisplayNode (vtkMRMLVolumeRenderingDisplayNode *volumeRenderingDisplayNode, vtkMRMLLabelMapVolumeDisplayNode *labelMapDisplayNode=nullptr) |
void | CopyScalarDisplayToVolumeRenderingDisplayNode (vtkMRMLVolumeRenderingDisplayNode *volumeRenderingDisplayNode, vtkMRMLScalarVolumeDisplayNode *scalarDisplayNode=nullptr) |
vtkMRMLVolumeRenderingDisplayNode * | CreateDefaultVolumeRenderingNodes (vtkMRMLVolumeNode *volumeNode) |
vtkMRMLDisplayableNode * | CreateROINode (vtkMRMLVolumeRenderingDisplayNode *displayNode) |
Create cropping ROI node, if does not exist yet. More... | |
vtkMRMLVolumeRenderingDisplayNode * | CreateVolumeRenderingDisplayNode (const char *renderingClassName=nullptr) |
void | FitROIToVolume (vtkMRMLVolumeRenderingDisplayNode *vspNode) |
virtual const char * | GetClassName () |
virtual char * | GetDefaultRenderingMethod () |
virtual std::string | GetDefaultROIClassName () |
vtkMRMLVolumeRenderingDisplayNode * | GetFirstVolumeRenderingDisplayNode (vtkMRMLVolumeNode *volumeNode) |
Find first volume rendering display node. More... | |
vtkMRMLVolumeRenderingDisplayNode * | GetFirstVolumeRenderingDisplayNodeByROINode (vtkMRMLNode *roiNode) |
Find the first volume rendering display node that uses the ROI. More... | |
vtkMRMLVolumePropertyNode * | GetPresetByName (const char *presetName) |
vtkMRMLScene * | GetPresetsScene () |
std::map< std::string, std::string > | GetRenderingMethods () |
virtual bool | GetUseLinearRamp () |
vtkMRMLVolumeRenderingDisplayNode * | GetVolumeRenderingDisplayNodeByID (vtkMRMLVolumeNode *volumeNode, char *displayNodeID) |
Find volume rendering display node reference in the volume. More... | |
vtkMRMLVolumeRenderingDisplayNode * | GetVolumeRenderingDisplayNodeForViewNode (vtkMRMLVolumeNode *volumeNode, vtkMRMLViewNode *viewNode) |
Find volume rendering display node referencing the view node and volume node. More... | |
vtkMRMLVolumeRenderingDisplayNode * | GetVolumeRenderingDisplayNodeForViewNode (vtkMRMLViewNode *viewNode) |
Find volume rendering display node referencing the view node in the scene. More... | |
virtual int | IsA (const char *type) |
bool | IsDifferentFunction (vtkPiecewiseFunction *function1, vtkPiecewiseFunction *function2) const |
bool | IsDifferentFunction (vtkColorTransferFunction *function1, vtkColorTransferFunction *function2) const |
int | LoadCustomPresetsScene (const char *sceneFilePath) |
void | PrintSelf (ostream &os, vtkIndent indent) override |
void | RegisterRenderingMethod (const char *methodName, const char *displayNodeClassName) |
void | RemoveAllVolumeRenderingDisplayNodes () |
void | RemovePreset (vtkMRMLVolumePropertyNode *preset) |
void | RemoveViewFromVolumeDisplayNodes (vtkMRMLVolumeNode *volumeNode, vtkMRMLViewNode *viewNode) |
Remove ViewNode from VolumeRenderingDisplayNode for a VolumeNode,. More... | |
void | RemoveVolumeRenderingDisplayNode (vtkMRMLVolumeRenderingDisplayNode *node) |
virtual void | SetDefaultRenderingMethod (const char *) |
virtual void | SetDefaultROIClassName (std::string) |
void | SetGradientOpacityToVolumeProp (double scalarRange[2], vtkVolumeProperty *node) |
void | SetLabelMapToVolumeProp (vtkScalarsToColors *lut, vtkVolumeProperty *node) |
bool | SetRecommendedVolumeRenderingProperties (vtkMRMLVolumeRenderingDisplayNode *vrDisplayNode) |
void | SetThresholdToVolumeProp (double scalarRange[2], double threshold[2], vtkVolumeProperty *node, bool linearRamp=false, bool stayUpAtUpperLimit=false) |
virtual void | SetUseLinearRamp (bool) |
void | SetWindowLevelToVolumeProp (double scalarRange[2], double windowLevel[2], vtkLookupTable *lut, vtkVolumeProperty *node) |
void | UpdateDisplayNodeFromVolumeNode (vtkMRMLVolumeRenderingDisplayNode *displayNode, vtkMRMLVolumeNode *volumeNode, vtkMRMLVolumePropertyNode *propNode=nullptr, vtkMRMLNode *roiNode=nullptr, bool createROI=true) |
void | UpdateTranferFunctionRangeFromImage (vtkMRMLVolumeRenderingDisplayNode *vspNode) |
Public Member Functions inherited from vtkSlicerModuleLogic | |
virtual vtkSlicerApplicationLogic * | GetApplicationLogic () |
Get access to overall application state. More... | |
virtual vtkMRMLAbstractLogic * | GetModuleLogic (const char *moduleName) |
Convenience method for getting another module's logic from the application logic. More... | |
std::string | GetModuleShareDirectory () const |
void | PrintSelf (ostream &os, vtkIndent indent) override |
void | SetModuleShareDirectory (const std::string &shareDirectory) |
Public Member Functions inherited from vtkMRMLAbstractLogic | |
virtual vtkMRMLApplicationLogic * | GetMRMLApplicationLogic () const |
Get access to overall application state. More... | |
vtkMRMLScene * | GetMRMLScene () const |
Return a reference to the current MRML scene. More... | |
void | PrintSelf (ostream &os, vtkIndent indent) override |
virtual void | SetMRMLApplicationLogic (vtkMRMLApplicationLogic *logic) |
void | SetMRMLScene (vtkMRMLScene *newScene) |
Set and observe the MRMLScene. More... | |
Static Public Member Functions | |
static const char * | GetIconVolumeReferenceRole () |
static int | IsTypeOf (const char *type) |
static vtkSlicerVolumeRenderingLogic * | New () |
static vtkSlicerVolumeRenderingLogic * | SafeDownCast (vtkObject *o) |
Static Public Member Functions inherited from vtkSlicerModuleLogic | |
static int | IsTypeOf (const char *type) |
static vtkSlicerModuleLogic * | New () |
The Usual vtk class functions. More... | |
static vtkSlicerModuleLogic * | SafeDownCast (vtkObject *o) |
Static Public Member Functions inherited from vtkMRMLAbstractLogic | |
static int | IsTypeOf (const char *type) |
static vtkMRMLAbstractLogic * | New () |
static vtkMRMLAbstractLogic * | SafeDownCast (vtkObject *o) |
Protected Types | |
typedef std::vector< vtkMRMLNode * > | DisplayNodesType |
Protected Attributes | |
char * | DefaultRenderingMethod |
std::string | DefaultROIClassName |
DisplayNodesType | DisplayNodes |
vtkMRMLScene * | PresetsScene |
std::map< std::string, std::string > | RenderingMethods |
bool | UseLinearRamp |
Additional Inherited Members | |
Static Protected Member Functions inherited from vtkMRMLAbstractLogic | |
static void | MRMLLogicsCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData) |
MRMLLogicCallback is a static function to relay modified events from the logics. More... | |
static void | MRMLNodesCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData) |
MRMLNodesCallback is a static function to relay modified events from the nodes. More... | |
static void | MRMLSceneCallback (vtkObject *caller, unsigned long eid, void *clientData, void *callData) |
Collection of utility methods to control the Volume Rendering nodes. The fastest to volume render of vtkMRMLVolumeNode is to use CreateVolumeRenderingDisplayNode() and UpdateDisplayNodeFromVolumeNode():
Definition at line 58 of file vtkSlicerVolumeRenderingLogic.h.
|
protected |
Definition at line 360 of file vtkSlicerVolumeRenderingLogic.h.
Definition at line 64 of file vtkSlicerVolumeRenderingLogic.h.
|
protected |
|
overrideprotected |
void vtkSlicerVolumeRenderingLogic::AddAllVolumeRenderingDisplayNodes | ( | ) |
Observe all the volume rendering display nodes of the scene.
void vtkSlicerVolumeRenderingLogic::AddPreset | ( | vtkMRMLVolumePropertyNode * | preset, |
vtkImageData * | icon = nullptr , |
||
bool | appendToEnd = false |
||
) |
Add a preset to the preset scene. If the optional icon image is specified then that will be used to in preset selector widgets. The icon is stored as a volume node in the preset scene.
appendToEnd | controls if the preset is added before or after existing presets. |
vtkMRMLShaderPropertyNode* vtkSlicerVolumeRenderingLogic::AddShaderPropertyFromFile | ( | const char * | filename | ) |
Load from file and add into the scene a shader property.
vtkMRMLVolumePropertyNode* vtkSlicerVolumeRenderingLogic::AddVolumePropertyFromFile | ( | const char * | filename | ) |
Load from file and add into the scene a transfer function.
void vtkSlicerVolumeRenderingLogic::AddVolumeRenderingDisplayNode | ( | vtkMRMLVolumeRenderingDisplayNode * | node | ) |
Observe the volume rendering display node to copy the volume display node if needed. This function is called automatically when a display node is added into the scene. You shouldn't have to call it.
void vtkSlicerVolumeRenderingLogic::ChangeVolumeRenderingMethod | ( | const char * | displayNodeClassName = nullptr | ) |
Re-create all volume rendering display nodes of the requested type. Common properties of the display nodes are propagated.
void vtkSlicerVolumeRenderingLogic::CopyDisplayToVolumeRenderingDisplayNode | ( | vtkMRMLVolumeRenderingDisplayNode * | node, |
vtkMRMLVolumeDisplayNode * | displayNode = nullptr |
||
) |
Applies the properties (window level, threshold and color function) of a volume display node to the volume rendering display node. If displayNode is 0, it uses the first display node. It's a utility method that internally calls CopyScalarDisplayToVolumeRenderingDisplayNode() or CopyLabelMapDisplayToVolumeRenderingDisplayNode() based on the type of displayNode.
void vtkSlicerVolumeRenderingLogic::CopyLabelMapDisplayToVolumeRenderingDisplayNode | ( | vtkMRMLVolumeRenderingDisplayNode * | volumeRenderingDisplayNode, |
vtkMRMLLabelMapVolumeDisplayNode * | labelMapDisplayNode = nullptr |
||
) |
Applies the properties (threshold ) of the labelmap display node to the volume rendering displaynode. If labelMapDisplayNode is 0, it uses the first displaynode.
void vtkSlicerVolumeRenderingLogic::CopyScalarDisplayToVolumeRenderingDisplayNode | ( | vtkMRMLVolumeRenderingDisplayNode * | volumeRenderingDisplayNode, |
vtkMRMLScalarVolumeDisplayNode * | scalarDisplayNode = nullptr |
||
) |
Applies the properties (window level, threshold and color function) of the scalar display node to the volume rendering displaynode. If scalarDisplayNode is 0, it uses the first display node.
vtkMRMLVolumeRenderingDisplayNode* vtkSlicerVolumeRenderingLogic::CreateDefaultVolumeRenderingNodes | ( | vtkMRMLVolumeNode * | volumeNode | ) |
Create and set up all nodes needed for volume rendering for a given volume node:
vtkMRMLDisplayableNode* vtkSlicerVolumeRenderingLogic::CreateROINode | ( | vtkMRMLVolumeRenderingDisplayNode * | displayNode | ) |
Create cropping ROI node, if does not exist yet.
vtkMRMLVolumeRenderingDisplayNode* vtkSlicerVolumeRenderingLogic::CreateVolumeRenderingDisplayNode | ( | const char * | renderingClassName = nullptr | ) |
Create a volume rendering display node. The node to instantiate will be of type renderingType if not null, DefaultRenderingMethod if not null or vtkMRMLCPURayCastVolumeRenderingDisplayNode in that order. Return the created node or 0 if there is no scene or the class name doesn't exist. If renderingClassName is 0, the returned node has a name generated using "VolumeRendering" as base name. You are responsible for deleting the node (read more about it in the section Get, New, Create, CreateAndAdd).
void vtkSlicerVolumeRenderingLogic::FitROIToVolume | ( | vtkMRMLVolumeRenderingDisplayNode * | vspNode | ) |
Utility function that modifies the ROI node of the display node to fit the boundaries of the volume node
|
virtual |
Reimplemented from vtkSlicerModuleLogic.
|
virtual |
|
virtual |
vtkMRMLVolumeRenderingDisplayNode* vtkSlicerVolumeRenderingLogic::GetFirstVolumeRenderingDisplayNode | ( | vtkMRMLVolumeNode * | volumeNode | ) |
Find first volume rendering display node.
vtkMRMLVolumeRenderingDisplayNode* vtkSlicerVolumeRenderingLogic::GetFirstVolumeRenderingDisplayNodeByROINode | ( | vtkMRMLNode * | roiNode | ) |
Find the first volume rendering display node that uses the ROI.
|
inlinestatic |
This node reference role name allows linking from a preset node to a volume node that contains an icon for the preset node. For example, the icon is used for representing the node in qSlicerPresetComboBox.
Definition at line 310 of file vtkSlicerVolumeRenderingLogic.h.
vtkMRMLVolumePropertyNode* vtkSlicerVolumeRenderingLogic::GetPresetByName | ( | const char * | presetName | ) |
Return the preset presetName contained in the presets scene loaded using GetPresetsScene(). If no presets are found, return 0. If multiple presets are found, the first one is returned.
vtkMRMLScene* vtkSlicerVolumeRenderingLogic::GetPresetsScene | ( | ) |
Return the scene containing the volume rendering presets. If there is no presets scene, a scene is created and presets are loaded into. The presets scene is loaded from a file (presets.xml) located in the module share directory
std::map<std::string, std::string> vtkSlicerVolumeRenderingLogic::GetRenderingMethods | ( | ) |
|
virtual |
vtkMRMLVolumeRenderingDisplayNode* vtkSlicerVolumeRenderingLogic::GetVolumeRenderingDisplayNodeByID | ( | vtkMRMLVolumeNode * | volumeNode, |
char * | displayNodeID | ||
) |
Find volume rendering display node reference in the volume.
vtkMRMLVolumeRenderingDisplayNode* vtkSlicerVolumeRenderingLogic::GetVolumeRenderingDisplayNodeForViewNode | ( | vtkMRMLVolumeNode * | volumeNode, |
vtkMRMLViewNode * | viewNode | ||
) |
Find volume rendering display node referencing the view node and volume node.
vtkMRMLVolumeRenderingDisplayNode* vtkSlicerVolumeRenderingLogic::GetVolumeRenderingDisplayNodeForViewNode | ( | vtkMRMLViewNode * | viewNode | ) |
Find volume rendering display node referencing the view node in the scene.
|
virtual |
Reimplemented from vtkSlicerModuleLogic.
bool vtkSlicerVolumeRenderingLogic::IsDifferentFunction | ( | vtkPiecewiseFunction * | function1, |
vtkPiecewiseFunction * | function2 | ||
) | const |
Utility function that checks if the piecewise functions are equal Returns true if different
bool vtkSlicerVolumeRenderingLogic::IsDifferentFunction | ( | vtkColorTransferFunction * | function1, |
vtkColorTransferFunction * | function2 | ||
) | const |
Utility function that checks if the color transfer functions are equal Returns true if different
|
static |
int vtkSlicerVolumeRenderingLogic::LoadCustomPresetsScene | ( | const char * | sceneFilePath | ) |
Use custom presets scene
|
protected |
|
static |
|
overrideprotectedvirtual |
Reimplemented to initialize display nodes in the scene.
Reimplemented from vtkMRMLAbstractLogic.
|
overrideprotectedvirtual |
Called after the corresponding MRML event is triggered.
Reimplemented from vtkMRMLAbstractLogic.
|
overrideprotectedvirtual |
If vtkMRMLScene::NodeAddedEvent has been set to be observed in SetMRMLSceneInternal, it is called when the scene fires the event
Reimplemented from vtkMRMLAbstractLogic.
|
overrideprotectedvirtual |
If vtkMRMLScene::NodeRemovedEvent has been set to be observed in SetMRMLSceneInternal, it is called when the scene fires the event
Reimplemented from vtkMRMLAbstractLogic.
|
override |
|
overrideprotectedvirtual |
Register node classes into the MRML scene. Called each time a new scene is set. Do nothing by default. Can be reimplemented in derivated classes.
Reimplemented from vtkMRMLAbstractLogic.
void vtkSlicerVolumeRenderingLogic::RegisterRenderingMethod | ( | const char * | methodName, |
const char * | displayNodeClassName | ||
) |
Inform the logic and observers that a rendering method (class deriving from vtkMRMLVolumeRenderingDisplayNode) is available. The event ModifiedEvent gets fired.
void vtkSlicerVolumeRenderingLogic::RemoveAllVolumeRenderingDisplayNodes | ( | ) |
Unobserve all the volume rendering display nodes of the scene.
void vtkSlicerVolumeRenderingLogic::RemovePreset | ( | vtkMRMLVolumePropertyNode * | preset | ) |
Removes a preset and its associated icon (if specified) from the preset scene.
void vtkSlicerVolumeRenderingLogic::RemoveViewFromVolumeDisplayNodes | ( | vtkMRMLVolumeNode * | volumeNode, |
vtkMRMLViewNode * | viewNode | ||
) |
Remove ViewNode from VolumeRenderingDisplayNode for a VolumeNode,.
void vtkSlicerVolumeRenderingLogic::RemoveVolumeRenderingDisplayNode | ( | vtkMRMLVolumeRenderingDisplayNode * | node | ) |
Unobserve the volume rendering display node.
|
static |
|
virtual |
The default rendering method is set to display nodes created in CreateVolumeRenderingDisplayNode(). If no rendering method is given the VTKCPURayCast is instantiated.
|
virtual |
void vtkSlicerVolumeRenderingLogic::SetGradientOpacityToVolumeProp | ( | double | scalarRange[2], |
vtkVolumeProperty * | node | ||
) |
Create an opacity transfer function for gradient opacity. It ranges from 0 to scalarRange[1] - scalarRange[0].
void vtkSlicerVolumeRenderingLogic::SetLabelMapToVolumeProp | ( | vtkScalarsToColors * | lut, |
vtkVolumeProperty * | node | ||
) |
Generate and set to the volume property node an opacity and color transfer function from the labelmap LUT colors.
|
overrideprotectedvirtual |
Called each time a new scene is set. Can be reimplemented in derivated classes. Doesn't observe the scene by default, that means that UpdateFromMRMLScene() won't be called by default when a scene is imported, closed or restored, only when a new scene is set.
Reimplemented from vtkMRMLAbstractLogic.
bool vtkSlicerVolumeRenderingLogic::SetRecommendedVolumeRenderingProperties | ( | vtkMRMLVolumeRenderingDisplayNode * | vrDisplayNode | ) |
Set volume rendering properties that seems well suited for the volume. The function uses heuristics to detect what kind of volume it is (CT, MRI, other), based on its intensity range and choses preset accordingly. Returns false is volume type could not be detected and so properties are not changed.
void vtkSlicerVolumeRenderingLogic::SetThresholdToVolumeProp | ( | double | scalarRange[2], |
double | threshold[2], | ||
vtkVolumeProperty * | node, | ||
bool | linearRamp = false , |
||
bool | stayUpAtUpperLimit = false |
||
) |
Applies a threshold to a volume property
/// true: false: _ /// __/|__ __| |__ ///
/// true: ______ false: /// __/ __/|_____ ///
|
virtual |
Use a linear ramp (true) or a sharp ramp (false) when copying the volume display node threshold values into the volume rendering display node. True by default.
void vtkSlicerVolumeRenderingLogic::SetWindowLevelToVolumeProp | ( | double | scalarRange[2], |
double | windowLevel[2], | ||
vtkLookupTable * | lut, | ||
vtkVolumeProperty * | node | ||
) |
Create a color transfer function that ranges from scalarRange[0] to scalarRange[1] and containing a windowLevel[0] wide ramp centered on level:
/// max = level + window/2 scalarRange[1] /// .___________________________. /// .____________________./ /// scalarRange[0] min = level - window/2 ///
The generated transfer function contains at least 4 points located in:
If lut is 0, the colors go from black (0, 0, 0) to white (1, 1, 1) If lut contains only 1 value, that color is used for all the generated points. If lut contains more than 1 value, each color is used in the ramp. The generated transfer function will be made of lut->size() + 2 points. The function is then applied to the volume property node.
void vtkSlicerVolumeRenderingLogic::UpdateDisplayNodeFromVolumeNode | ( | vtkMRMLVolumeRenderingDisplayNode * | displayNode, |
vtkMRMLVolumeNode * | volumeNode, | ||
vtkMRMLVolumePropertyNode * | propNode = nullptr , |
||
vtkMRMLNode * | roiNode = nullptr , |
||
bool | createROI = true |
||
) |
Update DisplayNode from VolumeNode, Can pass a VolumePropertyNode and an ROI node to be the display node. If they are nullptr and the display node does not already have any, new ones will be created then set and observed to the display node.
void vtkSlicerVolumeRenderingLogic::UpdateTranferFunctionRangeFromImage | ( | vtkMRMLVolumeRenderingDisplayNode * | vspNode | ) |
|
protected |
|
protected |
This property holds the default rendering method to instantiate in CreateVolumeRenderingDisplayNode(). If no rendering method is given, the VTKCPURayCast technique is instantiated.
Definition at line 356 of file vtkSlicerVolumeRenderingLogic.h.
|
protected |
Definition at line 366 of file vtkSlicerVolumeRenderingLogic.h.
|
protected |
Definition at line 361 of file vtkSlicerVolumeRenderingLogic.h.
|
protected |
Definition at line 364 of file vtkSlicerVolumeRenderingLogic.h.
|
protected |
Definition at line 349 of file vtkSlicerVolumeRenderingLogic.h.
|
protected |
Definition at line 358 of file vtkSlicerVolumeRenderingLogic.h.