本文整理汇总了Python中vtk.vtkPolyDataMapper函数的典型用法代码示例。如果您正苦于以下问题:Python vtkPolyDataMapper函数的具体用法?Python vtkPolyDataMapper怎么用?Python vtkPolyDataMapper使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkPolyDataMapper函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, parent, visualizer, **kws):
"""
Initialization
"""
VisualizationModule.__init__(self, parent, visualizer, **kws)
self.descs = {"TrackFile": "Tracks file", #"AllTracks": "Show all tracks", \
"MinLength": "Min. length of track (# of timepoints)",
"SphereRadius": "Sphere radius",
"TubeRadius": "Tube radius",
"SameStartingPoint": "Visualize tracks starting from same point"}
self.showTracks = []
self.lineMapper = vtk.vtkPolyDataMapper()
self.sphereMapper = vtk.vtkPolyDataMapper()
self.firstMapper = vtk.vtkPolyDataMapper()
self.lastMapper = vtk.vtkPolyDataMapper()
self.currentMapper = vtk.vtkPolyDataMapper()
self.actors = []
self.renderer = self.parent.getRenderer()
#iactor = self.wxrenwin.GetRenderWindow().GetInteractor()
lib.messenger.connect(None, "visualize_tracks", self.onVisualizeTracks)
self.filterDesc = "Visualize created motion tracks"
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:25,代码来源:VisualizeTrack.py
示例2: _MakeActors
def _MakeActors(self):
actors = []
# lines
for i in range(3):
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(self._Cutters[i].GetOutputPort())
actor = self._NewActor()
actor.SetProperty(self._Properties[i])
actor.SetMapper(mapper)
actor.PickableOff()
actors.append(actor)
# use index to track actors in different renderers
self._LineActorsIndex = (0, 1, 2)
# cones
for i in range(6):
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(self._Cones[i].GetOutputPort())
actor = self._NewActor()
actor.SetProperty(self._ConeProperties[i / 2])
actor.SetMapper(mapper)
actor.PickableOff()
actors.append(actor)
self._ConeActorsIndex = (3, 4, 5, 6, 7, 8)
return actors
开发者ID:parallaxinnovations,项目名称:vtkEVS,代码行数:28,代码来源:OrthoPlanesIntersectionsFactory.py
示例3: _MakeActors
def _MakeActors(self):
actors = []
# 4 corners
for i in range(4):
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(self._Corners[i].GetOutput())
actor = self._NewActor()
actor.SetProperty(self._CornerProperty)
actor.SetMapper(mapper)
actors.append(actor)
# center
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(self._Center.GetOutput())
actor = self._NewActor()
actor.SetProperty(self._CenterProperty)
actor.SetMapper(mapper)
actors.append(actor)
# rectangle roi
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(self._ROI.GetOutput())
actor = self._NewActor()
actor.SetProperty(self._ROIProperty)
actor.SetMapper(mapper)
actor.PickableOff()
actors.append(actor)
return actors
开发者ID:parallaxinnovations,项目名称:vtkEVS,代码行数:29,代码来源:RectROIFactory.py
示例4: 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
示例5: 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
示例6: main
def main(self):
print("main builder")
window = self.widget.GetRenderWindow()
window.AddRenderer(self.rend)
self.addGeometry()
self.addAltGeometry()
self.buildLookupTable()
#self.startWireframeLight()
self.createTriAxes()
textSize = 14 * self.magnify
self.createText([5, 50], 'Max ', textSize) # text actor 0
self.createText([5, 35], 'Min ', textSize) # text actor 1
self.createText([5, 20], 'Word1', textSize) # text actor 2
self.createText([5, 5], 'Word2', textSize) # text actor 3
#self.createText([5,35],'Yet Again', textSize)
# Create the usual rendering stuff.
self.get_edges()
if self.is_edges:
prop = self.edgeActor.GetProperty()
prop.EdgeVisibilityOn()
else:
prop = self.edgeActor.GetProperty()
prop.EdgeVisibilityOff()
self.rend.GetActiveCamera().ParallelProjectionOn()
self.rend.SetBackground(.1, .2, .4)
vtk.vtkPolyDataMapper().SetResolveCoincidentTopologyToPolygonOffset()
self.rend.ResetCamera()
开发者ID:sukhbinder,项目名称:cyNastran,代码行数:31,代码来源:pan.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: __init__
def __init__(self, renderer):
Visualizer.__init__(self)
assert isinstance(renderer, vtk.vtkRenderer)
self.ren = renderer
# -------- add the beam ----
# geometry
self.beam = vtk.vtkCubeSource()
self.beam.SetXLength(st.visBeamLength)
self.beam.SetYLength(st.visBeamWidth)
self.beam.SetZLength(st.visBeamDepth)
# mapper
self.beamMapper = vtk.vtkPolyDataMapper()
self.beamMapper.SetInputConnection(self.beam.GetOutputPort())
# actor
self.beamActor = vtk.vtkLODActor()
self.beamActor.SetMapper(self.beamMapper)
# make it look nice
self.beamProp = self.beamActor.GetProperty()
self.beamProp.SetColor(101 / 255, 123 / 255, 131 / 255)
self.ren.AddActor(self.beamActor)
# -------- add the ball ----
# geometry
self.ball = vtk.vtkSphereSource()
self.ball.SetRadius(st.visR)
self.ball.SetThetaResolution(20)
self.ball.SetPhiResolution(20)
# mapper
self.ballMapper = vtk.vtkPolyDataMapper()
self.ballMapper.SetInputConnection(self.ball.GetOutputPort())
# actor
self.ballActor = vtk.vtkLODActor()
self.ballActor.SetMapper(self.ballMapper)
# make it look nice
self.ballProp = self.ballActor.GetProperty()
self.ballProp.SetColor(255 / 255, 255 / 255, 0)
self.ballProp.SetAmbient(0.2)
self.ballProp.SetDiffuse(0.8)
self.ballProp.SetSpecular(0.5)
self.ballProp.SetSpecularPower(0.5)
self.ren.AddActor(self.ballActor)
# add background
self.ren.GradientBackgroundOn()
self.ren.SetBackground(228 / 255, 232 / 255, 213 / 255)
self.ren.SetBackground2(38 / 255, 139 / 255, 210 / 255)
# get everybody into the frame
self.ren.ResetCamera()
self.ren.GetActiveCamera().Zoom(1.7)
开发者ID:cklb,项目名称:pymoskito,代码行数:60,代码来源:visualization.py
示例9: __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
示例10: addPoints
def addPoints(self, points, color, thick=False, thickness=_DEFAULT_POINT_THICKNESS):
vtkPoints = vtk.vtkPoints()
for point in points:
vtkPoints.InsertNextPoint(point[0], point[1], point[2])
pointsPolyData = vtk.vtkPolyData()
pointsPolyData.SetPoints(vtkPoints)
if thick:
sphereSource = vtk.vtkSphereSource()
sphereSource.SetRadius(thickness)
glyph3D = vtk.vtkGlyph3D()
glyph3D.SetSourceConnection(sphereSource.GetOutputPort())
glyph3D.SetInputData(pointsPolyData)
glyph3D.Update()
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(glyph3D.GetOutputPort())
else:
vertexFilter = vtk.vtkVertexGlyphFilter()
vertexFilter.SetInputData(pointsPolyData)
vertexFilter.Update()
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputData(vertexFilter.GetOutput())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor.GetProperty().SetColor(color)
self._rendererScene.AddActor(actor)
开发者ID:trianam,项目名称:voropath,代码行数:32,代码来源:plotter.py
示例11: 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
示例12: __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
示例13: add_edge
def add_edge(self, start, end, colour=Colours.BASE0):
"""Appends an edge to the edges list."""
# Line
line = vtkLineSource()
line.SetPoint1(start)
line.SetPoint2(end)
# Line Mapper
line_mapper = vtkPolyDataMapper()
line_mapper.SetInputConnection(line.GetOutputPort())
self.edge_colours.append(colour)
self.line_mappers.append(line_mapper)
# Bar
bar = vtkTubeFilter()
bar.SetInputConnection(line.GetOutputPort())
bar.SetRadius(2.5)
self.bar_data.append(bar)
# Bar Mapper
# Tried this, but mapping the ribbon caused beaucoup errors,
# debugging would take a week.There must be some kind of way
# out of here.
# Said the joker to the thief
# There's too much confusion
# I can't get no relief
# No reason to get excited, the thief he kindly spoke
# But you and I have been through that
# And this is not our fate
# So let us not talk falsely now, the hour is getting late.
# (2011-08-12)
bar_mapper = vtkPolyDataMapper()
bar_mapper.SetInputConnection(bar.GetOutputPort())
self.bar_mappers.append(bar_mapper)
开发者ID:TomRegan,项目名称:synedoche,代码行数:31,代码来源:Graphics.py
示例14: addCube
def addCube(self,pos,tam,img=False):
jpegfile = "struct.jpg"
# Read the image data from a file
reader = vtk.vtkJPEGReader()
reader.SetFileName(jpegfile)
(x,y,z) = pos
(i,j,k) = tam
cubito = vtk.vtkCubeSource()
cubito.SetXLength(0.2*i)
cubito.SetYLength(0.2*j)
cubito.SetZLength(0.2*k)
cubito.SetCenter((x,y,z))
if img == True:
# Create texture object
texture = vtk.vtkTexture()
if vtk.VTK_MAJOR_VERSION <= 5:
texture.SetInput(reader.GetOutput())
else:
texture.SetInputConnection(reader.GetOutputPort())
# Map texture coordinates
map_to_sphere = vtk.vtkTextureMapToPlane()
if vtk.VTK_MAJOR_VERSION <= 5:
map_to_sphere.SetInput(cubito.GetOutput())
else:
map_to_sphere.SetInputConnection(cubito.GetOutputPort())
#map_to_sphere.PreventSeamOn()
# Create mapper and set the mapped texture as input
mapper = vtk.vtkPolyDataMapper()
if vtk.VTK_MAJOR_VERSION <= 5:
mapper.SetInput(map_to_sphere.GetOutput())
else:
mapper.SetInputConnection(map_to_sphere.GetOutputPort())
planeMapper = vtk.vtkPolyDataMapper()
planeMapper.SetInputConnection(cubito.GetOutputPort())
planeActor = (vtk.vtkActor())
if (img == True):
planeActor.SetMapper(mapper)
else:
planeActor.SetMapper(planeMapper)# mapper planeMapper
planeActor.DragableOn()
planeActor.SetDragable(1)
if (img== True):
planeActor.SetTexture(texture)
else:
planeActor.GetProperty().SetColor(.0,.3,.6)
planeActor.GetProperty().SetOpacity(0.95)
#planeActor.GetProperty().SetAmbient(0)
#planeActor.GetProperty().SetDiffuse(0.9)
#planeActor.GetProperty().SetSpecular(0.1)
self.render.AddActor(planeActor)
return planeActor
开发者ID:Jovior85,项目名称:NavEsp,代码行数:60,代码来源:Renderer.py
示例15: update_viewer
def update_viewer(self, event, *args):
MarkerWindowInteractor.update_viewer(self, event, *args)
if event=='color marker':
marker, color = args
marker.set_color(color)
elif event=='label marker':
marker, label = args
marker.set_label(label)
if shared.debug: print "Create VTK-Text", marker.get_label()
text = vtk.vtkVectorText()
text.SetText(marker.get_label())
textMapper = vtk.vtkPolyDataMapper()
textMapper.SetInput(text.GetOutput())
textActor = self.textActors[marker]
textActor.SetMapper(textMapper)
elif event=='move marker':
marker, center = args
marker.set_center(center)
#update the select boxes and text actor
textActor = self.textActors[marker]
size = marker.get_size()
textActor.SetScale(size, size, size)
x,y,z = marker.get_center()
textActor.SetPosition(x+size, y+size, z+size)
if self.boxes.has_key(marker):
selectActor = self.boxes[marker]
boxSource = vtk.vtkCubeSource()
boxSource.SetBounds(marker.GetBounds())
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(boxSource.GetOutput())
selectActor.SetMapper(mapper)
elif event=='labels on':
actors = self.textActors.values()
for actor in actors:
actor.VisibilityOn()
elif event=='labels off':
actors = self.textActors.values()
for actor in actors:
actor.VisibilityOff()
#elif event=='select marker':
# marker = args[0]
# actor = create_box_actor_around_marker(marker)
# if shared.debug: print "PlaneWidgetsXYZ.update_viewer(): self.renderer.AddActor(actor)"
# self.renderer.AddActor(actor)
# self.boxes[marker] = actor
#elif event=='unselect marker':
# marker = args[0]
# actor = self.boxes[marker]
# print "pwxyz: u m", repr(marker), repr(actor)
# self.renderer.RemoveActor(actor)
# del self.boxes[marker]
elif event=="set axes directions":
self.add_axes_labels()
EventHandler().notify('observers update plane')
self.Render()
开发者ID:neurodebian,项目名称:PyLocator,代码行数:60,代码来源:plane_widgets_xyz.py
示例16: 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
示例17: __init__
def __init__(self, parent, visualizer, **kws):
"""
Initialization
"""
self.x, self.y, self.z = -1, -1, -1
VisualizationModule.__init__(self, parent, visualizer, **kws)
self.on = 0
self.renew = 1
self.mapper = vtk.vtkPolyDataMapper()
self.eventDesc = "Rendering orthogonal slices"
self.outline = vtk.vtkOutlineFilter()
self.outlineMapper = vtk.vtkPolyDataMapper()
self.outlineActor = vtk.vtkActor()
self.outlineActor.SetMapper(self.outlineMapper)
self.picker = vtk.vtkCellPicker()
self.picker.SetTolerance(0.005)
self.planeWidgetX = vtk.vtkImagePlaneWidget()
self.planeWidgetX.DisplayTextOn()
self.planeWidgetX.SetPicker(self.picker)
self.planeWidgetX.SetKeyPressActivationValue("x")
#self.planeWidgetX.UserControlledLookupTableOn()
self.prop1 = self.planeWidgetX.GetPlaneProperty()
#self.prop1.SetColor(1, 0, 0)
self.planeWidgetX.SetResliceInterpolateToCubic()
self.planeWidgetY = vtk.vtkImagePlaneWidget()
self.planeWidgetY.DisplayTextOn()
self.planeWidgetY.SetPicker(self.picker)
self.planeWidgetY.SetKeyPressActivationValue("y")
self.prop2 = self.planeWidgetY.GetPlaneProperty()
self.planeWidgetY.SetResliceInterpolateToCubic()
#self.planeWidgetY.UserControlledLookupTableOn()
#self.prop2.SetColor(1, 1, 0)
# for the z-slice, turn off texture interpolation:
# interpolation is now nearest neighbour, to demonstrate
# cross-hair cursor snapping to pixel centers
self.planeWidgetZ = vtk.vtkImagePlaneWidget()
self.planeWidgetZ.DisplayTextOn()
self.planeWidgetZ.SetPicker(self.picker)
self.planeWidgetZ.SetKeyPressActivationValue("z")
self.prop3 = self.planeWidgetZ.GetPlaneProperty()
#self.prop3.SetColor(1, 0, 1)
#self.planeWidgetZ.UserControlledLookupTableOn()
self.planeWidgetZ.SetResliceInterpolateToCubic()
self.renderer = self.parent.getRenderer()
self.renderer.AddActor(self.outlineActor)
self.useOutline = 1
iactor = self.wxrenwin.GetRenderWindow().GetInteractor()
self.planeWidgetX.SetInteractor(iactor)
self.planeWidgetY.SetInteractor(iactor)
self.planeWidgetZ.SetInteractor(iactor)
lib.messenger.connect(None, "zslice_changed", self.setZ)
self.filterDesc = "View orthogonal slices"
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:59,代码来源:Orthogonal.py
示例18: 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
示例19: 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
示例20: CreateAxes
def CreateAxes():
global xAxis, yAxis, zAxis, popSplatter
# Create axes.
popSplatter.Update()
bounds = popSplatter.GetOutput().GetBounds()
axes = vtk.vtkAxes()
axes.SetOrigin(bounds[0], bounds[2], bounds[4])
axes.SetScaleFactor(popSplatter.GetOutput().GetLength()/5.0)
axesTubes = vtk.vtkTubeFilter()
axesTubes.SetInputConnection(axes.GetOutputPort())
axesTubes.SetRadius(axes.GetScaleFactor()/25.0)
axesTubes.SetNumberOfSides(6)
axesMapper = vtk.vtkPolyDataMapper()
axesMapper.SetInputConnection(axesTubes.GetOutputPort())
axesActor = vtk.vtkActor()
axesActor.SetMapper(axesMapper)
# Label the axes.
XText = vtk.vtkVectorText()
XText.SetText(xAxis)
XTextMapper = vtk.vtkPolyDataMapper()
XTextMapper.SetInputConnection(XText.GetOutputPort())
XActor = vtk.vtkFollower()
XActor.SetMapper(XTextMapper)
XActor.SetScale(0.02, .02, .02)
XActor.SetPosition(0.35, -0.05, -0.05)
XActor.GetProperty().SetColor(0, 0, 0)
YText = vtk.vtkVectorText()
YText.SetText(yAxis)
YTextMapper = vtk.vtkPolyDataMapper()
YTextMapper.SetInputConnection(YText.GetOutputPort())
YActor = vtk.vtkFollower()
YActor.SetMapper(YTextMapper)
YActor.SetScale(0.02, .02, .02)
YActor.SetPosition(-0.05, 0.35, -0.05)
YActor.GetProperty().SetColor(0, 0, 0)
ZText = vtk.vtkVectorText()
ZText.SetText(zAxis)
ZTextMapper = vtk.vtkPolyDataMapper()
ZTextMapper.SetInputConnection(ZText.GetOutputPort())
ZActor = vtk.vtkFollower()
ZActor.SetMapper(ZTextMapper)
ZActor.SetScale(0.02, .02, .02)
ZActor.SetPosition(-0.05, -0.05, 0.35)
ZActor.GetProperty().SetColor(0, 0, 0)
return axesActor, XActor, YActor, ZActor
开发者ID:ElsevierSoftwareX,项目名称:SOFTX-D-15-00004,代码行数:58,代码来源:FinancialField.py
注:本文中的vtk.vtkPolyDataMapper函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论