def showMajorPlanes(polyData=None):

    if not polyData:
        inputObj = om.findObjectByName('pointcloud snapshot')
        inputObj.setProperty('Visible', False)
        polyData = inputObj.polyData

    om.removeFromObjectModel(om.findObjectByName('major planes'))
    folderObj = om.findObjectByName('segmentation')
    folderObj = om.getOrCreateContainer('major planes', folderObj)

    origin = SegmentationContext.getGlobalInstance().getViewFrame().GetPosition()
    polyData = labelDistanceToPoint(polyData, origin)
    polyData = thresholdPoints(polyData, 'distance_to_point', [1, 4])

    polyDataList = getMajorPlanes(polyData)

    for i, polyData in enumerate(polyDataList):
        obj = showPolyData(polyData, 'plane %d' % i, color=getRandomColor(), visible=True, parent='major planes')
        obj.setProperty('Point Size', 3)
dataset/ETHPy150Open RobotLocomotion/director/src/python/director/segmentation.py/showMajorPlanes/original