Python vtk.vtkDiskSource() Examples

The following are 5 code examples of vtk.vtkDiskSource(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module vtk , or try the search function .
Example #1
Source File: viz.py    From 3d-semantic-segmentation with MIT License 6 votes vote down vote up
def getActorCircle(radius_inner=100, radius_outer=99, color=(1,0,0)):
    """"""
    # create source
    source = vtk.vtkDiskSource()
    source.SetInnerRadius(radius_inner)
    source.SetOuterRadius(radius_outer)
    source.SetRadialResolution(100)
    source.SetCircumferentialResolution(100)

    # Transformer
    transform = vtk.vtkTransform()
    transform.RotateWXYZ(90, 1, 0, 0)
    transformFilter = vtk.vtkTransformPolyDataFilter()
    transformFilter.SetTransform(transform)
    transformFilter.SetInputConnection(source.GetOutputPort())
    transformFilter.Update()

    # mapper
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInputConnection(transformFilter.GetOutputPort())

    # actor
    actor = vtk.vtkActor()
    actor.GetProperty().SetColor(color)
    actor.SetMapper(mapper)

    return actor 
Example #2
Source File: geometric_objects.py    From pyvista with MIT License 5 votes vote down vote up
def Disc(center=(0.,0.,0.), inner=0.25, outer=0.5, normal=(0,0,1), r_res=1,
         c_res=6):
    """Create a polygonal disk with a hole in the center.

    The disk has zero height. The user can specify the inner and outer radius
    of the disk, and the radial and circumferential resolution of the polygonal
    representation.

    Parameters
    ----------
    center : np.ndarray or list
        Center in [x, y, z]. middle of the axis of the disc.

    inner : float
        The inner radius

    outer : float
        The outer radius

    normal : np.ndarray or list
        direction vector in [x, y, z]. orientation vector of the cone.

    r_res: int
        number of points in radius direction.

    r_res: int
        number of points in circumferential direction.

    """
    src = vtk.vtkDiskSource()
    src.SetInnerRadius(inner)
    src.SetOuterRadius(outer)
    src.SetRadialResolution(r_res)
    src.SetCircumferentialResolution(c_res)
    src.Update()
    return pyvista.wrap(src.GetOutput()) 
Example #3
Source File: segmentation.py    From director with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def applyDiskGlyphs(polyData, computeNormals=True):

    voxelGridLeafSize = 0.03
    normalEstimationSearchRadius = 0.05
    diskRadius = 0.015
    diskResolution = 12

    if computeNormals:
        scanInput = polyData

        pd = applyVoxelGrid(scanInput, leafSize=voxelGridLeafSize)

        pd = labelOutliers(pd, searchRadius=normalEstimationSearchRadius, neighborsInSearchRadius=3)
        pd = thresholdPoints(pd, 'is_outlier', [0, 0])

        pd = normalEstimation(pd, searchRadius=normalEstimationSearchRadius, searchCloud=scanInput)
    else:
        pd = polyData

    assert polyData.GetPointData().GetNormals()

    disk = vtk.vtkDiskSource()
    disk.SetOuterRadius(diskRadius)
    disk.SetInnerRadius(0.0)
    disk.SetRadialResolution(0)
    disk.SetCircumferentialResolution(diskResolution)
    disk.Update()

    t = vtk.vtkTransform()
    t.RotateY(90)
    disk = transformPolyData(disk.GetOutput(), t)

    glyph = vtk.vtkGlyph3D()
    glyph.ScalingOff()
    glyph.OrientOn()
    glyph.SetSourceData(disk)
    glyph.SetInputData(pd)
    glyph.SetVectorModeToUseNormal()
    glyph.Update()

    return shallowCopy(glyph.GetOutput()) 
Example #4
Source File: pc_viz.py    From deep_gcns_torch with MIT License 5 votes vote down vote up
def getActorCircle(radius_inner=100, radius_outer=99, color=(1, 0, 0)):
    """"""
    # create source
    source = vtk.vtkDiskSource()
    source.SetInnerRadius(radius_inner)
    source.SetOuterRadius(radius_outer)
    source.SetRadialResolution(100)
    source.SetCircumferentialResolution(100)

    # Transformer
    transform = vtk.vtkTransform()
    transform.RotateWXYZ(90, 1, 0, 0)
    transformFilter = vtk.vtkTransformPolyDataFilter()
    transformFilter.SetTransform(transform)
    transformFilter.SetInputConnection(source.GetOutputPort())
    transformFilter.Update()

    # mapper
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInputConnection(transformFilter.GetOutputPort())

    # actor
    actor = vtk.vtkActor()
    actor.GetProperty().SetColor(color)
    actor.SetMapper(mapper)

    return actor 
Example #5
Source File: viz.py    From deep_gcns with MIT License 5 votes vote down vote up
def getActorCircle(radius_inner=100, radius_outer=99, color=(1,0,0)):
    """"""
    # create source
    source = vtk.vtkDiskSource()
    source.SetInnerRadius(radius_inner)
    source.SetOuterRadius(radius_outer)
    source.SetRadialResolution(100)
    source.SetCircumferentialResolution(100)

    # Transformer
    transform = vtk.vtkTransform()
    transform.RotateWXYZ(90, 1, 0, 0)
    transformFilter = vtk.vtkTransformPolyDataFilter()
    transformFilter.SetTransform(transform)
    transformFilter.SetInputConnection(source.GetOutputPort())
    transformFilter.Update()

    # mapper
    mapper = vtk.vtkPolyDataMapper()
    mapper.SetInputConnection(transformFilter.GetOutputPort())

    # actor
    actor = vtk.vtkActor()
    actor.GetProperty().SetColor(color)
    actor.SetMapper(mapper)

    return actor