本文整理汇总了Python中vtk.vtkPolyDataNormals方法的典型用法代码示例。如果您正苦于以下问题:Python vtk.vtkPolyDataNormals方法的具体用法?Python vtk.vtkPolyDataNormals怎么用?Python vtk.vtkPolyDataNormals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类vtk
的用法示例。
在下文中一共展示了vtk.vtkPolyDataNormals方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: load_conte69
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkPolyDataNormals [as 别名]
def load_conte69(as_sphere=False, with_normals=True, join=False):
""" Load conte69 surfaces.
Parameters
----------
as_sphere : bool, optional
Return spheres instead of cortical surfaces. Default is False.
with_normals : bool, optional
Whether to compute surface normals. Default is True.
join : bool, optional
If False, return one surface for left and right hemispheres. Otherwise,
return a single surface as a combination of both left and right
surfaces. Default is False.
Returns
-------
surf : tuple of BSPolyData or BSPolyData
Surfaces for left and right hemispheres. If ``join == True``, one
surface with both hemispheres.
"""
root_pth = os.path.dirname(__file__)
if as_sphere:
fname = 'conte69_32k_{}_sphere.gii'
else:
fname = 'conte69_32k_{}.gii'
ipth = os.path.join(root_pth, 'surfaces', fname)
surfs = [None] * 2
for i, side in enumerate(['lh', 'rh']):
surfs[i] = read_surface(ipth.format(side))
if with_normals:
nf = wrap_vtk(vtkPolyDataNormals, splitting=False,
featureAngle=0.1)
surfs[i] = serial_connect(surfs[i], nf)
if join:
return combine_surfaces(*surfs)
return surfs[0], surfs[1]
示例2: load_fsa5
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkPolyDataNormals [as 别名]
def load_fsa5(with_normals=True, join=False):
""" Load fsaverage5 surfaces.
Parameters
----------
with_normals : bool, optional
Whether to compute surface normals. Default is True.
join : bool, optional
If False, return one surface for left and right hemispheres. Otherwise,
return a single surface as a combination of both left and right
surfaces. Default is False.
Returns
-------
surf : tuple of BSPolyData or BSPolyData
Surfaces for left and right hemispheres. If ``join == True``, one
surface with both hemispheres.
"""
root_pth = os.path.dirname(__file__)
fname = 'fsa5.pial.{}.gii'
ipth = os.path.join(root_pth, 'surfaces', fname)
surfs = [None] * 2
for i, side in enumerate(['lh', 'rh']):
surfs[i] = read_surface(ipth.format(side))
if with_normals:
nf = wrap_vtk(vtkPolyDataNormals, splitting=False,
featureAngle=0.1)
surfs[i] = serial_connect(surfs[i], nf)
if join:
return combine_surfaces(*surfs)
return surfs[0], surfs[1]
示例3: create_normals
# 需要导入模块: import vtk [as 别名]
# 或者: from vtk import vtkPolyDataNormals [as 别名]
def create_normals(smoother):
"""
The filter can reorder polygons to insure consistent orientation across polygon neighbors. Sharp edges can be split
and points duplicated with separate normals to give crisp (rendered) surface definition.
(https://www.vtk.org/doc/nightly/html/classvtkPolyDataNormals.html)
:param smoother:
:return:
"""
brain_normals = vtk.vtkPolyDataNormals()
brain_normals.SetInputConnection(smoother.GetOutputPort())
brain_normals.SetFeatureAngle(60.0) #
return brain_normals