def extractLargestRegion(actor):
    """Keep only the largest connected part of a mesh and discard all the smaller pieces.

    .. hint:: |largestregion.py|_
    """
    conn = vtk.vtkConnectivityFilter()
    conn.SetExtractionModeToLargestRegion()
    conn.ScalarConnectivityOff()
    poly = actor.GetMapper().GetInput()
    conn.SetInputData(poly)
    conn.Update()
    epoly = conn.GetOutput()
    eact = Actor(epoly)
    pr = vtk.vtkProperty()
    pr.DeepCopy(actor.GetProperty())
    eact.SetProperty(pr)
    return eact
def extractLargestRegion ( actor ) : conn = vtk . vtkConnectivityFilter ( ) conn . SetExtractionModeToLargestRegion ( ) conn . ScalarConnectivityOff ( ) poly = actor . GetMapper ( ) . GetInput ( ) conn . SetInputData ( poly ) conn . Update ( ) epoly = conn . GetOutput ( ) eact = Actor ( epoly ) pr = vtk . vtkProperty ( ) pr . DeepCopy ( actor . GetProperty ( ) ) eact . SetProperty ( pr ) return eact
Keep only the largest connected part of a mesh and discard all the smaller pieces.

    .. hint:: |largestregion.py|_