本文整理汇总了Python中vtk.vtkDataSetMapper函数的典型用法代码示例。如果您正苦于以下问题:Python vtkDataSetMapper函数的具体用法?Python vtkDataSetMapper怎么用?Python vtkDataSetMapper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkDataSetMapper函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
self.files = []
self.timestep = -1
self.geometry = vtk.vtkUnstructuredGridReader()
self.geometry_mapper = vtk.vtkDataSetMapper()
self.geometry_actor = vtk.vtkActor()
self.positions = vtk.vtkUnstructuredGridReader()
self.positions_mapper = vtk.vtkDataSetMapper()
self.positions_actor = vtk.vtkActor()
self.geometry_mapper.SetInput(self.geometry.GetOutput())
self.positions_mapper.SetInput(self.positions.GetOutput())
self.positions_mapper.ScalarVisibilityOff()
self.geometry_actor.SetMapper(self.geometry_mapper)
self.geometry_actor.GetProperty().SetOpacity(0.2)
self.positions_actor.SetMapper(self.positions_mapper)
self.positions_actor.GetProperty().SetColor(light_grey)
self.ren = vtk.vtkRenderer()
self.ren_win = GtkGLExtVTKRenderWindow()
self.ren_win.GetRenderWindow().AddRenderer(self.ren)
self.ren.AddActor(self.geometry_actor)
self.ren.AddActor(self.positions_actor)
self.ren.SetBackground(0.1, 0.2, 0.4)
开发者ID:argreiner,项目名称:sympler,代码行数:29,代码来源:sympler_viewer.py
示例2: testContourQuadraticTetra
def testContourQuadraticTetra(self):
# Create a reader to load the data (quadratic tetrahedra)
reader = vtk.vtkUnstructuredGridReader()
reader.SetFileName(VTK_DATA_ROOT + "/Data/quadTetEdgeTest.vtk")
tetContours = vtk.vtkContourFilter()
tetContours.SetInputConnection(reader.GetOutputPort())
tetContours.SetValue(0, 0.5)
aTetContourMapper = vtk.vtkDataSetMapper()
aTetContourMapper.SetInputConnection(tetContours.GetOutputPort())
aTetContourMapper.ScalarVisibilityOff()
aTetMapper = vtk.vtkDataSetMapper()
aTetMapper.SetInputConnection(reader.GetOutputPort())
aTetMapper.ScalarVisibilityOff()
aTetActor = vtk.vtkActor()
aTetActor.SetMapper(aTetMapper)
aTetActor.GetProperty().SetRepresentationToWireframe()
aTetActor.GetProperty().SetAmbient(1.0)
aTetContourActor = vtk.vtkActor()
aTetContourActor.SetMapper(aTetContourMapper)
aTetContourActor.GetProperty().SetAmbient(1.0)
# Create the rendering related stuff.
# Since some of our actors are a single vertex, we need to remove all
# cullers so the single vertex actors will render
ren1 = vtk.vtkRenderer()
ren1.GetCullers().RemoveAllItems()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
ren1.SetBackground(.1, .2, .3)
renWin.SetSize(400, 250)
# specify properties
ren1.AddActor(aTetActor)
ren1.AddActor(aTetContourActor)
ren1.ResetCamera()
ren1.GetActiveCamera().Dolly(1.5)
ren1.ResetCameraClippingRange()
renWin.Render()
img_file = "contourQuadraticTetra.png"
vtk.test.Testing.compareImage(iren.GetRenderWindow(), vtk.test.Testing.getAbsImagePath(img_file), threshold=25)
vtk.test.Testing.interact()
开发者ID:timkrentz,项目名称:SunTracker,代码行数:49,代码来源:contourQuadraticTetra.py
示例3: add_outline
def add_outline(self):
outline = vtk.vtkOutlineFilter()
outline.SetInputData(self.data.grid[self.current_timestep])
outline_mapper = vtk.vtkDataSetMapper()
outline_mapper.SetInputConnection(outline.GetOutputPort())
self.outline_actor.SetMapper(outline_mapper)
self.ren.AddActor(self.outline_actor)
开发者ID:capitalaslash,项目名称:radcal-gui,代码行数:7,代码来源:vtkgui.py
示例4: unstructered_grid_reader
def unstructered_grid_reader(filename):
# Read the source file.
reader = vtk.vtkUnstructuredGridReader()
reader.SetFileName(filename)
reader.Update() # Needed because of GetScalarRange
output = reader.GetOutput()
scalar_range = output.GetScalarRange()
# Create the mapper that corresponds the objects of the vtk file
# into graphics elements
mapper =vtk.vtkDataSetMapper()
mapper.SetInputData(output)
mapper.SetScalarRange(scalar_range)
# Create the Actor
actor = vtk.vtkActor()
actor.SetMapper(mapper)
# Create the Renderer
renderer = vtk.vtkRenderer()
renderer.AddActor(actor)
renderer.SetBackground(1, 1, 1) # Set background to white
# Create the RendererWindow
renderer_window = vtk.vtkRenderWindow()
renderer_window.AddRenderer(renderer)
# Create the RendererWindowInteractor and display the vtk_file
interactor = vtk.vtkRenderWindowInteractor()
interactor.SetRenderWindow(renderer_window)
interactor.Initialize()
interactor.Start()
开发者ID:CognitionGuidedSurgery,项目名称:msml,代码行数:32,代码来源:msmlvtk.py
示例5: show_beta_sheets
def show_beta_sheets(renderer):
for sheet in sheet_defs:
# helix = helix_defs[1]
aPolyLineGrid = vtk.vtkUnstructuredGrid()
aPolyLineGrid.Allocate(5, 1)
(polyLinePoints, aPolyLine) = make_polyline(sheet)
# # Create a tube filter to represent the lines as tubes. Set up the
# # associated mapper and actor.
# tuber = vtk.vtkTubeFilter()
# tuber.SetInputConnection(appendF.GetOutputPort())
# tuber.SetRadius(0.1)
# lineMapper = vtk.vtkPolyDataMapper()
# lineMapper.SetInputConnection(tuber.GetOutputPort())
# lineActor = vtk.vtkActor()
# lineActor.SetMapper(lineMapper)
aPolyLineGrid.InsertNextCell(aPolyLine.GetCellType(),
aPolyLine.GetPointIds())
aPolyLineGrid.SetPoints(polyLinePoints)
aPolyLineMapper = vtk.vtkDataSetMapper()
aPolyLineMapper.SetInput(aPolyLineGrid)
aPolyLineActor = vtk.vtkActor()
aPolyLineActor.SetMapper(aPolyLineMapper)
aPolyLineActor.GetProperty().SetDiffuseColor(1, 1, 1)
renderer.AddActor(aPolyLineActor)
开发者ID:JDonner,项目名称:gabbleduck,代码行数:29,代码来源:sse.py
示例6: addTriangles
def addTriangles(self, triangles, color):
vtkPoints = vtk.vtkPoints()
idPoint = 0
allIdsTriangle = []
for triangle in triangles:
idsTriangle = []
for point in triangle:
vtkPoints.InsertNextPoint(point[0], point[1], point[2])
idsTriangle.append(idPoint)
idPoint += 1
allIdsTriangle.append(idsTriangle)
unstructuredGrid = vtk.vtkUnstructuredGrid()
unstructuredGrid.SetPoints(vtkPoints)
for idsTriangle in allIdsTriangle:
unstructuredGrid.InsertNextCell(vtk.VTK_TRIANGLE, 3, idsTriangle)
mapper = vtk.vtkDataSetMapper()
mapper.SetInputData(unstructuredGrid)
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor.GetProperty().SetColor(color)
self._rendererScene.AddActor(actor)
开发者ID:trianam,项目名称:voropath,代码行数:28,代码来源:plotter.py
示例7: add_polyhedron
def add_polyhedron(self, neighbors, center, color):
"""
Adds a polyhedron.
Args:
neighbors:
Neighbors of the polyhedron (the vertices).
center:
The atom in the center of the polyhedron.
color:
Color for text as RGB.
"""
points = vtk.vtkPoints()
conv = vtk.vtkConvexPointSet()
for i in range(len(neighbors)):
x, y, z = neighbors[i].coords
points.InsertPoint(i, x, y, z)
conv.GetPointIds().InsertId(i, i)
grid = vtk.vtkUnstructuredGrid()
grid.Allocate(1, 1)
grid.InsertNextCell(conv.GetCellType(), conv.GetPointIds())
grid.SetPoints(points)
dsm = vtk.vtkDataSetMapper()
polysites = [center]
polysites.extend(neighbors)
self.mapper_map[dsm] = polysites
dsm.SetInput(grid)
ac = vtk.vtkActor()
#ac.SetMapper(mapHull)
ac.SetMapper(dsm)
ac.GetProperty().SetOpacity(0.4)
ac.GetProperty().SetColor(color)
self.ren.AddActor(ac)
开发者ID:jesuansito,项目名称:pymatgen,代码行数:34,代码来源:structure_vtk.py
示例8: initPicker
def initPicker(self):
coneSource = vtk.vtkConeSource()
coneSource.CappingOn()
coneSource.SetHeight(2)
coneSource.SetRadius(1)
coneSource.SetResolution(10)
coneSource.SetCenter(1,0,0)
coneSource.SetDirection(-1,0,0)
coneMapper = vtk.vtkDataSetMapper()
coneMapper.SetInputConnection(coneSource.GetOutputPort())
self.redCone = vtk.vtkActor()
self.redCone.PickableOff()
self.redCone.SetMapper(coneMapper)
self.redCone.GetProperty().SetColor(1,0,0)
self.greenCone = vtk.vtkActor()
self.greenCone.PickableOff()
self.greenCone.SetMapper(coneMapper)
self.greenCone.GetProperty().SetColor(0,1,0)
# Add the two cones (or just one, if you want)
self.renderer.AddViewProp(self.redCone)
self.renderer.AddViewProp(self.greenCone)
self.picker = vtk.vtkVolumePicker()
self.picker.SetTolerance(1e-6)
self.picker.SetVolumeOpacityIsovalue(0.1)
开发者ID:smdabdoub,项目名称:ProkaryMetrics,代码行数:29,代码来源:vtkRender.py
示例9: show_vtk_file
def show_vtk_file(path):
# open vtk file from arglist
reader = vtk.vtkDataSetReader()
reader.SetFileName(path)
reader.Update()
# read out data and scalarrange
output = reader.GetOutput()
scalarrange = output.GetScalarRange()
# generate Mapper and set DataSource
mapper = vtk.vtkDataSetMapper()
mapper.SetInput(output)
mapper.SetScalarRange(scalarrange)
# create actor
actor = vtk.vtkActor()
actor.SetMapper(mapper)
# build renderer
renderer = vtk.vtkRenderer()
window = vtk.vtkRenderWindow()
window.AddRenderer(renderer)
# create interaction
interaction = vtk.vtkRenderWindowInteractor()
interaction.SetRenderWindow(window)
# add actor
renderer.AddActor(actor)
# show window and start inteaction and renderer
interaction.Initialize()
window.Render()
interaction.Start()
开发者ID:stetro,项目名称:objScanner,代码行数:28,代码来源:pcd_scanner.py
示例10: VtkDefineElementsActor
def VtkDefineElementsActor(self, reprType,field,color=xc.Vector([rd.random(),rd.random(),rd.random()])):
''' Define the actor to display elements
:param reprType: type of representation ("points", "wireframe" or
"surface")
:param field: field to be repreresented
:param color: RGB color to represent the elements (defaults to random
color)
'''
if(field):
field.setupOnGrid(self.gridRecord.uGrid)
self.gridMapper= vtk.vtkDataSetMapper()
self.gridMapper.SetInputData(self.gridRecord.uGrid)
if(field):
field.setupOnMapper(self.gridMapper)
elemActor= vtk.vtkActor()
elemActor.SetMapper(self.gridMapper)
elemActor.GetProperty().SetColor(color[0],color[1],color[2])
if(reprType=="points"):
elemActor.GetProperty().SetRepresentationToPoints()
elif(reprType=="wireframe"):
elemActor.GetProperty().SetRepresentationToWireFrame()
elif(reprType=="surface"):
elemActor.GetProperty().SetRepresentationToSurface()
else:
lmsg.error("Representation type: '"+ reprType+ "' unknown.")
self.renderer.AddActor(elemActor)
if(field):
field.creaColorScaleBar()
self.renderer.AddActor2D(field.scalarBar)
开发者ID:lcpt,项目名称:xc,代码行数:31,代码来源:vtk_FE_graphic.py
示例11: __init__
def __init__(self, renderer, data, type, index):
PeacockActor.__init__(self, renderer)
self.data = data
self.type = type
self.index = index
self.solid_visible = False
self.edges_visible = False
self.mesh = data.GetBlock(type).GetBlock(index)
self.geom = vtk.vtkDataSetSurfaceFilter()
if vtk.VTK_MAJOR_VERSION <= 5:
self.geom.SetInput(self.mesh)
else:
self.geom.SetInputData(self.mesh)
self.geom.Update()
self.mapper = vtk.vtkDataSetMapper()
if vtk.VTK_MAJOR_VERSION <= 5:
self.mapper.SetInput(self.mesh)
else:
self.mapper.SetInputData(self.mesh)
self.actor = vtk.vtkActor()
self.actor.SetMapper(self.mapper)
self.actor.GetProperty().SetPointSize(5)
self.actor.GetProperty().SetEdgeColor(0,0,0)
self.actor.GetProperty().SetAmbient(0.3);
开发者ID:aeslaughter,项目名称:moose,代码行数:29,代码来源:ExodusActor.py
示例12: __init__
def __init__(self, parent, visualizer, **kws):
"""
Initialization
"""
self.x, self.y, self.z = -1, -1, -1
VisualizationModule.__init__(self, parent, visualizer, **kws)
#self.name = "Scale bar"
self.renew = 1
self.mapper = vtk.vtkDataSetMapper()
self.actor = vtk.vtkActor()
self.actor.SetMapper(self.mapper)
self.width = 10
self.widthPx = 100
self.voxelSize = (1, 1, 1)
self.renderer = self.parent.getRenderer()
self.renderer.AddActor(self.actor)
self.polyLine = vtk.vtkPolyLine()
#self.mapper.SetInput(self.polyLine.GetOutput())
self.actor.GetProperty().SetColor(1, 1, 1)
self.textActor = vtk.vtkTextActor()
#self.textActor.ScaledTextOn()
self.renderer.AddActor2D(self.textActor)
iactor = self.wxrenwin.GetRenderWindow().GetInteractor()
style = iactor.GetInteractorStyle()
# style.AddObserver("StartInteractionEvent",self.updateLine)
style.AddObserver("EndInteractionEvent", self.updateRendering)
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:32,代码来源:ScaleBar.py
示例13: __init___
def __init___(self, scene, V, opacity=1, color='gray'):
self.scene = scene
self.frame = scene.frame
self.V = V
n_voxels = len(V)
size = V.bin_size
pts = vtk.vtkPoints()
pts.SetNumberOfPoints(8 * n_voxels)
grid = vtk.vtkUnstructuredGrid()
grid.Allocate(n_voxels, 1)
vx = vtk.vtkVoxel()
for i, q in enumerate(V):
pos = q * size + V.low_range
pts.InsertPoint(i * 8 + 0, *pos)
pts.InsertPoint(i * 8 + 1, *(pos + (size,0,0)))
pts.InsertPoint(i * 8 + 2, *(pos + (0,size,0)))
pts.InsertPoint(i * 8 + 3, *(pos + (size,size,0)))
pts.InsertPoint(i * 8 + 4, *(pos + (0,0,size)))
pts.InsertPoint(i * 8 + 5, *(pos + (size,0,size)))
pts.InsertPoint(i * 8 + 6, *(pos + (0,size,size)))
pts.InsertPoint(i * 8 + 7, *(pos + (size,size,size)))
for j in range(8):
vx.GetPointIds().SetId(j, i * 8 + j)
grid.InsertNextCell(vx.GetCellType(), vx.GetPointIds())
grid.SetPoints(pts)
mapper = vtk.vtkDataSetMapper()
mapper.SetInput(grid)
self.actor = vtk.vtkActor()
self.actor.SetMapper(mapper)
#self.actor.GetProperty().SetDiffuseColor(*name_to_rgb_float(color))
self.actor.GetProperty().SetColor(*name_to_rgb_float(color))
self.actor.GetProperty().SetOpacity(opacity)
self.frame.ren.AddActor(self.actor)
开发者ID:cjauvin,项目名称:pypetree,代码行数:33,代码来源:world.py
示例14: readMesh
def readMesh(self, path, casename):
#read the mesh
self.data.loadMesh(path, casename)
# Create actors based on grid parts
self.vtkActorList = []
vtkgrids = self.data.buildVTKGrids()
itag = 0
c = colors()
for vtkgrid in vtkgrids:
mapper = vtk.vtkDataSetMapper()
mapper.SetInput(vtkgrid)
self.vtkActorList.append(vtk.vtkActor())
self.vtkActorList[-1].SetMapper(mapper)
self.vtkActorList[-1].GetProperty().SetColor(c.getNext())
# set visibility of volumes to false on startup
if int(self.data.elemGroups[itag]) < 0:
self.vtkActorList[-1].VisibilityOff()
itag = itag + 1
#visualize the grid
for actor in self.vtkActorList:
self.ren.AddActor(actor)
self.iren.Render()
#update mesh visibility options
self.BCTab1.drawBCVizBoxes()
开发者ID:zwghit,项目名称:ProteusCFD,代码行数:27,代码来源:gui_main.py
示例15: __init__
def __init__(self, vtk_filename=None, vtk_data=None):
"""
Initiate Viwer
Parameters
----------
vtk_filename : str
Input VTK filename
"""
QDialog.__init__(self)
self.initUI()
ren = vtk.vtkRenderer()
self.vtkWidget.GetRenderWindow().AddRenderer(ren)
iren = self.vtkWidget.GetRenderWindow().GetInteractor()
if vtk_filename is not None:
# VTK file
reader = vtk.vtkUnstructuredGridReader()
reader.SetFileName(vtk_filename)
reader.Update()
vtkdata = reader.GetOutput()
if vtk_data is not None:
vtkdata = vtk_data
# VTK surface
surface = vtk.vtkDataSetSurfaceFilter()
surface.SetInput(vtkdata)
surface.Update()
mapper = vtk.vtkDataSetMapper()
mapper.SetInput(surface.GetOutput())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor.GetProperty().EdgeVisibilityOff()
# actor.GetProperty().SetEdgeColor(1,1,1)
# actor.GetProperty().SetLineWidth(0.1)
ren.AddActor(actor)
# annot. cube
axesActor = vtk.vtkAnnotatedCubeActor()
axesActor.SetXPlusFaceText('R')
axesActor.SetXMinusFaceText('L')
axesActor.SetYMinusFaceText('H')
axesActor.SetYPlusFaceText('F')
axesActor.SetZMinusFaceText('A')
axesActor.SetZPlusFaceText('P')
axesActor.GetTextEdgesProperty().SetColor(1, 1, 0)
axesActor.GetCubeProperty().SetColor(0, 0, 1)
self.axes = vtk.vtkOrientationMarkerWidget()
self.axes.SetOrientationMarker(axesActor)
self.axes.SetInteractor(iren)
self.axes.EnabledOn()
self.axes.InteractiveOn()
ren.ResetCamera()
iren.Initialize()
开发者ID:andrlikjirka,项目名称:lisa,代码行数:60,代码来源:viewer.py
示例16: testUnstructured
def testUnstructured(self):
rt = vtk.vtkRTAnalyticSource()
rt.SetWholeExtent(-5, 5, -5, 5, -5, 5)
t = vtk.vtkThreshold()
t.SetInputConnection(rt.GetOutputPort())
t.ThresholdByUpper(-10)
s = vtk.vtkSphere()
s.SetRadius(2)
s.SetCenter(0,0,0)
c = vtk.vtkTableBasedClipDataSet()
c.SetInputConnection(t.GetOutputPort())
c.SetClipFunction(s)
c.SetInsideOut(1)
c.Update()
self.assertEqual(c.GetOutput().GetNumberOfCells(), 64)
eg = vtk.vtkEnSightGoldReader()
eg.SetCaseFileName(VTK_DATA_ROOT + "/Data/EnSight/elements.case")
eg.Update()
pl = vtk.vtkPlane()
pl.SetOrigin(3.5, 3.5, 0.5)
pl.SetNormal(0, 0, 1)
c.SetInputConnection(eg.GetOutputPort())
c.SetClipFunction(pl)
c.SetInsideOut(1)
c.Update()
data = c.GetOutputDataObject(0).GetBlock(0)
self.assertEqual(data.GetNumberOfCells(), 75)
rw = vtk.vtkRenderWindow()
ren = vtk.vtkRenderer()
rw.AddRenderer(ren)
mapper = vtk.vtkDataSetMapper()
mapper.SetInputData(data)
actor = vtk.vtkActor()
actor.SetMapper(mapper)
ren.AddActor(actor)
ac = ren.GetActiveCamera()
ac.SetPosition(-7.9, 9.7, 14.6)
ac.SetFocalPoint(3.5, 3.5, 0.5)
ac.SetViewUp(0.08, 0.93, -0.34)
rw.Render()
ren.ResetCameraClippingRange()
rtTester = vtk.vtkTesting()
for arg in sys.argv[1:]:
rtTester.AddArgument(arg)
rtTester.AddArgument("-V")
rtTester.AddArgument("tableBasedClip.png")
rtTester.SetRenderWindow(rw)
rw.Render()
rtResult = rtTester.RegressionTest(10)
开发者ID:timkrentz,项目名称:SunTracker,代码行数:60,代码来源:tableBasedClip.py
示例17: grid_create
def grid_create(
arg_grid_delta,
arg_grid_color,
arg_grid_width,
arg_projection,
arg_ratioxy):
gridpolydata=vtk.vtkAppendPolyData()
for i in range(0,int(90*arg_ratioxy),int(arg_grid_delta*arg_ratioxy)) :
latpolydata=latitude_create(i,arg_projection)
gridpolydata.AddInputData(latpolydata)
for i in range(0,int(-90*arg_ratioxy),int(-arg_grid_delta*arg_ratioxy)) :
latpolydata=latitude_create(i,arg_projection)
gridpolydata.AddInputData(latpolydata)
if arg_projection == 'linear' :
for i in range(-180,540,arg_grid_delta) :
lonpolydata=longitude_create(i,arg_projection,arg_ratioxy)
gridpolydata.AddInputData(lonpolydata)
else:
for i in range(0,180,arg_grid_delta) :
lonpolydata=longitude_create(i,arg_projection)
gridpolydata.AddInputData(lonpolydata)
gridpolygonmapper=vtk.vtkDataSetMapper()
gridpolygonmapper.SetInputConnection(gridpolydata.GetOutputPort())
gridpolygonactor=vtk.vtkActor()
gridpolygonactor.SetMapper(gridpolygonmapper)
gridpolygonactor.GetProperty().SetColor(arg_grid_color)
gridpolygonactor.GetProperty().SetLineWidth(arg_grid_width)
gridpolygonactor.GetProperty().SetAmbient(1)
gridpolygonactor.GetProperty().SetDiffuse(0)
gridpolygonactor.PickableOff()
return(gridpolygonactor)
开发者ID:PBrockmann,项目名称:VTK_Mapper,代码行数:35,代码来源:mylib_grid.py
示例18: create_vessel_actor
def create_vessel_actor(ref_data):
# vessel_ref_data = ref_data
points = vtk.vtkPoints()
# insert each properties of points into obj.
for i in xrange(len(ref_data)):
x = ref_data[i][0]
y = ref_data[i][1]
z = ref_data[i][2]
points.InsertPoint(i, x, y, z)
poly = vtk.vtkPolyVertex()
poly.GetPointIds().SetNumberOfIds(len(ref_data))
cont = 0
while cont < len(ref_data):
poly.GetPointIds().SetId(cont, cont)
cont += 1
grid = vtk.vtkUnstructuredGrid()
grid.SetPoints(points)
grid.InsertNextCell(poly.GetCellType(), poly.GetPointIds())
mapper = vtk.vtkDataSetMapper()
if sys.hexversion == 34015984:
mapper.SetInputData(grid)
if sys.hexversion == 34015728:
mapper.SetInput(grid)
actor = vtk.vtkActor()
actor.SetMapper(mapper)
return actor
开发者ID:CoderXv,项目名称:medical_image_analyser,代码行数:33,代码来源:vessel_reconstruct.py
示例19: create_vessel_actor
def create_vessel_actor(ref_data):
vessel_ref_data = ref_data
points = vtk.vtkPoints()
# insert each properties of points into obj.
for i in range(vessel_ref_data.get_len_of_vassel_value()):
x = vessel_ref_data.get_abscissa_value_at(i)
y = vessel_ref_data.get_ordinate_value_at(i)
z = vessel_ref_data.get_iso_value_at(i)
points.InsertPoint(i, x, y, z)
poly = vtk.vtkPolyVertex()
poly.GetPointIds().SetNumberOfIds(vessel_ref_data.get_len_of_vassel_value())
cont = 0
while cont < vessel_ref_data.get_len_of_vassel_value():
poly.GetPointIds().SetId(cont, cont)
cont += 1
grid = vtk.vtkUnstructuredGrid()
grid.SetPoints(points)
grid.InsertNextCell(poly.GetCellType(), poly.GetPointIds())
mapper = vtk.vtkDataSetMapper()
if sys.hexversion == 34015984:
mapper.SetInputData(grid)
elif sys.hexversion == 34015728:
mapper.SetInput(grid)
actor = vtk.vtkActor()
actor.SetMapper(mapper)
return actor
开发者ID:CoderXv,项目名称:vas,代码行数:32,代码来源:MraImageDisplayWindow.py
示例20: GridSurface
def GridSurface(self):
#----------------------------------------------------------------------
# ELECTRODE CONTACT DELAUNAY TRIANGULATION ----------------------------
deln = vtk.vtkDelaunay3D()
deln.SetInput(self.electrodePolyData)
deln.SetTolerance(0.01)
tmapper = vtk.vtkTextureMapToSphere()
tmapper.SetInputConnection(deln.GetOutputPort())
#tmapper.PreventSeamOn()
mapper = vtk.vtkDataSetMapper()
mapper.SetInputConnection(tmapper.GetOutputPort())
# TEST TEXTURE PART
atext = vtk.vtkOpenGLTexture()
self.contactScalarData = vtk.vtkDoubleArray()
self.contactScalarData.SetNumberOfComponents(1)
for tupleID in range(self.electrodePolyData.GetNumberOfPoints()):
self.contactScalarData.InsertNextValue(random.uniform(0, 1))
self.UpdateGridSurface()
atext.SetInput(self.electrodePolyData)
self.triangulation = vtk.vtkOpenGLActor()
self.triangulation.SetMapper(mapper)
self.triangulation.SetTexture(atext)
self.triangulation.GetProperty().SetOpacity(1)
开发者ID:akhambhati,项目名称:NiftyElectrodeMapper,代码行数:26,代码来源:electrodes.py
注:本文中的vtk.vtkDataSetMapper函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论