skel_volume#

crispy.visualize.skel_volume(image, savename=None, showfig=True, opacity=0.75, colorscale='inferno', fig=None, z_stretch=1, cbar_label='')[source]#

Render a 3D skeleton volume using isosurface visualization.

This function provides a specialized version of render_volume() for visualizing skeleton-like structures or spines in 3D datasets. It simplifies the parameterization for this specific use case.

Parameters:
  • image (numpy.ndarray) – A 3D binary or float array representing the skeleton structure. If the data type is boolean, it will be converted to an integer array for visualization.

  • savename (str, optional) – Path to save the interactive HTML file. If None, the figure is not saved. Default is None.

  • showfig (bool, optional) – Whether to display the figure interactively. Default is True.

  • opacity (float, optional) – Opacity of the skeleton isosurfaces. Default is 0.75.

  • colorscale (str, optional) – Colormap for the isosurfaces. Uses Plotly-compatible colormap names. Default is “inferno”.

  • fig (plotly.graph_objects.Figure, optional) – Existing Plotly figure to add the volume rendering to. If None, a new figure is created. Default is None.

  • z_stretch (float, optional) – Scaling factor for the Z-axis to modify aspect ratio. Default is 1.

  • cbar_label (str, optional) – Label for the colorbar. Default is an empty string.

Returns:

The Plotly figure object containing the 3D skeleton volume rendering.

Return type:

plotly.graph_objects.Figure

Notes

  • This function is a wrapper around render_volume() with preset parameters tailored for skeleton visualization.

  • If image contains NaN values, they will be handled by render_volume().

Examples

>>> import numpy as np
>>> image = np.random.random((50, 50, 50)) > 0.95  # Generate a random binary skeleton
>>> skel_volume(image, showfig=True, opacity=0.5)