Slicer 5.13
Slicer is a multi-platform, free and open source software package for visualization and medical image computing
Loading...
Searching...
No Matches
ModelGlowDM.GlowDMPassPipeline Class Reference
Inheritance diagram for ModelGlowDM.GlowDMPassPipeline:
Collaboration diagram for ModelGlowDM.GlowDMPassPipeline:

Public Member Functions

 __init__ (self)
 
 EnsureGlowPass (cls, vtkMRMLScene scene)
 
 GetGlowPassRenderOrder (cls)
 
int GetRenderOrder (self)
 
None OnRendererAdded (self, vtkRenderer renderer)
 
None OnRendererRemoved (self, vtkRenderer renderer)
 
bool SceneHasGlowPass (cls, vtkMRMLScene scene)
 
- Public Member Functions inherited from ModelGlowDM._Pipeline
 IsPipelineNode (cls, node)
 
vtkMRMLLayerDMScriptedPipeline|None TryCreatePipeline (cls, vtkMRMLAbstractViewNode viewNode, vtkMRMLNode node)
 

Protected Attributes

 _basicPasses = vtkRenderStepsPass()
 
 _glowPass = vtkOutlineGlowPass()
 

Additional Inherited Members

- Protected Member Functions inherited from ModelGlowDM._Pipeline
vtkMRMLScriptedModuleNode _CreatePipelineNode (cls)
 
str _GetClassName (cls)
 

Detailed Description

The GlowDMPassPipeline is responsible for setting a glow render pass to the input renderer.
Since the pass only need to be set once, the following are used in this class:
    - The data node is set to be a singleton data. This will make the data node persist in between scene clear.
    - Setting and removing the render pass is done on renderer added / removed API calls.
    - We set the pipeline to its own renderer (GetRenderOrder != 0) and we make it easy for other classes to know
        the pipeline's render order by adding a convenience static method.

Note: This logic doesn't need to be split but is an example of possible implementation decoupling.

Definition at line 202 of file ModelGlowDM.py.

Constructor & Destructor Documentation

◆ __init__()

ModelGlowDM.GlowDMPassPipeline.__init__ ( self)
At creation, we call the super class initialization and create the VTK passes.
The VTK passes are then set during the API on renderer added / removed calls.

Definition at line 214 of file ModelGlowDM.py.

Member Function Documentation

◆ EnsureGlowPass()

ModelGlowDM.GlowDMPassPipeline.EnsureGlowPass ( cls,
vtkMRMLScene scene )
Convenience static method to add a singleton render glow pass data node to the scene.
The scene is passed in argument to avoid using the singleton slicer.mrmlScene which is not available in
trame-slicer.

Definition at line 271 of file ModelGlowDM.py.

◆ GetGlowPassRenderOrder()

ModelGlowDM.GlowDMPassPipeline.GetGlowPassRenderOrder ( cls)
Convenience static method to return the glow pass render order and be used by other classes.

Definition at line 266 of file ModelGlowDM.py.

◆ GetRenderOrder()

int ModelGlowDM.GlowDMPassPipeline.GetRenderOrder ( self)
Arbitrary render order number where the pipeline wants to be displayed.
Return 0 to be at the default order (main 3D Slicer pipelines)
Return larger values to be rendered on top of pipelines with lower render orders.

:return: default = 0. Here we use a helper static method to return the Glow pass render order and allow
    pipelines that want to be rendered in this renderer to use it as well.

Definition at line 254 of file ModelGlowDM.py.

◆ OnRendererAdded()

None ModelGlowDM.GlowDMPassPipeline.OnRendererAdded ( self,
vtkRenderer renderer )
Triggered when the pipeline is displayed on a new renderer.

When the renderer is added, we attach our glow pass.
Since we don't control the actual renderer used by the pipeline, this should be used systematically.
See also: self.GetRenderer()

Definition at line 224 of file ModelGlowDM.py.

◆ OnRendererRemoved()

None ModelGlowDM.GlowDMPassPipeline.OnRendererRemoved ( self,
vtkRenderer renderer )
Triggered when the pipeline is removed from its previous renderer.

When the renderer is removed, we remove our glow pass and release the graphics resources it holds
(framebuffers, textures). Without the release, the GPU resources would leak when the pipeline is
deleted (for instance when it is recreated after a module reload).
Since we don't control the actual renderer used by the pipeline, this should be used systematically.
See also: self.GetRenderer()

Definition at line 237 of file ModelGlowDM.py.

◆ SceneHasGlowPass()

bool ModelGlowDM.GlowDMPassPipeline.SceneHasGlowPass ( cls,
vtkMRMLScene scene )
Convenience static method to check if the singleton glow pass data node is present in the scene.
The scene is passed in argument to avoid using the singleton slicer.mrmlScene which is not available in
trame-slicer.

Definition at line 286 of file ModelGlowDM.py.

Member Data Documentation

◆ _basicPasses

ModelGlowDM.GlowDMPassPipeline._basicPasses = vtkRenderStepsPass()
protected

Definition at line 220 of file ModelGlowDM.py.

◆ _glowPass

ModelGlowDM.GlowDMPassPipeline._glowPass = vtkOutlineGlowPass()
protected

Definition at line 221 of file ModelGlowDM.py.


The documentation for this class was generated from the following file: