Documentation for vtk_visualizer

plot3d

Helper functions for easy visualization of point clouds

vtk_visualizer.plot3d.get_vtk_control()

Get the vtk control currently used by the plot3d functions

vtk_visualizer.plot3d.is_hold_enabled()

Returns whether hold is enabled

vtk_visualizer.plot3d.plothh(pts, scale=5.0)

Plot hedge hog (points w/ normals) from given NumPy array of Nx6 values

vtk_visualizer.plot3d.plotxyz(pts)

Plot a supplied point cloud (NumPy array of Nxd values where d>=3)

The supplied array may have an additional column with scalars, which will be used to color the points (0=black, 1=white)

vtk_visualizer.plot3d.plotxyzrgb(pts)

Plot a supplied point cloud w/ color (NumPy array of Nx6 values)

vtk_visualizer.plot3d.vtkhold(flag=True)

Toggle whether new objects will replace previous objects in the visualizer

VTKVisualizerControl

class vtk_visualizer.VTKVisualizerControl

Class for easy visualization of point clouds and geometric primitives

AddActor(actor)

Add a supplied vtkActor object to the visualizer

AddAxesActor(length)

Add coordinate system axes with specified length

AddBox(bounds)

Add a box witih the given bounds=[xmin,xmax,ymin,ymax,zmin,zmax]

AddColoredPointCloudActor(pc)

Add a point cloud with colors from a given NumPy array

The NumPy array should have dimension Nx6 where the first three dimensions correspond to X, Y and Z and the last three dimensions correspond to R, G and B values (between 0 and 255)

AddCylinder(origin, r, h)

Add a cylinder with given origin (x,y,z), radius r and height h

AddHedgeHogActor(pc, scale)

Add shaded points with surface normals to the visualizer

The input is a NumPy array with dimension Nx6 with (x,y,z) and (nx,ny,nz) values for the points and associated surface normals

The normals will be scaled according to given scale factor

AddHedgeHogActorWithScalars(pc, scale)

Add shaded points with surface normals and scalars to the visualizer

The input is a NumPy array with dimension Nx7 with (x,y,z), (nx,ny,nz) and scalar (the last dimension contains the scalars)

The normals will be scaled according to given scale factor

AddNormalsActor(pc, scale)

Add a set of surface normals to the visualizer

The input is a NumPy array with dimension Nx6 with (x,y,z) and (nx,ny,nz) values for the points and associated surface normals

The normals will be scaled according to given scale factor

AddPLYActor(filename)

Load a mesh from a PLY file and add it to the visualizer

AddPlane(normal=None, origin=None)

Add a plane (optionally with a given normal vector and origin)

Note: SetActorScale can be used to scale the extent of the plane

AddPointCloudActor(pc)

Add a point cloud from a given NumPy array

The NumPy array should have dimension Nxd where d >= 3

If d>3, the points will be colored according to the last column in the supplied array (values should be between 0 and 1, where 0 is black and 1 is white)

AddPolyDataMeshActor(pd)

Add a supplied vtkPolyData object to the visualizer

AddSTLActor(filename)

Load a mesh from an STL file and add it to the visualizer

AddShadedPointsActor(pc)

Add a point cloud with shaded points based on supplied normal vectors

The NumPy array should have dimension Nx6 where the first three dimensions correspond to x, y and z and the last three dimensions correspond to surface normals (nx, ny, nz)

AddSphere(origin, r)

Add a sphere with given origin (x,y,z) and radius r

Close()

Close the visualization widget

GetActor(idx)

Get the actor add the specified location

GetLastActor()

Get the actor last added to the visualizer

GetLastActorID()

Get the ID of the last actor added to the visualizer

GetNumberOfActors()

Get the number of actors added to visualizer

RemoveAllActors()

Remove all actors from the visualizer

RemoveLastActor()

Remove the last added actor from the visualizer

Render()

Render all objects

ResetCamera()

Reset the camera to fit contents

ScreenShot(filename)

Create a screenshot of the visualizer in BMP format

SetActorColor(idx, rgb)

Set the color of the specified actor index

rgb is a tuple of (r,g,b) values in the range 0..1

SetActorOpacity(idx, opacity)

Set the opacity (0..1) of the specified actor index

SetActorScale(idx, scale)

Set the scale of supplied actor index (tuple of 3 values)

SetActorTransform(idx, T)

Set the pose (location and orientation) of the specified actor index

T is a 4x4 NumPy array containing rotation matrix and translation vector

SetActorVisibility(idx, visibility)

Toggle visibility of the specified actor index on or of

SetWindowBackground(r, g, b)

Set the background color of the visualizer to given R, G and B color

Table Of Contents

This Page