pyVTK Wrapper¶
This is a wrapper for python-vtk. You can utilize these methods to render other point data as well.
- class vtk_vis.vtk_render[source]¶
Bases:
object
Base class for the vtk wrapper.
- draw_arrow(p1, p2, shaft_r=0.01, tip_r=0.05, tip_l=0.2, balls=0, ball_color=[1, 1, 1], ball_r=1, color=[1, 1, 1])[source]¶
- draw_cube(center, size, color=[1, 1, 1])[source]¶
Draw a cube in the scene.
- Parameters
center (list or np.ndarray) – Center of the box in 3D space.
size (float) – How large the box should be on a side.
color (list, optional) – Color of the outline in RGB.
- draw_sphere(pos, r, color=[1, 1, 1], opacity=1, res=12)[source]¶
Draw a sphere in the scene.
- Parameters
center (list or np.ndarray) – Center of the sphere in 3D space.
r (float) – Radius of the sphere.
color (list, optional) – Color of the sphere in RGB.
opacity (float, optional) – Transparency of the sphere.
res (int, optional) – Resolution of the sphere.
- place_label(pos, text, text_color=[1, 1, 1], text_font_size=12, label_box_color=[0, 0, 0], label_box=1, label_box_opacity=0.8)[source]¶
Place a label in the scene.
- Parameters
pos (tuple or np.ndarray) – Position in 3D space where to place the label.
text (str) – Label text.
text_color (list or np.ndarray, optional) – Color of the label text in RGB.
text_font_size (int, optional) – Text size of the label.
label_box_color (list or np.ndarray, optional) – Background color of the label box in RGB.
label_box (int, optional) – 0=do not show the label box, 1=show the label box.
label_box_opacity (float, optional) – Opacity value of the background box (1=no transparency).
- point_render(pos, color=[1, 1, 1], opacity=1, alpha=1, psize=1)[source]¶
Render a pointcloud in the scene.
- Parameters
pos (np.ndarray) – 3D positions of points.
color (list or np.ndarray, optional) – Color of points. This can be a single RGB value or a list of RGB values (one per point).
opacity (float, optional) – Transparency of the points.
alpha (float, optional) – Transparency of the points (same as opacity).
psize (int, optional) – Size of the points.
- render(xsize=800, ysize=800, bg_color=[0.5, 0.5, 0.5], focal_point=None, orient_widget=1)[source]¶
Final call to render the window.
- Parameters
xsize (int, optional) – Horizontal size of the window in pixels.
ysize (int, optional) – Vertical size of the window in pixels.
bg_color (tuple or np.array, optional) – Background color in RGB.
focal_point (tuple or np.array, optional) – Where to focus the camera on rendering.
orient_widget (int, optional) – Show the orient widget?