![]() |
0.1.33
|
High-level interface for 3D visualization and rendering. More...
High-level interface for 3D visualization and rendering.
This class provides a user-friendly wrapper around the native Helios visualizer plugin with automatic plugin availability checking and graceful error handling.
The visualizer provides OpenGL-based 3D rendering with interactive controls, image export, and comprehensive scene configuration options.
Definition at line 136 of file Visualizer.py.
Public Member Functions | |
| __init__ (self, int width, int height, int antialiasing_samples=4, bool headless=False) | |
| Initialize Visualizer with graceful plugin handling. | |
| __enter__ (self) | |
| Context manager entry. | |
| __exit__ (self, exc_type, exc_value, traceback) | |
| Context manager exit with proper cleanup. | |
| None | buildContextGeometry (self, Context context, Optional[List[int]] uuids=None) |
| Build Context geometry in the visualizer. | |
| None | plotInteractive (self) |
| Open interactive visualization window. | |
| None | plotUpdate (self) |
| Update visualization (non-interactive). | |
| None | printWindow (self, str filename, Optional[str] image_format=None) |
| Save current visualization to image file. | |
| None | closeWindow (self) |
| Close visualization window. | |
| None | setCameraPosition (self, vec3 position, vec3 lookAt) |
| Set camera position using Cartesian coordinates. | |
| None | setCameraPositionSpherical (self, SphericalCoord angle, vec3 lookAt) |
| Set camera position using spherical coordinates. | |
| None | setBackgroundColor (self, RGBcolor color) |
| Set background color. | |
| None | setBackgroundTransparent (self) |
| Enable transparent background mode (v1.3.53+). | |
| None | setBackgroundImage (self, str texture_file) |
| Set custom background image texture (v1.3.53+). | |
| None | setBackgroundSkyTexture (self, Optional[str] texture_file=None, int divisions=50) |
| Set sky sphere texture background with automatic scaling (v1.3.53+). | |
| None | setLightDirection (self, vec3 direction) |
| Set light direction. | |
| None | setLightingModel (self, Union[int, str] lighting_model) |
| Set lighting model. | |
| None | colorContextPrimitivesByData (self, str data_name, Optional[List[int]] uuids=None) |
| Color context primitives based on primitive data values. | |
| None | setCameraFieldOfView (self, float angle_FOV) |
| Set camera field of view angle. | |
| Tuple[vec3, vec3] | getCameraPosition (self) |
| Get current camera position and look-at point. | |
| RGBcolor | getBackgroundColor (self) |
| Get current background color. | |
| None | setLightIntensityFactor (self, float intensity_factor) |
| Set light intensity scaling factor. | |
| Tuple[int, int] | getWindowSize (self) |
| Get window size in pixels. | |
| Tuple[int, int] | getFramebufferSize (self) |
| Get framebuffer size in pixels. | |
| None | printWindowDefault (self) |
| Print window with default filename. | |
| None | displayImageFromPixels (self, List[int] pixel_data, int width, int height) |
| Display image from RGBA pixel data. | |
| None | displayImageFromFile (self, str filename) |
| Display image from file. | |
| None | displayImageWithBoundingBoxes (self, str image_file, str bbox_file, str classes_file="", float line_width=2.0, int fontsize=12) |
| Display an image with YOLO bounding boxes overlaid. | |
| None | displayImageWithSegmentationMasks (self, str image_file, str mask_file, float fill_opacity=0.4, float line_width=2.0, int fontsize=12, bool show_labels=True) |
| Display an image with COCO segmentation masks overlaid. | |
| None | enableExactColorMode (self) |
| Render primitive colors exactly as they are set in the Context. | |
| None | disableExactColorMode (self) |
| Restore the default brightening of primitive colors. | |
| None | enableLinearPipeline (self) |
| Enable the physically-based linear-light rendering pipeline. | |
| None | disableLinearPipeline (self) |
| Disable the linear-light pipeline, shading directly in sRGB space. | |
| bool | isLinearPipelineEnabled (self) |
| Check whether the linear-light rendering pipeline is enabled. | |
| None | setExposure (self, float exposure) |
| Set the linear exposure multiplier applied before tone mapping. | |
| float | getExposure (self) |
| Get the linear exposure multiplier applied before tone mapping. | |
| None | setPhongMaterial (self, float ambient, float diffuse, float specular, float shininess) |
| Set the Phong material parameters used to shade Context primitives. | |
| Tuple[float, float, float, float] | getPhongMaterial (self) |
| Get the Phong material parameters used to shade Context primitives. | |
| None | setAmbientColors (self, RGBcolor sky_color, RGBcolor ground_color) |
| Set the hemispheric ambient sky and ground-bounce colors. | |
| RGBcolor | getAmbientSkyColor (self) |
| Get the hemispheric ambient sky color. | |
| RGBcolor | getAmbientGroundColor (self) |
| Get the hemispheric ambient ground-bounce color. | |
| None | enableSmoothShading (self) |
| Enable smooth per-vertex-normal shading. | |
| None | disableSmoothShading (self) |
| Select flat (per-face) shading. | |
| bool | isSmoothShadingEnabled (self) |
| Check whether smooth per-vertex-normal shading is enabled. | |
| bool | isHeadlessMultisamplingActive (self) |
| Check whether headless rendering obtained multisampled framebuffer attachments. | |
| vec2 | getTextboxSize (self, str textstring, int fontsize, str fontname) |
| Measure the rendered size of a text string without adding it to the visualizer. | |
| getWindowPixelsRGB (self, Optional[List[int]] buffer=None) | |
| Get RGB pixel data from the current window. | |
| Tuple[List[float], int, int] | getDepthMap (self) |
| Get depth map from current window. | |
| None | plotDepthMap (self) |
| Plot depth map visualization. | |
| None | clearGeometry (self) |
| Clear all geometry from visualizer. | |
| None | clearContextGeometry (self) |
| Clear context geometry from visualizer. | |
| None | deleteGeometry (self, int geometry_id) |
| Delete specific geometry by ID. | |
| None | updateContextPrimitiveColors (self) |
| Update context primitive colors. | |
| List[vec3] | getGeometryVertices (self, int geometry_id) |
| Get vertices of a geometry primitive. | |
| None | setGeometryVertices (self, int geometry_id, List[vec3] vertices) |
| Set vertices of a geometry primitive. | |
| None | addCoordinateAxes (self) |
| Add coordinate axes at origin with unit length. | |
| None | addCoordinateAxesCustom (self, vec3 origin, vec3 length, str sign="both") |
| Add coordinate axes with custom properties. | |
| None | disableCoordinateAxes (self) |
| Remove coordinate axes. | |
| None | addGridWireFrame (self, vec3 center, vec3 size, List[int] subdivisions) |
| Add grid wireframe. | |
| None | enableColorbar (self) |
| Enable colorbar. | |
| None | disableColorbar (self) |
| Disable colorbar. | |
| None | setColorbarPosition (self, vec3 position) |
| Set colorbar position. | |
| None | setColorbarSize (self, float width, float height) |
| Set colorbar size. | |
| None | setColorbarRange (self, float min_val, float max_val) |
| Set colorbar range. | |
| None | setColorbarTicks (self, List[float] ticks) |
| Set colorbar tick marks. | |
| None | setColorbarTitle (self, str title) |
| Set colorbar title. | |
| None | setColorbarFontColor (self, RGBcolor color) |
| Set colorbar font color. | |
| None | setColorbarFontSize (self, int font_size) |
| Set colorbar font size. | |
| None | setColormap (self, Union[int, str] colormap) |
| Set predefined colormap. | |
| None | setCustomColormap (self, List[RGBcolor] colors, List[float] divisions) |
| Set custom colormap. | |
| None | colorContextPrimitivesByObjectData (self, str data_name, Optional[List[int]] obj_ids=None) |
| Color context primitives by object data. | |
| None | colorContextPrimitivesRandomly (self, Optional[List[int]] uuids=None) |
| Color context primitives randomly. | |
| None | colorContextObjectsRandomly (self, Optional[List[int]] obj_ids=None) |
| Color context objects randomly. | |
| None | clearColor (self) |
| Clear primitive colors from previous coloring operations. | |
| None | hideWatermark (self) |
| Hide Helios logo watermark. | |
| None | showWatermark (self) |
| Show Helios logo watermark. | |
| None | updateWatermark (self) |
| Update watermark geometry to match current window size. | |
| None | hideNavigationGizmo (self) |
| Hide navigation gizmo (coordinate axes indicator in corner). | |
| None | showNavigationGizmo (self) |
| Show navigation gizmo (coordinate axes indicator in corner). | |
| None | enableMessages (self) |
| Enable standard output from visualizer plugin. | |
| None | disableMessages (self) |
| Disable standard output from visualizer plugin. | |
| None | plotOnce (self, bool get_keystrokes=True) |
| Run one rendering loop. | |
| None | plotUpdateWithVisibility (self, bool hide_window=False) |
| Update visualization with window visibility control. | |
| None | setPointCullingEnabled (self, bool enabled) |
| Enable or disable point cloud culling optimization. | |
| None | setPointCullingThreshold (self, int threshold) |
| Set the minimum number of points required to trigger culling. | |
| None | setPointMaxRenderDistance (self, float distance) |
| Set the maximum rendering distance for points. | |
| None | setPointLODFactor (self, float factor) |
| Set the level-of-detail factor for distance-based culling. | |
| dict | getPointRenderingMetrics (self) |
| Get point cloud rendering performance metrics. | |
| __del__ (self) | |
| Destructor to ensure proper cleanup. | |
Public Attributes | |
| width = width | |
| height = height | |
| antialiasing_samples = antialiasing_samples | |
| headless = headless | |
| visualizer = None | |
Static Public Attributes | |
| int | LIGHTING_NONE = 0 |
| int | LIGHTING_PHONG = 1 |
| int | LIGHTING_PHONG_SHADOWED = 2 |
| int | COLORMAP_HOT = 0 |
| int | COLORMAP_COOL = 1 |
| int | COLORMAP_RAINBOW = 2 |
| int | COLORMAP_LAVA = 3 |
| int | COLORMAP_PARULA = 4 |
| int | COLORMAP_GRAY = 5 |
Protected Member Functions | |
| _check_context_alive (self) | |
| Raise if a Context was loaded and has since been destroyed. | |
Protected Attributes | |
| _context | |
| pyhelios.Visualizer.Visualizer.__init__ | ( | self, | |
| int | width, | ||
| int | height, | ||
| int | antialiasing_samples = 4, | ||
| bool | headless = False ) |
Initialize Visualizer with graceful plugin handling.
| width | Window width in pixels |
| height | Window height in pixels |
| antialiasing_samples | Number of antialiasing samples (default: 4). Pass 0 to disable antialiasing, which is required for exact color reproduction – see :meth:enableExactColorMode. |
| headless | Enable headless mode for offscreen rendering (default: False) |
| VisualizerError | If visualizer plugin is not available |
| ValueError | If parameters are invalid |
Definition at line 166 of file Visualizer.py.
| pyhelios.Visualizer.Visualizer.__del__ | ( | self | ) |
Destructor to ensure proper cleanup.
Definition at line 2732 of file Visualizer.py.
| pyhelios.Visualizer.Visualizer.__enter__ | ( | self | ) |
Context manager entry.
Definition at line 266 of file Visualizer.py.
| pyhelios.Visualizer.Visualizer.__exit__ | ( | self, | |
| exc_type, | |||
| exc_value, | |||
| traceback ) |
Context manager exit with proper cleanup.
Definition at line 270 of file Visualizer.py.
|
protected |
Raise if a Context was loaded and has since been destroyed.
Definition at line 261 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.addCoordinateAxes | ( | self | ) |
Add coordinate axes at origin with unit length.
| VisualizerError | If operation fails |
Definition at line 1885 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.addCoordinateAxesCustom | ( | self, | |
| vec3 | origin, | ||
| vec3 | length, | ||
| str | sign = "both" ) |
Add coordinate axes with custom properties.
| origin | Axes origin position |
| length | Axes length in each direction |
| sign | Axis direction ("both" or "positive") |
| ValueError | If parameters are invalid |
| VisualizerError | If operation fails |
Definition at line 1906 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.addGridWireFrame | ( | self, | |
| vec3 | center, | ||
| vec3 | size, | ||
| List[int] | subdivisions ) |
Add grid wireframe.
| center | Grid center position |
| size | Grid size in each direction |
| subdivisions | Grid subdivisions [x, y, z] |
| ValueError | If parameters are invalid |
| VisualizerError | If operation fails |
Definition at line 1951 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.buildContextGeometry | ( | self, | |
| Context | context, | ||
| Optional[List[int]] | uuids = None ) |
Build Context geometry in the visualizer.
This method loads geometry from a Helios Context into the visualizer for rendering. If no UUIDs are specified, all geometry is loaded.
| context | Helios Context instance containing geometry |
| uuids | Optional list of primitive UUIDs to visualize (default: all) |
| VisualizerError | If geometry building fails |
| ValueError | If parameters are invalid |
Definition at line 296 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.clearColor | ( | self | ) |
Clear primitive colors from previous coloring operations.
| VisualizerError | If operation fails |
Definition at line 2368 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.clearContextGeometry | ( | self | ) |
Clear context geometry from visualizer.
| VisualizerError | If operation fails |
Definition at line 1756 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.clearGeometry | ( | self | ) |
Clear all geometry from visualizer.
To animate a changing Context, just call buildContextGeometry() and plotUpdate() each frame without clearing; additions, deletions and modifications are all picked up automatically.
| VisualizerError | If operation fails |
Definition at line 1741 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.closeWindow | ( | self | ) |
Close visualization window.
This method closes any open visualization window. It's safe to call even if no window is open.
| VisualizerError | If window closing fails |
Definition at line 475 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.colorContextObjectsRandomly | ( | self, | |
| Optional[List[int]] | obj_ids = None ) |
Color context objects randomly.
| obj_ids | Optional list of object IDs to color (None for all) |
| ValueError | If object IDs are invalid |
| VisualizerError | If operation fails |
Definition at line 2341 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.colorContextPrimitivesByData | ( | self, | |
| str | data_name, | ||
| Optional[List[int]] | uuids = None ) |
Color context primitives based on primitive data values.
This method maps primitive data values to colors using the current colormap. The visualization will be updated to show data variations across primitives. The data must have been previously set on the primitives in the Context using context.setPrimitiveDataFloat(UUID, data_name, value) before calling this method.
| data_name | Name of the primitive data to use for coloring. This should match the data label used with setPrimitiveDataFloat(). |
| uuids | Optional list of specific primitive UUIDs to color. If None, all primitives in context will be colored. |
| VisualizerError | If visualizer is not initialized or operation fails |
| ValueError | If data_name is invalid or UUIDs are malformed |
Definition at line 768 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.colorContextPrimitivesByObjectData | ( | self, | |
| str | data_name, | ||
| Optional[List[int]] | obj_ids = None ) |
Color context primitives by object data.
| data_name | Name of object data to use for coloring |
| obj_ids | Optional list of object IDs to color (None for all) |
| ValueError | If parameters are invalid |
| VisualizerError | If operation fails |
Definition at line 2276 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.colorContextPrimitivesRandomly | ( | self, | |
| Optional[List[int]] | uuids = None ) |
Color context primitives randomly.
| uuids | Optional list of primitive UUIDs to color (None for all) |
| ValueError | If UUIDs are invalid |
| VisualizerError | If operation fails |
Definition at line 2310 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.deleteGeometry | ( | self, | |
| int | geometry_id ) |
Delete specific geometry by ID.
| geometry_id | ID of geometry to delete |
| ValueError | If geometry ID is invalid |
| VisualizerError | If operation fails |
Definition at line 1775 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.disableColorbar | ( | self | ) |
Disable colorbar.
| VisualizerError | If operation fails |
Definition at line 1995 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.disableCoordinateAxes | ( | self | ) |
Remove coordinate axes.
| VisualizerError | If operation fails |
Definition at line 1930 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.disableExactColorMode | ( | self | ) |
Restore the default brightening of primitive colors.
This also restores the linear-light pipeline (see :meth:`enableLinearPipeline`).
| VisualizerError | If the operation fails |
Definition at line 1184 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.disableLinearPipeline | ( | self | ) |
Disable the linear-light pipeline, shading directly in sRGB space.
This reproduces the rendering behavior of helios-core versions before 1.3.83.
| VisualizerError | If the operation fails |
Definition at line 1226 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.disableMessages | ( | self | ) |
Disable standard output from visualizer plugin.
| VisualizerError | If operation fails |
Definition at line 2491 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.disableSmoothShading | ( | self | ) |
Select flat (per-face) shading.
Useful for alpha-masked cutout geometry such as leaf textures, where interpolated normals can look worse than a single flat normal per face.
| VisualizerError | If the operation fails |
Definition at line 1472 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.displayImageFromFile | ( | self, | |
| str | filename ) |
Display image from file.
| filename | Path to image file |
| ValueError | If filename is invalid |
| VisualizerError | If operation fails |
Definition at line 1006 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.displayImageFromPixels | ( | self, | |
| List[int] | pixel_data, | ||
| int | width, | ||
| int | height ) |
Display image from RGBA pixel data.
| pixel_data | RGBA pixel data as list of integers (0-255) |
| width | Image width in pixels |
| height | Image height in pixels |
| ValueError | If parameters are invalid |
| VisualizerError | If operation fails |
Definition at line 974 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.displayImageWithBoundingBoxes | ( | self, | |
| str | image_file, | ||
| str | bbox_file, | ||
| str | classes_file = "", | ||
| float | line_width = 2.0, | ||
| int | fontsize = 12 ) |
Display an image with YOLO bounding boxes overlaid.
Each box is drawn as a colored outline with its class name on a filled chip in the box's top-left corner. Boxes are colored by class ID from a fixed palette of seven colors, so classes whose IDs differ by a multiple of seven share a color. This reads the annotation format written by :meth:`pyhelios.RadiationModel.writeImageBoundingBoxes`.
| image_file | Path to the image file (JPEG or PNG) |
| bbox_file | Path to the YOLO-format bounding box annotation file |
| classes_file | Path to the class name file. If empty (the default), a file named "classes.txt" beside bbox_file is used when one exists; otherwise boxes are labeled with their numeric class ID. |
| line_width | Width of the box outlines in screen pixels |
| fontsize | Size of the class label font in points |
| ValueError | If a path is not a non-empty string, or a numeric argument is out of range |
| VisualizerError | If the operation fails |
displayImageFromFile, this clears any existing geometry and does not return until the window is closed.Definition at line 1048 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.displayImageWithSegmentationMasks | ( | self, | |
| str | image_file, | ||
| str | mask_file, | ||
| float | fill_opacity = 0.4, | ||
| float | line_width = 2.0, | ||
| int | fontsize = 12, | ||
| bool | show_labels = True ) |
Display an image with COCO segmentation masks overlaid.
Each mask is drawn as a translucent filled polygon with a solid outline and its class name on a filled chip. Masks are colored by their position in the file rather than by class, so two touching objects of the same class stay distinguishable. This reads the annotation format written by :meth:`pyhelios.RadiationModel.writeImageSegmentationMasks`.
| image_file | Path to the image file (JPEG or PNG) |
| mask_file | Path to the COCO JSON segmentation mask file |
| fill_opacity | Opacity of the translucent fill, between 0 and 1. A value of 0 draws the outline without a fill. |
| line_width | Width of the mask outlines in screen pixels |
| fontsize | Size of the class label font in points |
| show_labels | Whether to draw the class name chip on each mask. Pass False to see the masks alone, which helps when many overlapping chips would cover the image. |
| ValueError | If a path is not a non-empty string, or a numeric argument is out of range |
| VisualizerError | If the operation fails |
displayImageFromFile, this clears any existing geometry and does not return until the window is closed.Definition at line 1110 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.enableColorbar | ( | self | ) |
Enable colorbar.
| VisualizerError | If operation fails |
Definition at line 1980 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.enableExactColorMode | ( | self | ) |
Render primitive colors exactly as they are set in the Context.
By default the fragment shader multiplies primitive colors by 1.5, which brightens ordinary renders but means a color read back out of the framebuffer is not the color that was set. This mode disables that multiplier, which is required when the framebuffer carries data rather than an image -- for example when object IDs are encoded as RGB values and decoded from the rendered pixels. Exact reproduction additionally requires that no lighting be applied (see :meth:`setLightingModel` with ``LIGHTING_NONE``, the default) and that the Visualizer was constructed with ``antialiasing_samples=0``, since antialiasing blends colors at primitive edges and produces pixels that decode to meaningless IDs. This also disables the linear-light pipeline (see :meth:`disableLinearPipeline`), since tone mapping would likewise alter the values read back.
| VisualizerError | If the operation fails |
Definition at line 1165 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.enableLinearPipeline | ( | self | ) |
Enable the physically-based linear-light rendering pipeline.
This is the default. Albedo is decoded from sRGB to linear light before shading, and the shaded radiance is tone-mapped through an ACES filmic curve and re-encoded to sRGB. Compared with shading directly on non-linear sRGB values, mid-tones are brighter, shadow terminators are smoother, and bright surfaces roll off rather than clipping flat against the 8-bit framebuffer.
| VisualizerError | If the operation fails |
Definition at line 1207 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.enableMessages | ( | self | ) |
Enable standard output from visualizer plugin.
| VisualizerError | If operation fails |
Definition at line 2476 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.enableSmoothShading | ( | self | ) |
Enable smooth per-vertex-normal shading.
This is the default. Only geometry that supplies distinct vertex normals is affected Sphere, Tube and Cone objects, and Polymesh objects loaded from an OBJ or PLY file that carries them. Patches, triangles and voxels added directly to the Context carry the face normal replicated across their vertices and render identically either way.
| VisualizerError | If the operation fails |
Definition at line 1452 of file Visualizer.py.
| RGBcolor pyhelios.Visualizer.Visualizer.getAmbientGroundColor | ( | self | ) |
Get the hemispheric ambient ground-bounce color.
| VisualizerError | If the operation fails |
Definition at line 1428 of file Visualizer.py.
| RGBcolor pyhelios.Visualizer.Visualizer.getAmbientSkyColor | ( | self | ) |
Get the hemispheric ambient sky color.
| VisualizerError | If the operation fails |
Definition at line 1407 of file Visualizer.py.
| RGBcolor pyhelios.Visualizer.Visualizer.getBackgroundColor | ( | self | ) |
Get current background color.
| VisualizerError | If operation fails |
Definition at line 858 of file Visualizer.py.
Get current camera position and look-at point.
| VisualizerError | If operation fails |
Definition at line 833 of file Visualizer.py.
| Tuple[List[float], int, int] pyhelios.Visualizer.Visualizer.getDepthMap | ( | self | ) |
Get depth map from current window.
| VisualizerError | If operation fails |
Definition at line 1681 of file Visualizer.py.
| float pyhelios.Visualizer.Visualizer.getExposure | ( | self | ) |
Get the linear exposure multiplier applied before tone mapping.
| VisualizerError | If the operation fails |
Definition at line 1295 of file Visualizer.py.
| Tuple[int, int] pyhelios.Visualizer.Visualizer.getFramebufferSize | ( | self | ) |
Get framebuffer size in pixels.
| VisualizerError | If operation fails |
Definition at line 932 of file Visualizer.py.
| List[vec3] pyhelios.Visualizer.Visualizer.getGeometryVertices | ( | self, | |
| int | geometry_id ) |
Get vertices of a geometry primitive.
| geometry_id | Unique identifier of the geometry primitive |
| ValueError | If geometry ID is invalid |
| VisualizerError | If operation fails |
Definition at line 1823 of file Visualizer.py.
| Tuple[float, float, float, float] pyhelios.Visualizer.Visualizer.getPhongMaterial | ( | self | ) |
Get the Phong material parameters used to shade Context primitives.
| VisualizerError | If the operation fails |
Definition at line 1352 of file Visualizer.py.
| dict pyhelios.Visualizer.Visualizer.getPointRenderingMetrics | ( | self | ) |
Get point cloud rendering performance metrics.
Provides detailed statistics about point cloud culling and rendering performance, useful for optimizing visualization settings.
| VisualizerError | If operation fails |
Definition at line 2716 of file Visualizer.py.
| vec2 pyhelios.Visualizer.Visualizer.getTextboxSize | ( | self, | |
| str | textstring, | ||
| int | fontsize, | ||
| str | fontname ) |
Measure the rendered size of a text string without adding it to the visualizer.
Returns the extent that :meth:`addTextboxByCenter` would occupy for the same string, font and font size. The width is the sum of the glyph advances, so it includes the side bearings; the height is that of the tallest glyph in the string, so it depends on which characters the string contains. The ``_`` and ``^`` subscript and superscript markers are handled as :meth:`addTextboxByCenter` handles them: they occupy no width themselves and halve the size of the character that follows.
| textstring | Text to be measured |
| fontsize | Size of the text font in points |
| fontname | Name of a font in the visualizer fonts directory, e.g. "OpenSans-Regular" |
| ValueError | If an argument is invalid |
| VisualizerError | If the operation fails |
Definition at line 1565 of file Visualizer.py.
| pyhelios.Visualizer.Visualizer.getWindowPixelsRGB | ( | self, | |
| Optional[List[int]] | buffer = None ) |
Get RGB pixel data from the current window.
Data is stored as r-g-b * column * row, so indices (0,1,2) are the RGB values for row 0
column 0, indices (3,4,5) are row 0 column 1, and so on.
Call without arguments to have the buffer allocated for you at the correct size -- this is
the recommended form and cannot be undersized::
pixels, width, height = visualizer.getWindowPixelsRGB()
| buffer | Optional pre-allocated list to fill in place. It must hold exactly 3 * width * height elements, where width and height come from :meth:getFramebufferSize – not :meth:getWindowSize and not the dimensions passed to the constructor. On a high-DPI (Retina) display the framebuffer is larger than the window, typically by a factor of two per axis, so a buffer sized from the window dimensions is four times too small. |
buffer is None, a tuple of (pixel_data, width, height). Otherwise None; buffer is filled in place.| ValueError | If ``buffer`` is not a list, or is not sized for the current framebuffer |
| VisualizerError | If operation fails |
Definition at line 1617 of file Visualizer.py.
| Tuple[int, int] pyhelios.Visualizer.Visualizer.getWindowSize | ( | self | ) |
Get window size in pixels.
| VisualizerError | If operation fails |
Definition at line 909 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.hideNavigationGizmo | ( | self | ) |
Hide navigation gizmo (coordinate axes indicator in corner).
The navigation gizmo shows XYZ axes orientation and can be clicked to snap the camera to standard views (top, front, side, etc.).
| VisualizerError | If operation fails |
Definition at line 2435 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.hideWatermark | ( | self | ) |
Hide Helios logo watermark.
| VisualizerError | If operation fails |
Definition at line 2385 of file Visualizer.py.
| bool pyhelios.Visualizer.Visualizer.isHeadlessMultisamplingActive | ( | self | ) |
Check whether headless rendering obtained multisampled framebuffer attachments.
Headless rendering draws into a multisampled framebuffer using the sample count given to the constructor and resolves it before readback, so saved images are anti-aliased. The requested count is clamped to the driver maximum, and a driver that refuses the attachments falls back silently -- this query is how to detect that.
| VisualizerError | If the operation fails |
Definition at line 1525 of file Visualizer.py.
| bool pyhelios.Visualizer.Visualizer.isLinearPipelineEnabled | ( | self | ) |
Check whether the linear-light rendering pipeline is enabled.
| VisualizerError | If the operation fails |
Definition at line 1247 of file Visualizer.py.
| bool pyhelios.Visualizer.Visualizer.isSmoothShadingEnabled | ( | self | ) |
Check whether smooth per-vertex-normal shading is enabled.
| VisualizerError | If the operation fails |
Definition at line 1493 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.plotDepthMap | ( | self | ) |
Plot depth map visualization.
| VisualizerError | If operation fails |
Definition at line 1711 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.plotInteractive | ( | self | ) |
Open interactive visualization window.
This method opens a window with the current scene and allows user interaction (camera rotation, zooming, etc.). The program will pause until the window is closed by the user. Interactive controls: - Mouse scroll: Zoom in/out - Left mouse + drag: Rotate camera - Right mouse + drag: Pan camera - Arrow keys: Camera movement - +/- keys: Zoom in/out
| VisualizerError | If visualization fails, or if the Visualizer was constructed with headless=True (helios-core 1.3.85+ raises rather than driving a window that was never shown or does not exist) |
Definition at line 345 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.plotOnce | ( | self, | |
| bool | get_keystrokes = True ) |
Run one rendering loop.
Any geometry pending upload is transferred to the GPU before rendering, but unlike :meth:`plotUpdate` the Context geometry is not rebuilt. Call :meth:`buildContextGeometry` or :meth:`plotUpdate` if primitives have been added to or changed in the Context since the last render.
| get_keystrokes | Whether to process keystrokes |
| VisualizerError | If operation fails |
Definition at line 2514 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.plotUpdate | ( | self | ) |
Update visualization (non-interactive).
This method updates the visualization window without user interaction. The program continues immediately after rendering. Useful for batch processing or creating image sequences. In headless mode, automatically hides the window to prevent graphics driver crashes on some platforms.
| VisualizerError | If visualization update fails |
Definition at line 369 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.plotUpdateWithVisibility | ( | self, | |
| bool | hide_window = False ) |
Update visualization with window visibility control.
| hide_window | Whether to hide the window during update |
| VisualizerError | If operation fails |
Definition at line 2532 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.printWindow | ( | self, | |
| str | filename, | ||
| Optional[str] | image_format = None ) |
Save current visualization to image file.
This method exports the current visualization to an image file. Starting from v1.3.53, supports both JPEG and PNG formats. The frame is rendered as part of the capture (helios-core 1.3.85+), so it is not necessary to call :meth:`plotUpdate` beforehand: handing the Visualizer a Context with :meth:`buildContextGeometry` and calling this straight away produces a correct image. A render is performed whenever the frame currently on the GPU is not the one that would be captured (geometry changed, the camera moved, or the navigation gizmo had to be hidden) and skipped when it would produce an identical frame, so calling :meth:`plotUpdate` first is harmless but redundant. The navigation gizmo is always absent from the captured image.
| filename | Output filename for image Can be absolute or relative to user's current working directory Extension (.jpg, .png) is recommended but not required |
| image_format | Image format - "jpeg" or "png" (v1.3.53+). If None, automatically detects from filename extension. Defaults to "jpeg" if not detectable from extension. |
| VisualizerError | If image saving fails |
| ValueError | If filename or format is invalid |
Definition at line 419 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.printWindowDefault | ( | self | ) |
Print window with default filename.
| VisualizerError | If operation fails |
Definition at line 952 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setAmbientColors | ( | self, | |
| RGBcolor | sky_color, | ||
| RGBcolor | ground_color ) |
Set the hemispheric ambient sky and ground-bounce colors.
Ambient light is blended between the two according to surface orientation: upward-facing surfaces pick up ``sky_color``, downward-facing surfaces ``ground_color``. Setting both to the same value recovers the single constant ambient term used before helios-core 1.3.83.
| sky_color | Color of light arriving from above |
| ground_color | Color of light bouncing from below |
| ValueError | If either argument is not an RGBcolor |
| VisualizerError | If the operation fails |
Definition at line 1379 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setBackgroundColor | ( | self, | |
| RGBcolor | color ) |
Set background color.
| color | Background color as RGBcolor with values in range [0, 1] |
| VisualizerError | If color setting fails |
| ValueError | If color values are invalid |
Definition at line 549 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setBackgroundImage | ( | self, | |
| str | texture_file ) |
Set custom background image texture (v1.3.53+).
| texture_file | Path to background image file Can be absolute or relative to working directory |
| VisualizerError | If background image setting fails |
| ValueError | If texture file path is invalid |
Definition at line 601 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setBackgroundSkyTexture | ( | self, | |
| Optional[str] | texture_file = None, | ||
| int | divisions = 50 ) |
Set sky sphere texture background with automatic scaling (v1.3.53+).
Creates a sky sphere that automatically scales with the scene. Replaces the deprecated addSkyDomeByCenter() method.
| texture_file | Path to spherical/equirectangular texture image If None, uses default gradient sky texture |
| divisions | Number of sphere tessellation divisions (default: 50) Higher values create smoother sphere but use more GPU |
| VisualizerError | If sky texture setting fails |
| ValueError | If parameters are invalid |
Definition at line 637 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setBackgroundTransparent | ( | self | ) |
Enable transparent background mode (v1.3.53+).
Sets the background to transparent with checkerboard pattern display. Requires PNG output format to preserve transparency.
| VisualizerError | If transparent background setting fails |
Definition at line 579 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setCameraFieldOfView | ( | self, | |
| float | angle_FOV ) |
Set camera field of view angle.
| angle_FOV | Field of view angle in degrees |
| ValueError | If angle is invalid |
| VisualizerError | If operation fails |
Definition at line 808 of file Visualizer.py.
Set camera position using Cartesian coordinates.
| position | Camera position as vec3 in world coordinates |
| lookAt | Camera look-at point as vec3 in world coordinates |
| VisualizerError | If camera positioning fails |
| ValueError | If parameters are invalid |
Definition at line 496 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setCameraPositionSpherical | ( | self, | |
| SphericalCoord | angle, | ||
| vec3 | lookAt ) |
Set camera position using spherical coordinates.
| angle | Camera position as SphericalCoord (radius, elevation, azimuth) |
| lookAt | Camera look-at point as vec3 in world coordinates |
| VisualizerError | If camera positioning fails |
| ValueError | If parameters are invalid |
Definition at line 523 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setColorbarFontColor | ( | self, | |
| RGBcolor | color ) |
Set colorbar font color.
| color | Font color |
| ValueError | If color is invalid |
| VisualizerError | If operation fails |
Definition at line 2150 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setColorbarFontSize | ( | self, | |
| int | font_size ) |
Set colorbar font size.
| font_size | Font size |
| ValueError | If font size is invalid |
| VisualizerError | If operation fails |
Definition at line 2173 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setColorbarPosition | ( | self, | |
| vec3 | position ) |
Set colorbar position.
| position | Colorbar position |
| ValueError | If position is invalid |
| VisualizerError | If operation fails |
Definition at line 2014 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setColorbarRange | ( | self, | |
| float | min_val, | ||
| float | max_val ) |
Set colorbar range.
Setting a range explicitly stops the colorbar from auto-ranging over the data, including for the degenerate range ``setColorbarRange(0, 0)``.
| min_val | Minimum value |
| max_val | Maximum value. Must be greater than or equal to min_val; helios ignores an inverted range. |
| ValueError | If range is invalid |
| VisualizerError | If operation fails |
Definition at line 2068 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setColorbarSize | ( | self, | |
| float | width, | ||
| float | height ) |
Set colorbar size.
| width | Colorbar width |
| height | Colorbar height |
| ValueError | If size is invalid |
| VisualizerError | If operation fails |
Definition at line 2038 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setColorbarTicks | ( | self, | |
| List[float] | ticks ) |
Set colorbar tick marks.
| ticks | List of tick values |
setColorbarRange after :meth:setColorbarTicks.| ValueError | If ticks are invalid |
| VisualizerError | If operation fails |
Definition at line 2100 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setColorbarTitle | ( | self, | |
| str | title ) |
Set colorbar title.
| title | Colorbar title |
| ValueError | If title is invalid |
| VisualizerError | If operation fails |
Definition at line 2128 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setColormap | ( | self, | |
| Union[int, str] | colormap ) |
Set predefined colormap.
| colormap | Colormap ID (0-5) or name ("HOT", "COOL", "RAINBOW", "LAVA", "PARULA", "GRAY") |
| ValueError | If colormap is invalid |
| VisualizerError | If operation fails |
Definition at line 2197 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setCustomColormap | ( | self, | |
| List[RGBcolor] | colors, | ||
| List[float] | divisions ) |
Set custom colormap.
| colors | List of RGB colors |
| divisions | List of division points (same length as colors) |
| ValueError | If parameters are invalid |
| VisualizerError | If operation fails |
Definition at line 2233 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setExposure | ( | self, | |
| float | exposure ) |
Set the linear exposure multiplier applied before tone mapping.
Only has an effect while the linear pipeline is enabled.
| exposure | Exposure multiplier; must be positive |
| ValueError | If exposure is not positive |
| VisualizerError | If the operation fails |
Definition at line 1270 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setGeometryVertices | ( | self, | |
| int | geometry_id, | ||
| List[vec3] | vertices ) |
Set vertices of a geometry primitive.
This allows dynamic modification of geometry shapes during visualization. Useful for animating geometry or adjusting shapes based on simulation results.
| geometry_id | Unique identifier of the geometry primitive |
| vertices | List of new vertices as vec3 objects |
| ValueError | If parameters are invalid |
| VisualizerError | If operation fails |
Definition at line 1858 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setLightDirection | ( | self, | |
| vec3 | direction ) |
Set light direction.
| direction | Light direction vector as vec3 (will be normalized) |
| VisualizerError | If light direction setting fails |
| ValueError | If direction is invalid |
Definition at line 678 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setLightingModel | ( | self, | |
| Union[int, str] | lighting_model ) |
Set lighting model.
| lighting_model | Lighting model, either:
|
| VisualizerError | If lighting model setting fails |
| ValueError | If lighting model is invalid |
Definition at line 709 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setLightIntensityFactor | ( | self, | |
| float | intensity_factor ) |
Set light intensity scaling factor.
| intensity_factor | Light intensity scaling factor (typically 0.1 to 10.0) |
| ValueError | If intensity factor is invalid |
| VisualizerError | If operation fails |
Definition at line 884 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setPhongMaterial | ( | self, | |
| float | ambient, | ||
| float | diffuse, | ||
| float | specular, | ||
| float | shininess ) |
Set the Phong material parameters used to shade Context primitives.
Surfaces are shaded as ``ambient*A + diffuse*max(0, N.L) + specular*max(0, N.H)^shininess``, where ``A`` is the hemispheric ambient term set by :meth:`setAmbientColors`. Setting ``specular`` to zero removes the highlight, recovering the appearance of helios-core versions before 1.3.83. Has no effect under ``LIGHTING_NONE``. Individual materials can override any of these parameters by attaching ``phong_ambient``, ``phong_diffuse``, ``phong_specular`` or ``phong_shininess`` material data with :meth:`Context.setMaterialDataFloat`; each parameter falls back individually to the value set here.
| ambient | Ambient reflectance weight |
| diffuse | Diffuse reflectance weight |
| specular | Specular highlight strength |
| shininess | Specular exponent controlling highlight tightness |
| VisualizerError | If the operation fails |
Definition at line 1329 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setPointCullingEnabled | ( | self, | |
| bool | enabled ) |
Enable or disable point cloud culling optimization.
Point culling improves rendering performance for large point clouds by selectively rendering only points that are visible based on distance and density criteria.
| enabled | True to enable culling, False to disable (default: True) |
| ValueError | If enabled is not a boolean |
| VisualizerError | If operation fails |
Definition at line 2564 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setPointCullingThreshold | ( | self, | |
| int | threshold ) |
Set the minimum number of points required to trigger culling.
Culling is only activated when the total point count exceeds this threshold. This prevents unnecessary culling overhead for small point clouds.
| threshold | Point count threshold (default: 10000). Set to 0 to always enable. |
| ValueError | If threshold is not a non-negative integer |
| VisualizerError | If operation fails |
Definition at line 2593 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setPointLODFactor | ( | self, | |
| float | factor ) |
Set the level-of-detail factor for distance-based culling.
Controls how aggressively points are culled based on distance from camera. Higher values result in more aggressive culling (better performance, lower quality). Lower values preserve more points (higher quality, lower performance).
| factor | LOD factor (default: 10.0, typical range: 1.0-50.0). Must be positive. |
| ValueError | If factor is not positive |
| VisualizerError | If operation fails |
Definition at line 2669 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.setPointMaxRenderDistance | ( | self, | |
| float | distance ) |
Set the maximum rendering distance for points.
Points beyond this distance from the camera are not rendered, improving performance for large scenes. The distance is measured in world units.
| distance | Maximum distance in world units. Use 0 for auto mode (scene_size * 5.0) |
| ValueError | If distance is negative |
| VisualizerError | If operation fails |
Definition at line 2628 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.showNavigationGizmo | ( | self | ) |
Show navigation gizmo (coordinate axes indicator in corner).
The navigation gizmo shows XYZ axes orientation and can be clicked to snap the camera to standard views (top, front, side, etc.).
| VisualizerError | If operation fails |
Definition at line 2457 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.showWatermark | ( | self | ) |
Show Helios logo watermark.
| VisualizerError | If operation fails |
Definition at line 2400 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.updateContextPrimitiveColors | ( | self | ) |
Update context primitive colors.
| VisualizerError | If operation fails |
Definition at line 1793 of file Visualizer.py.
| None pyhelios.Visualizer.Visualizer.updateWatermark | ( | self | ) |
Update watermark geometry to match current window size.
| VisualizerError | If operation fails |
Definition at line 2415 of file Visualizer.py.
|
protected |
Definition at line 263 of file Visualizer.py.
| pyhelios.Visualizer.Visualizer.antialiasing_samples = antialiasing_samples |
Definition at line 187 of file Visualizer.py.
|
static |
Definition at line 145 of file Visualizer.py.
|
static |
Definition at line 149 of file Visualizer.py.
|
static |
Definition at line 144 of file Visualizer.py.
|
static |
Definition at line 147 of file Visualizer.py.
|
static |
Definition at line 148 of file Visualizer.py.
|
static |
Definition at line 146 of file Visualizer.py.
| pyhelios.Visualizer.Visualizer.headless = headless |
Definition at line 188 of file Visualizer.py.
| pyhelios.Visualizer.Visualizer.height = height |
Definition at line 186 of file Visualizer.py.
|
static |
Definition at line 139 of file Visualizer.py.
|
static |
Definition at line 140 of file Visualizer.py.
|
static |
Definition at line 141 of file Visualizer.py.
| pyhelios.Visualizer.Visualizer.visualizer = None |
Definition at line 189 of file Visualizer.py.
| pyhelios.Visualizer.Visualizer.width = width |
Definition at line 185 of file Visualizer.py.