本文整理匯總了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