本文整理汇总了Python中vtk.vtkActor函数的典型用法代码示例。如果您正苦于以下问题:Python vtkActor函数的具体用法?Python vtkActor怎么用?Python vtkActor使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkActor函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, reader):
self.reader = reader
sg = self.src_glyph = vtk.vtkSphereSource()
sg.SetRadius(0.5)
sg.SetCenter(0.5, 0.0, 0.0)
g = self.glyph = vtk.vtkTensorGlyph()
g.SetInputConnection(self.reader.GetOutputPort())
g.SetSource(self.src_glyph.GetOutput())
g.SetScaleFactor(0.25)
# The normals are needed to generate the right colors and if
# not used some of the glyphs are black.
self.normals = vtk.vtkPolyDataNormals()
self.normals.SetInputConnection(g.GetOutputPort())
self.map = vtk.vtkPolyDataMapper()
self.map.SetInputConnection(self.normals.GetOutputPort())
self.act = vtk.vtkActor()
self.act.SetMapper(self.map)
# An outline.
self.of = vtk.vtkOutlineFilter()
self.of.SetInputConnection(self.reader.GetOutputPort())
self.out_map = vtk.vtkPolyDataMapper()
self.out_map.SetInputConnection(self.of.GetOutputPort())
self.out_act = vtk.vtkActor()
self.out_act.SetMapper(self.out_map)
开发者ID:Armand0s,项目名称:homemade_vtk,代码行数:26,代码来源:TestTensorGlyph.py
示例2: plotvtk
def plotvtk(mesh,boundary):
meshMapper = vtk.vtkPolyDataMapper()
meshMapper.SetInputConnection(mesh.GetOutputPort())
meshActor = vtk.vtkActor()
meshActor.SetMapper(meshMapper)
meshActor.GetProperty().SetEdgeColor(0, 0, 1)
meshActor.GetProperty().SetInterpolationToFlat()
meshActor.GetProperty().SetRepresentationToWireframe()
boundaryMapper = vtk.vtkPolyDataMapper()
if vtk.VTK_MAJOR_VERSION <= 5:
boundaryMapper.SetInputConnection(boundary.GetProducerPort())
else:
boundaryMapper.SetInputData(boundary)
boundaryActor = vtk.vtkActor()
boundaryActor.SetMapper(boundaryMapper)
boundaryActor.GetProperty().SetColor(1, 0, 0)
renderer = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
renderWindow.AddRenderer(renderer)
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
renderWindowInteractor.SetRenderWindow(renderWindow)
renderer.AddActor(meshActor)
renderer.AddActor(boundaryActor)
renderer.SetBackground(.3, .6, .3)
renderWindowInteractor.Initialize()
renderWindow.Render()
renderWindowInteractor.Start()
开发者ID:remiboulardot,项目名称:afmmesh,代码行数:32,代码来源:afmmesher.py
示例3: __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
示例4: __init__
def __init__(self):
# Central dot
self.dot = vtk.vtkSphereSource()
self.dot.SetThetaResolution(20)
self.dot.SetRadius(.5)
self.dotMapper = vtk.vtkPolyDataMapper()
self.dotMapper.SetInputConnection(self.dot.GetOutputPort())
self.dotActor = vtk.vtkActor()
self.dotActor.SetMapper(self.dotMapper)
# Circular halo around dot
self.halo = vtk.vtkSphereSource()
self.halo.SetThetaResolution(20)
self.halo.SetRadius(2)
self.haloMapper = vtk.vtkPolyDataMapper()
self.haloMapper.SetInputConnection(self.halo.GetOutputPort())
self.haloActor = vtk.vtkActor()
self.haloActor.SetMapper(self.haloMapper)
self.dotActor.GetProperty().SetColor(red)
self.haloActor.GetProperty().SetColor(white)
self.haloActor.GetProperty().SetOpacity(0.1)
self.haloActor.GetProperty().SetSpecular(0.6)
self.actor = vtk.vtkAssembly()
self.actor.AddPart(self.dotActor)
self.actor.AddPart(self.haloActor)
开发者ID:cmcantalupo,项目名称:libra,代码行数:27,代码来源:vtkutils.py
示例5: plotContinents
def plotContinents(self,x1,x2,y1,y2,projection,wrap,tmpl):
contData = vcs2vtk.prepContinents(self.canvas._continents)
contMapper = vtk.vtkPolyDataMapper()
contMapper.SetInputData(contData)
contActor = vtk.vtkActor()
contActor.SetMapper(contMapper)
contActor.GetProperty().SetColor(0.,0.,0.)
contActor = vcs2vtk.doWrap(contActor,[x1,x2,y1,y2],wrap)
if projection.type!="linear":
contData=contActor.GetMapper().GetInput()
cpts = contData.GetPoints()
geo, gcpts = vcs2vtk.project(cpts,projection,[x1,x2,y1,y2])
contData.SetPoints(gcpts)
contMapper = vtk.vtkPolyDataMapper()
contMapper.SetInputData(contData)
contActor = vtk.vtkActor()
contActor.SetMapper(contMapper)
contActor.GetProperty().SetColor(0.,0.,0.)
else:
geo=None
ren = vtk.vtkRenderer()
self.renWin.AddRenderer(ren)
self.setLayer(ren,tmpl.data.priority)
vcs2vtk.fitToViewport(contActor,ren,[tmpl.data.x1,tmpl.data.x2,tmpl.data.y1,tmpl.data.y2],wc=[x1,x2,y1,y2],geo=geo)
if tmpl.data.priority!=0:
ren.AddActor(contActor)
开发者ID:arulalant,项目名称:uvcdat,代码行数:26,代码来源:VTKPlots.py
示例6: 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
示例7: render_image
def render_image(pointset):
delaunay = vtk.vtkDelaunay2D()
delaunay.SetTolerance(0.001)
delaunay.SetAlpha(18)
delaunay.SetInput(pointset);
delaunay.Update();
meshMapper = vtk.vtkPolyDataMapper()
meshMapper.SetInput(delaunay.GetOutput())
meshMapper.SetScalarRange(0,255)
meshActor = vtk.vtkActor()
meshActor.SetMapper(meshMapper)
boundaryMapper = vtk.vtkPolyDataMapper()
boundaryMapper.SetInput(delaunay.GetOutput())
boundaryActor = vtk.vtkActor()
boundaryActor.SetMapper(boundaryMapper);
boundaryActor.GetProperty().SetColor(0,0.55,0);
renderer = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
renderWindow.AddRenderer(renderer)
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
renderWindowInteractor.SetRenderWindow(renderWindow)
renderer.AddActor(meshActor)
renderer.AddActor(boundaryActor)
renderer.SetBackground(.5, .5, .5)
renderWindow.SetSize(600, 600)
renderWindow.Render()
renderWindowInteractor.Start()
开发者ID:arun04ceg,项目名称:2D-spatial-data,代码行数:33,代码来源:height_fields_thorax.py
示例8: test
def test(points, springs1, springs2):
app = QApplication(sys.argv)
window = Viewer3D.SimpleView()
polydata1 = GeneratePolydata.generateLinePolydata(points, springs1)
polydata2 = GeneratePolydata.generateLinePolydata(points, springs2)
mapper1 = vtk.vtkPolyDataMapper()
mapper1.SetInputData(polydata1)
actor1 = vtk.vtkActor()
actor1.SetMapper(mapper1)
mapper2 = vtk.vtkPolyDataMapper()
mapper2.SetInputData(polydata2)
actor2 = vtk.vtkActor()
actor2.SetMapper(mapper2)
actor1.GetProperty().SetColor(1,0,0)
actor2.GetProperty().SetColor(0,1,0.5)
window.ren.AddActor(actor1)
window.ren.AddActor(actor2)
window.start(app)
return
开发者ID:wzaylor,项目名称:Classwork,代码行数:25,代码来源:meshGen.py
示例9: make_sphere
def make_sphere():
global renderer
# ---------------------------------------------------------------
# The following code is identical to render_demo.py...
# ---------------------------------------------------------------
# create a sphere
sphere_src = vtk.vtkSphereSource()
sphere_src.SetRadius(1.0)
sphere_src.SetCenter(0.0, 0.0, 0.0)
sphere_src.SetThetaResolution(20)
sphere_src.SetPhiResolution(20)
# extract the edges
edge_extractor = vtk.vtkExtractEdges()
edge_extractor.SetInputConnection(sphere_src.GetOutputPort())
# map sphere and edges separately
sphere_mapper = vtk.vtkPolyDataMapper()
sphere_mapper.SetInputConnection(sphere_src.GetOutputPort())
edge_mapper = vtk.vtkPolyDataMapper()
edge_mapper.SetInputConnection(edge_extractor.GetOutputPort())
# define different rendering styles for sphere and edges
sphere_actor = vtk.vtkActor()
sphere_actor.SetMapper(sphere_mapper)
sphere_actor.GetProperty().SetColor(1, 0.5, 0)
edge_actor = vtk.vtkActor()
edge_actor.SetMapper(edge_mapper)
edge_actor.GetProperty().SetColor(0, 0.5, 0)
edge_actor.GetProperty().SetLineWidth(3)
# add resulting primitives to renderer
renderer.AddActor(sphere_actor)
renderer.AddActor(edge_actor)
开发者ID:CreativeCodingLab,项目名称:DarkSkyVis,代码行数:30,代码来源:interactor_demo.py
示例10: Execute
def Execute(self):
if (self._Surface == None):
self.PrintError('vmtkPickPointSeedSelector Error: Surface not set.')
return
self._SourceSeedIds.Initialize()
self._TargetSeedIds.Initialize()
if not self.vmtkRenderer:
self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
self.vmtkRenderer.Initialize()
self.OwnRenderer = 1
glyphs = vtk.vtkGlyph3D()
glyphSource = vtk.vtkSphereSource()
glyphs.SetInput(self.PickedSeeds)
glyphs.SetSource(glyphSource.GetOutput())
glyphs.SetScaleModeToDataScalingOff()
glyphs.SetScaleFactor(self._Surface.GetLength()*0.01)
glyphMapper = vtk.vtkPolyDataMapper()
glyphMapper.SetInput(glyphs.GetOutput())
self.SeedActor = vtk.vtkActor()
self.SeedActor.SetMapper(glyphMapper)
self.SeedActor.GetProperty().SetColor(1.0,0.0,0.0)
self.SeedActor.PickableOff()
self.vmtkRenderer.Renderer.AddActor(self.SeedActor)
self.vmtkRenderer.RenderWindowInteractor.AddObserver("KeyPressEvent", self.KeyPressed)
surfaceMapper = vtk.vtkPolyDataMapper()
surfaceMapper.SetInput(self._Surface)
surfaceMapper.ScalarVisibilityOff()
surfaceActor = vtk.vtkActor()
surfaceActor.SetMapper(surfaceMapper)
surfaceActor.GetProperty().SetOpacity(1.0)
self.vmtkRenderer.Renderer.AddActor(surfaceActor)
self.OutputText('Please position the mouse and press space to add source points, \'u\' to undo\n')
any = 0
while any == 0:
self.InitializeSeeds()
self.vmtkRenderer.Render()
any = self.PickedSeedIds.GetNumberOfIds()
self._SourceSeedIds.DeepCopy(self.PickedSeedIds)
self.OutputText('Please position the mouse and press space to add target points, \'u\' to undo\n')
any = 0
while any == 0:
self.InitializeSeeds()
self.vmtkRenderer.Render()
any = self.PickedSeedIds.GetNumberOfIds()
self._TargetSeedIds.DeepCopy(self.PickedSeedIds)
if self.OwnRenderer:
self.vmtkRenderer.Deallocate()
开发者ID:ValentinaRossi,项目名称:vmtk,代码行数:59,代码来源:vmtkcenterlines.py
示例11: visQuadFunc
def visQuadFunc():
""" vtk sample scene with iso contours """
# VTK supports implicit functions of the form f(x,y,z)=constant. These
# functions can represent things spheres, cones, etc. Here we use a
# general form for a quadric to create an elliptical data field.
quadric = vtk.vtkQuadric()
quadric.SetCoefficients(.5, 1, .2, 0, .1, 0, 0, .2, 0, 0)
# vtkSampleFunction samples an implicit function over the x-y-z range
# specified (here it defaults to -1,1 in the x,y,z directions).
sample = vtk.vtkSampleFunction()
sample.SetSampleDimensions(30, 30, 30)
sample.SetImplicitFunction(quadric)
# Create five surfaces F(x,y,z) = constant between range specified. The
# GenerateValues() method creates n isocontour values between the range
# specified.
contours = vtk.vtkContourFilter()
contours.SetInputConnection(sample.GetOutputPort())
contours.GenerateValues(8, 0.0, 1.2)
contMapper = vtk.vtkPolyDataMapper()
contMapper.SetInputConnection(contours.GetOutputPort())
contMapper.SetScalarRange(0.0, 1.2)
contActor = vtk.vtkActor()
contActor.SetMapper(contMapper)
# We'll put a simple outline around the data.
outline = vtk.vtkOutlineFilter()
outline.SetInputConnection(sample.GetOutputPort())
outlineMapper = vtk.vtkPolyDataMapper()
outlineMapper.SetInputConnection(outline.GetOutputPort())
outlineActor = vtk.vtkActor()
outlineActor.SetMapper(outlineMapper)
outlineActor.GetProperty().SetColor(1, 0.5, 0)
# extract data from the volume
extract = vtk.vtkExtractVOI()
extract.SetInputConnection(sample.GetOutputPort())
extract.SetVOI(0, 29, 0, 29, 15, 15)
extract.SetSampleRate(1, 2, 3)
contours2 = vtk.vtkContourFilter()
contours2.SetInputConnection(extract.GetOutputPort())
contours2.GenerateValues(8, 0.0, 1.2)
contMapper2 = vtk.vtkPolyDataMapper()
contMapper2.SetInputConnection(contours2.GetOutputPort())
contMapper2.SetScalarRange(0.0, 1.2)
contActor2 = vtk.vtkActor()
contActor2.SetMapper(contMapper2)
return contActor, contActor2, outlineActor, contours, contours2
开发者ID:alexlib,项目名称:PyDataNYC2015,代码行数:58,代码来源:scenes.py
示例12: BuildBackdrop
def BuildBackdrop (minX, maxX, minY, maxY, minZ, maxZ, thickness):
global basePlane
global baseMapper
global base
global backPlane
global backMapper
global back
global left
global leftPlane
global leftMapper
if not basePlane:
basePlane = vtk.vtkCubeSource()
basePlane.SetCenter( (maxX + minX)/2.0, minY, (maxZ + minZ)/2.0)
basePlane.SetXLength(maxX-minX)
basePlane.SetYLength(thickness)
basePlane.SetZLength(maxZ - minZ)
if not baseMapper:
baseMapper = vtk.vtkPolyDataMapper()
baseMapper.SetInput(basePlane.GetOutput())
if not base:
base = vtk.vtkActor()
base.SetMapper(baseMapper)
if not backPlane:
backPlane = vtk.vtkCubeSource()
backPlane.SetCenter( (maxX + minX)/2.0, (maxY + minY)/2.0, minZ)
backPlane.SetXLength(maxX-minX)
backPlane.SetYLength(maxY - minY)
backPlane.SetZLength(thickness)
if not backMapper:
backMapper = vtk.vtkPolyDataMapper()
backMapper.SetInput(backPlane.GetOutput())
if not back:
back = vtk.vtkActor()
back.SetMapper(backMapper)
if not leftPlane:
leftPlane = vtk.vtkCubeSource()
leftPlane.SetCenter( minX, (maxY+minY)/2.0, (maxZ+minZ)/2.0)
leftPlane.SetXLength(thickness)
leftPlane.SetYLength(maxY-minY)
leftPlane.SetZLength(maxZ-minZ)
if not leftMapper:
leftMapper = vtk.vtkPolyDataMapper()
leftMapper.SetInput(leftPlane.GetOutput())
if not left:
left = vtk.vtkActor()
left.SetMapper(leftMapper)
return [base, back, left]
开发者ID:unidevop,项目名称:sjtu-project-pipe,代码行数:57,代码来源:backdrop.py
示例13: build_constelation
def build_constelation(self,mol):
if mol.acteur == None :
MB.showwarning('Info','Select a molecule in the list')
return
if mol.symobs !=None:
mol.acteur.RemoveObserver(mol.symobs)
if mol.lsm!=[]:
for sm in mol.lsm:
self.gfx.renderer.RemoveActor(sm)
mol.lsm=[]
(xmin, xmax, ymin, ymax, zmin, zmax)= self.bounds
sym=open(self.symlistfile,'r')
for l in sym:
ms = l.split()
nbl = int(ms[6][1:])
if nbl not in mol.lnbsm:
continue
ang = [float(ms[0]),float(ms[1]),float(ms[2])]
tra = array([float(ms[3]),float(ms[4]),float(ms[5])])
sm=symmate() #on cree un symmate vide
sm.SetPosition(mol.acteur.GetPosition()) #on assigne la partie translationelle des pv
sm.SetOrientation(mol.acteur.GetOrientation()) #on assigne la partie rotationelle des pv
self.RotaEuler(sm.ut,ang[0],ang[1],ang[2]) #on defini la partie rotationelle de la transformation
sm.ut.Translate(tra[0],tra[1],tra[2]) #on defini la partie translationelle de la transformation
sm.SetUserTransform(sm.ut) #on assigne la transformation a notre symmate
pip = [sm.GetMatrix().GetElement(0,3),sm.GetMatrix().GetElement(1,3),sm.GetMatrix().GetElement(2,3)]#on recupere la partie translationelle de la combinaison de pv et de la transformation (ut)
if (xmin + self.mdbe < pip[0]) and (pip[0] < xmax - self.mdbe) and (ymin + self.mdbe < pip[1]) and (pip[1] < ymax - self.mdbe) and (zmin + self.mdbe < pip[2]) and (pip[2] < zmax - self.mdbe):# on test si pip est dans la boite
sm.nbsym=nbl
if mol.acteur.GetClassName()=='vtkAssembly':# dans le cas ou la molecule independante est un assembly
for i in range(mol.acteur.GetNumberOfPaths()):
tmp=vtk.vtkActor()
tmp.SetMapper(mol.acteur.GetParts().GetItemAsObject(i).GetMapper())
p=vtk.vtkProperty()
#p.SetColor(mol.acteur.GetParts().GetItemAsObject(i).GetProperty().GetColor())
p.SetColor(Map.invcolor(mol.acteur.GetParts().GetItemAsObject(i).GetProperty().GetColor()))
tmp.SetProperty(p)
if mol.mod.type=='mol':
tmp.GetProperty().SetLineWidth(4)
tmp.DragableOff()
tmp.PickableOff()
sm.AddPart(tmp)
else:#cas simple ou la mol ind est composer d un seul objet
tmp=vtk.vtkActor()
tmp.SetMapper(mol.acteur.GetMapper())
p=vtk.vtkProperty()
#p.SetColor(mol.acteur.GetParts().GetItemAsObject(i).GetProperty().GetColor())
p.SetColor(Map.invcolor(mol.acteur.GetProperty().GetColor()))
tmp.SetProperty(p)
if mol.mod.type=='mol':
tmp.GetProperty().SetLineWidth(4)
tmp.DragableOff()
tmp.PickableOff()
sm.AddPart(tmp)
mol.lsm+=[sm]# on ajoute le symmate a la liste des symmate
sym.close()
self.move_sym(mol)
开发者ID:ggoret,项目名称:VEDA,代码行数:56,代码来源:sym.py
示例14: Execute
def Execute(self):
self._SourceSeedIds.Initialize()
if not self.vmtkRenderer:
self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
self.vmtkRenderer.Initialize()
self.OwnRenderer = 1
glyphs = vtk.vtkGlyph3D()
glyphSource = vtk.vtkSphereSource()
glyphs.SetInputData(self.PickedSeeds)
glyphs.SetSourceConnection(glyphSource.GetOutputPort())
glyphs.SetScaleModeToDataScalingOff()
glyphs.SetScaleFactor(self._Surface.GetLength()*0.01)
glyphMapper = vtk.vtkPolyDataMapper()
glyphMapper.SetInputConnection(glyphs.GetOutputPort())
self.SeedActor = vtk.vtkActor()
self.SeedActor.SetMapper(glyphMapper)
self.SeedActor.GetProperty().SetColor(1.0,0.0,0.0)
self.SeedActor.PickableOff()
self.vmtkRenderer.Renderer.AddActor(self.SeedActor)
self.vmtkRenderer.AddKeyBinding('u','Undo.',self.UndoCallback)
self.vmtkRenderer.AddKeyBinding('space','Add points.',self.PickCallback)
surfaceMapper = vtk.vtkPolyDataMapper()
surfaceMapper.SetInputData(self._Surface)
surfaceMapper.ScalarVisibilityOff()
surfaceActor = vtk.vtkActor()
surfaceActor.SetMapper(surfaceMapper)
surfaceActor.GetProperty().SetOpacity(1)
self.vmtkRenderer.Renderer.AddActor(surfaceActor)
# create a text actor
txt = vtk.vtkTextActor()
info = "Position mouse and press space. "
info += "Select seeds in this order: RSpv, RIpv, LIpv, LSpv. "
info += "Fifth seed requires --use_laa_seed command."
txt.SetInput(info)
txtprop=txt.GetTextProperty()
txtprop.SetFontFamilyToArial()
txtprop.SetFontSize(13)
txtprop.SetColor(1, 1, 1)
txt.SetDisplayPosition(0, 10)
self.vmtkRenderer.Renderer.AddActor(txt)
any = 0
while any == 0:
self.InitializeSeeds()
self.vmtkRenderer.Render()
any = self.PickedSeedIds.GetNumberOfIds()
self._SourceSeedIds.DeepCopy(self.PickedSeedIds)
if self.OwnRenderer:
self.vmtkRenderer.Deallocate()
开发者ID:catactg,项目名称:SUM,代码行数:56,代码来源:seedselector.py
示例15: SetInputActor
def SetInputActor(self):
self.inputActor1 = vtk.vtkActor()
self.inputActor1.SetMapper(self.inputMapper1)
self.inputActor1.GetProperty().SetInterpolationToFlat()
self.inputActor2 = vtk.vtkActor()
self.inputActor2.SetMapper(self.inputMapper2)
self.inputActor3 = vtk.vtkActor()
self.inputActor3.SetMapper(self.inputMapper3)
self.inputActor4 = vtk.vtkActor()
self.inputActor4.SetMapper(self.inputMapper4)
开发者ID:KaWaiTsoi,项目名称:Test,代码行数:10,代码来源:visualHierarchyCompare.py
示例16: PlotEdges
def PlotEdges(mesh, angle):
featureEdges = vtk.vtkFeatureEdges()
if vtk.vtkVersion().GetVTKMajorVersion() >5:
featureEdges.SetInputData(mesh)
else:
featureEdges.SetInput(mesh)
featureEdges.FeatureEdgesOn()
featureEdges.BoundaryEdgesOff()
featureEdges.NonManifoldEdgesOff()
featureEdges.ManifoldEdgesOff()
featureEdges.SetFeatureAngle(angle)
edgeMapper = vtk.vtkPolyDataMapper();
edgeMapper.SetInputConnection(featureEdges.GetOutputPort());
edgeActor = vtk.vtkActor();
edgeActor.GetProperty().SetLineWidth(5);
edgeActor.SetMapper(edgeMapper)
mapper = vtk.vtkDataSetMapper()
if vtk.vtkVersion().GetVTKMajorVersion() >5:
mapper.SetInputData(mesh)
else:
mapper.SetInput(mesh)
# Actor
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor.GetProperty().LightingOff()
###############################
# Display
###############################
# Render
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# Allow user to interact
istyle = vtk.vtkInteractorStyleTrackballCamera()
iren.SetInteractorStyle(istyle)
ren.AddActor(actor)
ren.AddActor(edgeActor)
iren.Initialize()
renWin.Render()
iren.Start()
开发者ID:akaszynski,项目名称:PyACVD,代码行数:55,代码来源:VTK_Plotting.py
示例17: visualise_color
def visualise_color(surface,ref,case):
"""Visualise surface in solid color and 'ref' in trasparent."""
# create a text actor
txt = vtk.vtkTextActor()
txt.SetInput(case)
txtprop=txt.GetTextProperty()
txtprop.SetFontFamilyToArial()
txtprop.SetFontSize(18)
txtprop.SetColor(0, 0, 0)
txt.SetDisplayPosition(20, 30)
# create a rendering window, renderer, and renderwindowinteractor
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
iren = vtk.vtkRenderWindowInteractor()
style = vtk.vtkInteractorStyleTrackballCamera()
iren.SetInteractorStyle(style)
iren.SetRenderWindow(renWin)
# surface mapper and actor
surfacemapper = vtk.vtkPolyDataMapper()
surfacemapper.SetInputData(surface)
surfacemapper.SetScalarModeToUsePointFieldData()
surfaceactor = vtk.vtkActor()
surfaceactor.GetProperty().SetColor(288/255, 26/255, 28/255)
surfaceactor.SetMapper(surfacemapper)
# refsurface mapper and actor
refmapper = vtk.vtkPolyDataMapper()
refmapper.SetInputData(ref)
refmapper.SetScalarModeToUsePointFieldData()
refactor = vtk.vtkActor()
refactor.GetProperty().SetOpacity(0.5)
refactor.GetProperty().SetColor(1, 1, 1)
refactor.SetMapper(refmapper)
# assign actors to the renderer
ren.AddActor(surfaceactor)
ren.AddActor(refactor)
ren.AddActor(txt)
# set the background and size; zoom in; and render
ren.SetBackground(1, 1, 1)
renWin.SetSize(800 , 800)
ren.ResetCamera()
ren.GetActiveCamera().Zoom(1)
# enable user interface interactor
iren.Initialize()
renWin.Render()
iren.Start()
开发者ID:catactg,项目名称:SUM,代码行数:54,代码来源:basefunctions.py
示例18: __init__
def __init__(self, parent = None):
super(VTKFrame, self).__init__(parent)
self.vtkWidget = QVTKRenderWindowInteractor(self)
vl = QtGui.QVBoxLayout(self)
vl.addWidget(self.vtkWidget)
vl.setContentsMargins(0, 0, 0, 0)
self.ren = vtk.vtkRenderer()
self.vtkWidget.GetRenderWindow().AddRenderer(self.ren)
self.iren = self.vtkWidget.GetRenderWindow().GetInteractor()
#Create a cube
cube=vtk.vtkCubeSource()
cube.SetXLength(40)
cube.SetYLength(30)
cube.SetZLength(20)
cubeMapper=vtk.vtkPolyDataMapper()
cubeMapper.SetInputConnection(cube.GetOutputPort())
#create a plane to cut,here it cuts in the XZ direction (xz normal=(1,0,0);XY =(0,0,1),YZ =(0,1,0)
plane=vtk.vtkPlane()
plane.SetOrigin(10,0,0)
plane.SetNormal(1,0,0)
#create cutter
cutter=vtk.vtkCutter()
cutter.SetCutFunction(plane)
cutter.SetInputConnection(cube.GetOutputPort())
cutter.Update()
cutterMapper=vtk.vtkPolyDataMapper()
cutterMapper.SetInputConnection( cutter.GetOutputPort())
#create plane actor
planeActor=vtk.vtkActor()
planeActor.GetProperty().SetColor(1.0,1,0)
planeActor.GetProperty().SetLineWidth(2)
planeActor.SetMapper(cutterMapper)
#create cube actor
cubeActor=vtk.vtkActor()
cubeActor.GetProperty().SetColor(0.5,1,0.5)
cubeActor.GetProperty().SetOpacity(0.5)
cubeActor.SetMapper(cubeMapper)
#create renderers and add actors of plane and cube
self.ren.AddActor(planeActor)
self.ren.AddActor(cubeActor)
self.ren.ResetCamera()
self._initialized = False
开发者ID:dbzhang800,项目名称:VTKDemoForPyQt,代码行数:51,代码来源:cutter.py
示例19: initializeView
def initializeView():
mapOutline = vtk.vtkPolyDataMapper()
mapOutline.SetInputConnection(outlineData.GetOutputPort())
outline = vtk.vtkActor()
outline.SetMapper(mapOutline)
outline.GetProperty().SetColor(0, 0, 0)
skinMapper = vtk.vtkPolyDataMapper()
skinMapper.SetInputConnection(skinNormals.GetOutputPort())
skinMapper.ScalarVisibilityOff()
skin = vtk.vtkActor()
skin.SetMapper(skinMapper)
attachProp(outline, vtkNode)
attachProp(skin, vtkNode)
开发者ID:omega-hub,项目名称:omegaVtk,代码行数:14,代码来源:ExtractGeometry.py
示例20: __init__
def __init__(self):
self.source = None
self.target = None
self.transformed = None
self.iteration =200
self.icp= vtk.vtkIterativeClosestPointTransform()
self.icptf = vtk.vtkTransformPolyDataFilter()
self.mappers =vtk.vtkPolyDataMapper()
self.mappert =vtk.vtkPolyDataMapper()
self.mappertf =vtk.vtkPolyDataMapper()
self.actors = vtk.vtkActor()
self.actort = vtk.vtkActor()
self.actortf = vtk.vtkActor()
self.centroidon= False
开发者ID:sukhbinder,项目名称:PythonICPvtk,代码行数:14,代码来源:vtk_ICP_real_App.py
注:本文中的vtk.vtkActor函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论