def METHOD_NAME(self):
    if self.Surface == None:
        self.PrintError('Error: No input surface.')
    if (self.GroupId != -1) and (self.GroupIdsArrayName!=''):
        self.Surface.GetPointData().SetActiveScalars(self.GroupIdsArrayName)
    barycenter = [0.0,0.0,0.0]
    if self.Method == 'closest' and self.ClosestPoint == None:
        n = self.ReferenceSurface.GetNumberOfPoints()
        for i in range(n):
            point = self.ReferenceSurface.GetPoint(i)
            barycenter[0] += point[0]
            barycenter[1] += point[1]
            barycenter[2] += point[2]
        barycenter[0] /= n
        barycenter[1] /= n
        barycenter[2] /= n
    connectivityFilter = vtk.vtkPolyDataConnectivityFilter()
    connectivityFilter.SetInputData(self.Surface)
    connectivityFilter.ColorRegionsOff()
    if self.Method == 'largest':
        connectivityFilter.SetExtractionModeToLargestRegion()
    elif self.Method == 'closest':
        connectivityFilter.SetExtractionModeToClosestPointRegion()
        if self.ClosestPoint:
            connectivityFilter.SetClosestPoint(self.ClosestPoint)
        else:
            connectivityFilter.SetClosestPoint(barycenter)
    elif self.Method == 'all':
        connectivityFilter.SetExtractionModeToAllRegions()
        connectivityFilter.ColorRegionsOn()
    if self.GroupId != -1:
        connectivityFilter.ScalarConnectivityOn()
        scalarRange = [self.GroupId,self.GroupId]
        connectivityFilter.SetScalarRange(scalarRange)
    connectivityFilter.Update()
    self.Surface = connectivityFilter.GetOutput()
    if self.CleanOutput == 1:
        cleaner = vtk.vtkCleanPolyData()
        cleaner.SetInputConnection(connectivityFilter.GetOutputPort())
        cleaner.Update()
        self.Surface = cleaner.GetOutput()