extract_largest

UniformGrid.extract_largest(inplace=False, progress_bar=False)

Extract largest connected set in mesh.

Can be used to reduce residues obtained when generating an isosurface. Works only if residues are not connected (share at least one point with) the main component of the image.

Parameters
inplacebool, optional

Updates mesh in-place.

progress_barbool, optional

Display a progress bar to indicate progress.

Returns
pyvista.DataSet

Largest connected set in the dataset. Return type matches input.

Examples

Join two meshes together, extract the largest, and plot it.

>>> import pyvista
>>> mesh = pyvista.Sphere() + pyvista.Cube()
>>> largest = mesh.extract_largest()
>>> largest.point_data.clear()
>>> largest.cell_data.clear()
>>> largest.plot()
../../../_images/pyvista-UniformGrid-extract_largest-1_00_00.png

See Volumetric Analysis for more examples using this filter.