pyvista.Actor.enable_maximum_intensity_projection

pyvista.Actor.enable_maximum_intensity_projection#

Actor.enable_maximum_intensity_projection(clim: Sequence[float] | None = None) None[source]#

Enable maximum intensity projection.

Added in version 0.48.

This resets the z screen coordinates so that vertices with higher scalar values are rendered closer to the screen, regardless of their actual 3D position. This is useful for dense point cloud visualization where high-value data points should be visible even when occluded by lower-value points.

Scalar values are normalized to the [-1, 0] range to stay within the OpenGL clip space.

Parameters:
climsequence[float], optional

Two-element sequence (min, max) specifying the scalar range for normalization. If not provided, the range is computed from the active scalars on the actor’s dataset.

Raises:
RuntimeError

If the VTK version is older than 9.3.

ValueError

If no mapper, dataset, or active scalars are available and clim is not provided.

Warning

Requires VTK >= 9.3. The vertex shader replacements used by this method are not supported in older VTK versions.

Maximum Intensity Projection does not work correctly with opacity < 1 unless depth peeling is enabled. See pyvista.Plotter.enable_depth_peeling().

References

Cowan, E.J., 2014. ‘X-ray Plunge Projection’ - Understanding Structural Geology from Grade Data. AusIMM Monograph 30: Mineral Resource and Ore Reserve Estimation - The AusIMM Guide to Good Practice, second edition, 207-220.

Examples

Enable maximum intensity projection on a point cloud actor.

>>> import numpy as np
>>> import pyvista as pv
>>> rng = np.random.default_rng(0)
>>> cloud = pv.PolyData(rng.random((1000, 3)))
>>> cloud['values'] = cloud.points[:, 2]
>>> pl = pv.Plotter()
>>> actor = pl.add_mesh(cloud, scalars='values', style='points')
>>> actor.enable_maximum_intensity_projection()