pyg4ometry.visualisation.VtkViewerNew

Classes

VtkViewerNew

VtkViewerColouredNew

Visualiser that extends VtkViewer. Uses "flat" interpolation and introduces control over colours.

VtkViewerColouredMaterialNew

Extension of VtkViewerColoured that uses a default material dictionary for

MouseInteractorNamePhysicalVolume

Module Contents

class pyg4ometry.visualisation.VtkViewerNew.VtkViewerNew

Bases: pyg4ometry.visualisation.ViewerBase

cutterOrigins
cutterNormals
bClipper = False
bClipperCutter = False
clipperOrigin = None
clipperNormal = None
clipperPlaneWidget = None
initVtk()
clear()
addAxes(length=20.0, origin=(0, 0, 0))

Add x,y,z axis to the scene.

Parameters:
  • length – float - length of each axis in mm

  • origin – (float,float,float) - (x,y,z) of origin in mm

setAxes(iAxes, length, origin)
addAxesWidget()
addCutter(name, origin, normal)
setCutter(name, origin, normal)
addCutterWidget()
exportCutter(name, fileName)
getCutterPolydata(name)
addClipper(origin, normal, bClipperCutter=False, bClipperCloseCuts=True)
setClipper(origin, normal)
addClipperWidget()
updateClipperPlaneCallback(obj, event)
_polydata2Actor(polydata)
buildPipelines()
buildPipelinesSeparate()
buildPipelinesAppend()
buildPipelinesTransformed()
render()
view(interactive=True, resetCamera=False)
__repr__()
addTracks(pd)
addScoringMesh(gd)
class pyg4ometry.visualisation.VtkViewerNew.VtkViewerColouredNew(*args, defaultColour=None, materialVisOptions=None, **kwargs)

Bases: VtkViewerNew

Visualiser that extends VtkViewer. Uses “flat” interpolation and introduces control over colours.

Keyword Arguments:
  • materialVisOptions: {“materialName”: VisualisationOptions or list or tuple, …}

  • interpolation (str): see VtkViewer

  • defaultColour (str): “random” or [r,g,b]

Examples:

>>> vMaterialMap = VtkViewerColoured(materialVisOptions={"G4_WATER":[0,0,1]})
>>> vRandom = VtkViewerColoured(defaultColour="random")
>>> vColoured = VtkViewerColoured(defaultColour=[0.1,0.1,0.1])
>>> vColourAlpha = VtkViewerColoured(defaultColour=[0.1,0.1,0.1,0.5])

of use visualisation options instances

>>> vo = pyg4ometry.visualisation.VisualisationOptions()
>>> vo.colour = [0.1,1.0,0.5]
>>> vo.alpha = 0.3
>>> options = {'G4_WATER':vo}
>>> vis = VtkViewerColoured(materialVisOptions=options)

If the value in the materialVisOptions is a list or a tuple, it will be upgraded to a VisualisationOptions instance.

_defaultVis
randomColour
_getDefaultVis(pv)
class pyg4ometry.visualisation.VtkViewerNew.VtkViewerColouredMaterialNew(*args, **kwargs)

Bases: VtkViewerColouredNew

Extension of VtkViewerColoured that uses a default material dictionary for several common materials. Material colours are in defined Colour.py for many Geant4, FLUKA and BDSIM materials.

class pyg4ometry.visualisation.VtkViewerNew.MouseInteractorNamePhysicalVolume(renderer, vtkviewer)

Bases: vtk.vtkInteractorStyleTrackballCamera

ren
vtkviewer
highLightActor = None
highLightTextActor = None
removeHighLight()
removeHighLightText()
rightButtonPressEvent(obj, event)