PRISMRenderingShaders Module

class CustomShader(shaderPropertyNode, volumeNode=None)

Bases: object

classmethod GetAllShaderClassNames()

Function to get the class names of all of the shaders.

Returns:Names of all the classes.
Return type:array[str]
classmethod GetBasicDescription()

Function to get a basic description of the current shader.

Returns:Description of the current shader.
Return type:str
classmethod GetClass(shaderName)

Function to get a class from it’s name.

Returns:Class.
Return type:cls
classmethod GetClassName(shaderDisplayName)

Function to get a class from it’s display name.

Returns:Class.
Return type:cls
classmethod GetDisplayName()

Function to get the name of the current class.

Returns:Name of the current class.
Return type:str
classmethod InstanciateCustomShader(shaderDisplayName, shaderPropertyNode, volumeNode)

Function to instanciate a custom shader.

Parameters:
  • shaderDisplayName (str) – Display name of the shader.
  • shaderPropertyNode (vtkMRMLShaderPropertyNode) – Shader property node.
  • volumeNode (vtkMRMLScalarVolumeNode) – Current volume.
clear()

Function to clear the shader.

getParameterNames()

Function to get the shader parameter names.

Returns:Shader parameter names.
Return type:array[str]
getShaderParameter(paramName, paramType)

Function to get the parameters of the shader.

Parameters:
  • paramName (str) – Name of the parameter.
  • paramType (str) – Type of the parameter.
Returns:

Value of the parameter.

Return type:

int|float|str

getShaderPropertyNode()

Function to get the shader property node of the shader.

Returns:Property node of the shader.
Return type:vtkMRMLShaderPropertyNode
getVolumeRange()

Function to get the range of the current volume.

Returns:Range of the current volume.
Return type:float.
classmethod hasShaderParameter(name, paramType)

Function to check if a parameter is in the shader.

Parameters:
  • name (str) – Name of the parameter.
  • paramType (str) – Type of the parameter.
Returns:

Parameter is in the shader.

Return type:

bool

setAllUniforms()

Function to set the uniforms of the shader.

setPathEnds(entry, target)
setShaderParameter(paramName, paramValue, paramType)

Function to set the parameters of the shader.

Parameters:
  • paramName (str) – Name of the parameter.
  • paramType (str) – Type of the parameter.
  • paramValue (int|float|str) – Value of the parameter.
setupShader()

Function to setup the shader.

shader4fParams = {}
shaderbParams = {}
shaderfParams = {}
shaderiParams = {}
shaderrParams = {}
shadertfParams = {}
shadervParams = {}

Inheritance diagram of CustomShader, DeclutteringShader, OpacityPeelingShader, OutlineShader, PlaneIntersectingShader, SphereCarvingShader, ChromaDepthShader

ChromaDepthShader Class

class ChromaDepthShader(shaderPropertyNode, volumeNode=None)

Bases: PRISMRenderingShaders.CustomShader.CustomShader

classmethod GetBasicDescription()

Function to get a basic description of the current shader.

Returns:Description of the current shader.
Return type:str
classmethod GetDisplayName()

Function to get the name of the current class.

Returns:Name of the current class.
Return type:str
getVolumeRange(volumeNode)

Function to get the range of the current volume.

Parameters:volumeNode (vtkMRMLScalarVolumeNode) – Current volume.
Return Range:Range of the current volume.
Rtype Range:float
setupShader()

Function to setup the shader.

shaderrParams = {'depthRange': {'defaultValue': [0.0, 1.0], 'displayName': 'Depth Range'}}
shadertfParams = {'scalarColorMapping': {'defaultColors': [[0, 1, 0, 0, 0.5, 0], [300, 0, 0, 1, 0.5, 0]], 'displayName': 'Scalar Color Mapping', 'type': 'color'}, 'scalarOpacityMapping': {'defaultColors': [], 'displayName': 'Scalar Opacity Mapping', 'type': 'scalarOpacity'}}

CustomShader Class

class CustomShader(shaderPropertyNode, volumeNode=None)

Bases: object

classmethod GetAllShaderClassNames()

Function to get the class names of all of the shaders.

Returns:Names of all the classes.
Return type:array[str]
classmethod GetBasicDescription()

Function to get a basic description of the current shader.

Returns:Description of the current shader.
Return type:str
classmethod GetClass(shaderName)

Function to get a class from it’s name.

Returns:Class.
Return type:cls
classmethod GetClassName(shaderDisplayName)

Function to get a class from it’s display name.

Returns:Class.
Return type:cls
classmethod GetDisplayName()

Function to get the name of the current class.

Returns:Name of the current class.
Return type:str
classmethod InstanciateCustomShader(shaderDisplayName, shaderPropertyNode, volumeNode)

Function to instanciate a custom shader.

Parameters:
  • shaderDisplayName (str) – Display name of the shader.
  • shaderPropertyNode (vtkMRMLShaderPropertyNode) – Shader property node.
  • volumeNode (vtkMRMLScalarVolumeNode) – Current volume.
clear()

Function to clear the shader.

getParameterNames()

Function to get the shader parameter names.

Returns:Shader parameter names.
Return type:array[str]
getShaderParameter(paramName, paramType)

Function to get the parameters of the shader.

Parameters:
  • paramName (str) – Name of the parameter.
  • paramType (str) – Type of the parameter.
Returns:

Value of the parameter.

Return type:

int|float|str

getShaderPropertyNode()

Function to get the shader property node of the shader.

Returns:Property node of the shader.
Return type:vtkMRMLShaderPropertyNode
getVolumeRange()

Function to get the range of the current volume.

Returns:Range of the current volume.
Return type:float.
classmethod hasShaderParameter(name, paramType)

Function to check if a parameter is in the shader.

Parameters:
  • name (str) – Name of the parameter.
  • paramType (str) – Type of the parameter.
Returns:

Parameter is in the shader.

Return type:

bool

setAllUniforms()

Function to set the uniforms of the shader.

setPathEnds(entry, target)
setShaderParameter(paramName, paramValue, paramType)

Function to set the parameters of the shader.

Parameters:
  • paramName (str) – Name of the parameter.
  • paramType (str) – Type of the parameter.
  • paramValue (int|float|str) – Value of the parameter.
setupShader()

Function to setup the shader.

shader4fParams = {}
shaderbParams = {}
shaderfParams = {}
shaderiParams = {}
shaderrParams = {}
shadertfParams = {}
shadervParams = {}

Decluttering Class

class DeclutteringShader(shaderPropertyNode, volumeNode=None)

Bases: PRISMRenderingShaders.CustomShader.CustomShader

classmethod GetBasicDescription()

Function to get a basic description of the current shader.

Returns:Description of the current shader.
Return type:str
classmethod GetDisplayName()

Function to get the name of the current class.

Returns:Name of the current class.
Return type:str
setupShader()

Function to setup the shader.

shader4fParams = {}
shaderbParams = {}
shaderfParams = {}
shaderiParams = {}
shaderrParams = {}
shadertfParams = {}
shadervParams = {'distancetoAVM': {'defaultVolume': 1, 'displayName': 'Distance to AVM', 'transferFunctions': {'scalarColorMapping': {'defaultColors': [], 'displayName': 'Scalar Color Mapping', 'type': 'color'}, 'scalarOpacityMapping': {'defaultColors': [], 'displayName': 'Scalar Opacity Mapping', 'type': 'scalarOpacity'}}}}

OpacityPeelingShader Class

class OpacityPeelingShader(shaderPropertyNode, volumeNode=None)

Bases: PRISMRenderingShaders.CustomShader.CustomShader

classmethod GetBasicDescription()

Function to get a basic description of the current shader.

Returns:Description of the current shader.
Return type:str
classmethod GetDisplayName()

Function to get the name of the current class.

Returns:Name of the current class.
Return type:str
setupShader()

Function to setup the shader.

shader4fParams = {'center': {'defaultValue': {'w': 0.0, 'x': 0.0, 'y': 0.0, 'z': 0.0}, 'displayName': 'Center'}}
shaderbParams = {'sphere': {'defaultValue': 0, 'displayName': 'Sphere Carving', 'optionalWidgets': ['center', 'radius']}}
shaderfParams = {'T_high': {'defaultValue': 0.8, 'displayName': 'High Threshold', 'max': 1.0, 'min': 0.01}, 'T_low': {'defaultValue': 0.3, 'displayName': 'Low Threshold', 'max': 1.0, 'min': 0.0}, 'radius': {'defaultValue': 75.0, 'displayName': 'Sphere Radius', 'max': 150.0, 'min': 0.0}}
shaderiParams = {'wantedLayer': {'defaultValue': 1.0, 'displayName': 'Wanted Layer', 'max': 20.0, 'min': 1.0}}

OutlineShader Class

class OutlineShader(shaderPropertyNode, volumeNode=None)

Bases: PRISMRenderingShaders.CustomShader.CustomShader

classmethod GetBasicDescription()

Function to get a basic description of the current shader.

Returns:Description of the current shader.
Return type:str
classmethod GetDisplayName()

Function to get the name of the current class.

Returns:Name of the current class.
Return type:str
setupShader()

Function to setup the shader.

shaderfParams = {'gradStep': {'defaultValue': 0.005, 'displayName': 'Gradient Step', 'max': 0.02, 'min': 0.0}}
shaderrParams = {'step': {'defaultValue': [0.0, 150], 'displayName': 'Step'}}

PlaneIntersectingShader Class

class PlaneIntersectingShader(shaderPropertyNode, volumeNode=None)

Bases: PRISMRenderingShaders.CustomShader.CustomShader

classmethod GetBasicDescription()

Function to get a basic description of the current shader.

Returns:Description of the current shader.
Return type:str
classmethod GetDisplayName()

Function to get the name of the current class.

Returns:Name of the current class.
Return type:str
setupShader()

Function to setup the shader.

shader4fParams = {'entry': {'defaultValue': {'w': 0.0, 'x': 0.0, 'y': 0.0, 'z': 0.0}, 'displayName': 'Entry'}, 'target': {'defaultValue': {'w': 0.0, 'x': 0.0, 'y': 0.0, 'z': 0.0}, 'displayName': 'Target'}}
shaderbParams = {'plane': {'defaultValue': 0, 'displayName': 'Third Plane', 'optionalWidgets': []}}
shaderfParams = {'relativePosition': {'defaultValue': 1.0, 'displayName': 'Relative Position', 'max': 1.0, 'min': 0.0}}

SphereCarvingShader Class

class SphereCarvingShader(shaderPropertyNode, volumeNode=None)

Bases: PRISMRenderingShaders.CustomShader.CustomShader

classmethod GetBasicDescription()

Function to get a basic description of the current shader.

Returns:Description of the current shader.
Return type:str
classmethod GetDisplayName()

Function to get the name of the current class.

Returns:Name of the current class.
Return type:str
setupShader()

Function to setup the shader.

shader4fParams = {'center': {'defaultValue': {'w': 0.0, 'x': 0.0, 'y': 0.0, 'z': 0.0}, 'displayName': 'Center'}}
shaderfParams = {'radius': {'defaultValue': 50.0, 'displayName': 'Radius', 'max': 100.0, 'min': 0.0}}