本文整理汇总了Python中vtk.vtkRenderWindow函数的典型用法代码示例。如果您正苦于以下问题:Python vtkRenderWindow函数的具体用法?Python vtkRenderWindow怎么用?Python vtkRenderWindow使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkRenderWindow函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: WriteImage
def WriteImage(self, m_outFileName="./Dump/tmp.png", m_dimension=[400, 400]):
"""
Write current renderer to a png file. For Debug
:param m_outFileName: [str] Output name of the file, can be directory name. Default="./Dump/tmp.png"
:param m_dimension: [x, y]. Dimension, i.e. width and height of the image file.
:return:
"""
if self._renderer.GetRenderWindow() == None:
self._renderWindow.AddRenderer(self._renderer)
elif self._renderer.GetRenderWindow() != self._renderWindow:
self._renderer.GetRenderWindow().Finalize()
self._renderWindow = vtk.vtkRenderWindow()
self._renderWindow.AddRenderer(self._renderer)
else:
self._renderWindow = vtk.vtkRenderWindow()
self._renderWindow.AddRenderer(self._renderer)
self._renderWindow.SetOffScreenRendering(1)
self._renderWindow.SetSize(m_dimension)
self._renderWindow.Render()
self._renderWindow.SetAAFrames(10)
m_writer = vtk.vtkPNGWriter()
m_wintoim = vtk.vtkWindowToImageFilter()
m_wintoim.SetInput(self._renderWindow)
m_wintoim.Update()
m_writer.SetInputConnection(m_wintoim.GetOutputPort())
m_writer.SetFileName(m_outFileName)
m_writer.Write()
pass
开发者ID:teracamo,项目名称:vtkSemiUniformGridding,代码行数:34,代码来源:PolyDataHandler.py
示例2: main
def main():
#Create a sphere
sphereSource = vtk.vtkSphereSource()
sphereSource.SetCenter(0.0, 0.0, 0.0)
sphereSource.SetRadius(5)
#Create a mapper and actor
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(sphereSource.GetOutputPort())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
# Setup a renderer, render window, and interactor
renderer = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
#renderWindow.SetWindowName("Test")
renderWindow.AddRenderer(renderer);
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
renderWindowInteractor.SetRenderWindow(renderWindow)
#Add the actor to the scene
renderer.AddActor(actor)
renderer.SetBackground(1,1,1) # Background color white
#Render and interact
renderWindow.Render()
#*** SetWindowName after renderWindow.Render() is called***
renderWindow.SetWindowName("Test")
renderWindowInteractor.Start()
开发者ID:alon,项目名称:chibi-juggling,代码行数:32,代码来源:viewer.py
示例3: testStyleJoystickActor
def testStyleJoystickActor(self):
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
iRen = vtk.vtkRenderWindowInteractor()
iRen.SetRenderWindow(renWin)
testStyleBaseSpike = TestStyleBaseSpike.StyleBaseSpike(ren, renWin, iRen)
# Set interactor style
inStyle = vtk.vtkInteractorStyleSwitch()
iRen.SetInteractorStyle(inStyle)
# Switch to Joystick+Actor mode
iRen.SetKeyEventInformation(0, 0, "j", 0)
iRen.InvokeEvent("CharEvent")
iRen.SetKeyEventInformation(0, 0, "a", 0)
iRen.InvokeEvent("CharEvent")
# Test style
testStyleBase = TestStyleBase.TestStyleBase(ren)
testStyleBase.test_style(inStyle.GetCurrentStyle())
# render and interact with data
img_file = "TestStyleJoystickActor.png"
vtk.test.Testing.compareImage(iRen.GetRenderWindow(), vtk.test.Testing.getAbsImagePath(img_file), threshold=25)
vtk.test.Testing.interact()
开发者ID:jlec,项目名称:VTK,代码行数:29,代码来源:TestStyleJoystickActor.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: compute
def compute(self):
r = self.get_input("renderer").vtkInstance
window = vtk.vtkRenderWindow()
w = self.force_get_input("width", 512)
h = self.force_get_input("height", 512)
window.OffScreenRenderingOn()
window.SetSize(w, h)
# r.ResetCamera()
widget = None
if system.systemType=='Darwin':
from PyQt4 import QtCore, QtGui
widget = QtGui.QWidget(None, QtCore.Qt.FramelessWindowHint)
widget.resize(w, h)
widget.show()
window.SetWindowInfo(str(int(widget.winId())))
window.AddRenderer(r)
# window.Start()
window.Render()
win2image = vtk.vtkWindowToImageFilter()
win2image.SetInput(window)
win2image.Update()
writer = vtk.vtkPNGWriter()
writer.SetInput(win2image.GetOutput())
output = self.interpreter.filePool.create_file(suffix='.png')
writer.SetFileName(output.name)
writer.Write()
window.Finalize()
if widget!=None:
widget.close()
self.set_output("image", output)
开发者ID:Nikea,项目名称:VisTrails,代码行数:32,代码来源:offscreen.py
示例6: __init__
def __init__(self, file_list,spacing_list,feature_type,irad = 1.2, h_th=-200,
glyph_type='sphere', glyph_scale_factor=1,use_field_data=True, opacity_list=[],
color_list=[], lung=[]):
assert feature_type == "ridge_line" or feature_type == "valley_line" \
or feature_type == "ridge_surface" or feature_type == "valley_surface" \
or feature_type == "vessel" or feature_type == "airway" \
or feature_type == "fissure", "Invalid feature type"
if feature_type == "airway":
feature_type = "valley_line"
elif feature_type == "vessel":
feature_type = "ridge_line"
elif feature_type == "fissure":
feature_type = "ridge_surface"
self.mapper_list = list()
self.actor_list = list()
self.glyph_list = list()
self.glyph_type = glyph_type
self.file_list = file_list
self.spacing_list = spacing_list
self.opacity_list = opacity_list
self.irad = irad
self.h_th = h_th
self.color_list = color_list
self.lung = lung
self.use_field_data = use_field_data
self.feature_type = feature_type
self.normal_map=dict()
self.normal_map['ridge_line'] = "hevec0"
self.normal_map['valley_line'] = "hevec2"
self.normal_map['ridge_surface'] = "hevec2"
self.normal_map['valley_surface'] = "hevec0"
self.strength_map=dict()
self.strength_map['ridge_line'] = "h1"
self.strength_map['valley_line'] = "h1"
self.strength_map['ridge_surface'] = "h2"
self.strength_map['valley_surface'] = "h0"
if feature_type == 'ridge_line' or feature_type == 'valley_line':
self.height = irad
self.radius = 0.5
elif feature_type == 'ridge_surface' or feature_type == 'valley_surface':
self.height = 0.5
self.radius = irad
self.min_rad = 0.5
self.max_rad = 6
self.glyph_scale_factor = glyph_scale_factor
self.capture_prefix = ""
self.capture_count = 1
# VTK Objects
self.ren = vtk.vtkRenderer()
self.renWin = vtk.vtkRenderWindow()
self.iren = vtk.vtkRenderWindowInteractor()
self.image_count = 1
开发者ID:151706061,项目名称:ChestImagingPlatform,代码行数:60,代码来源:display_particles.py
示例7: initialize
def initialize(self):
global renderer, renderWindow, renderWindowInteractor, cone, mapper, actor
# Bring used components
self.registerVtkWebProtocol(protocols.vtkWebMouseHandler())
self.registerVtkWebProtocol(protocols.vtkWebViewPort())
self.registerVtkWebProtocol(protocols.vtkWebViewPortImageDelivery())
self.registerVtkWebProtocol(protocols.vtkWebViewPortGeometryDelivery())
# Create default pipeline (Only once for all the session)
if not _WebCone.view:
# VTK specific code
renderer = vtk.vtkRenderer()
renderWindow = vtk.vtkRenderWindow()
renderWindow.AddRenderer(renderer)
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
renderWindowInteractor.SetRenderWindow(renderWindow)
renderWindowInteractor.GetInteractorStyle().SetCurrentStyleToTrackballCamera()
cone = vtk.vtkConeSource()
mapper = vtk.vtkPolyDataMapper()
actor = vtk.vtkActor()
mapper.SetInputConnection(cone.GetOutputPort())
actor.SetMapper(mapper)
renderer.AddActor(actor)
renderer.ResetCamera()
renderWindow.Render()
# VTK Web application specific
_WebCone.view = renderWindow
self.Application.GetObjectIdMap().SetActiveObject("VIEW", renderWindow)
开发者ID:berendkleinhaneveld,项目名称:VTK,代码行数:34,代码来源:vtk_web_cone.py
示例8: __test_adjust_sphere
def __test_adjust_sphere():
import vtk
n_points = 4
points = []
for i in xrange(n_points):
p = np.random.random(3) * 100
points.append(p)
r, ctr = adjust_sphere(points)
r2 = r / 10
ren_win = vtk.vtkRenderWindow()
iren = vtk.vtkRenderWindowInteractor()
iren.SetInteractorStyle(vtk.vtkInteractorStyleTrackballCamera())
iren.SetRenderWindow(ren_win)
ren = vtk.vtkRenderer()
ren_win.AddRenderer(ren)
# draw points
for p in points:
__add_sphere_to_ren(p, r2, ren)
#draw big sphere
ac = __add_sphere_to_ren(ctr, r, ren)
ac.GetProperty().SetColor((1, 0, 0))
iren.Initialize()
iren.Start()
开发者ID:deherinu,项目名称:TmsViewer,代码行数:25,代码来源:tms_geom.py
示例9: initialize
def initialize():
# Create a rendering window and renderer
transform = vtk.vtkTransform()
transform.Scale(10.0, 10.0, 10.0)
axes = vtk.vtkAxesActor()
axes.SetUserTransform(transform)
transform.Translate(3.0, -2.0, 0.0)
axes.SetUserTransform(transform)
ren = vtk.vtkRenderer()
ren.AddActor(axes)
ren.ResetCamera()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
# Create a RenderWindowInteractor to permit manipulating the camera
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
style = vtk.vtkInteractorStyleTrackballCamera()
iren.SetInteractorStyle(style)
# enable user interface interactor
iren.Initialize()
renWin.Render()
iren.Start()
return ren, iren, renWin
开发者ID:Andrew-AbiMansour,项目名称:PyDEM,代码行数:31,代码来源:visualize.py
示例10: render_to_image
def render_to_image(output_filename, vtk_format, renderer, w, h):
window = vtk.vtkRenderWindow()
window.OffScreenRenderingOn()
window.SetSize(w, h)
# FIXME think this may be fixed in VTK6 so we don't have this
# dependency...
widget = None
if systemType=='Darwin':
from PyQt4 import QtCore, QtGui
widget = QtGui.QWidget(None, QtCore.Qt.FramelessWindowHint)
widget.resize(w, h)
widget.show()
window.SetWindowInfo(str(int(widget.winId())))
window.AddRenderer(renderer)
window.Render()
win2image = vtk.vtkWindowToImageFilter()
win2image.SetInput(window)
win2image.Update()
writer = vtk_format()
if LooseVersion(vtk.vtkVersion().GetVTKVersion()) >= \
LooseVersion('6.0.0'):
writer.SetInputData(win2image.GetOutput())
else:
writer.SetInput(win2image.GetOutput())
writer.SetFileName(output_filename)
writer.Write()
window.Finalize()
if widget!=None:
widget.close()
开发者ID:AnyarInc,项目名称:VisTrails,代码行数:31,代码来源:init.py
示例11: 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
示例12: show
def show(self):
# Add to the cloud
self.vtkPolyData.SetPoints(self.vtkPoints)
self.vtkPolyData.SetVerts(self.vtkCells)
self.vtkPolyData.GetPointData().SetVectors(self.vtkColor)
self.vtkPolyData.Modified()
self.vtkPolyData.Update()
# Renderer
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(self.vtkPolyData)
renderer = vtk.vtkRenderer()
self.vtkActor.SetMapper(mapper)
renderer.AddActor(self.vtkActor)
renderer.SetBackground(.2, .3, .4)
renderer.ResetCamera()
#renderer.SetPosition([-3, 0, 11])
# Render Window
renderWindow = vtk.vtkRenderWindow()
renderWindow.AddRenderer(renderer)
# Interactor
renderWindowInteractor = vtk.vtkRenderWindowInteractor()
renderWindowInteractor.SetRenderWindow(renderWindow)
# Begin Interaction
renderWindow.Render()
renderWindowInteractor.Start()
开发者ID:dquinnfrank,项目名称:will-it-blend,代码行数:32,代码来源:cloud_vis.py
示例13: Visualize_Orientation
def Visualize_Orientation(model, out_file):
# create coordinate actor
axes_actor = vtk.vtkAxesActor()
axes_actor.SetTotalLength(500.0, 500.0, 500.0)
# create model actor
model_mapper = vtk.vtkPolyDataMapper()
model_mapper.SetInputData(model)
model_actor = vtk.vtkActor()
model_actor.SetMapper(model_mapper)
global renderer
global interactor
renderer = vtk.vtkRenderer()
renderer.AddActor(model_actor)
renderer.AddActor(axes_actor)
win = vtk.vtkRenderWindow()
win.AddRenderer(renderer)
interactor = vtk.vtkRenderWindowInteractor()
interactor_style = QIN_Style()
interactor_style.SetRenderer(renderer)
interactor_style.SetActor(model_actor)
interactor_style.SetPolyData(model)
interactor_style.SetOutName(out_file)
interactor.SetInteractorStyle(interactor_style)
win.SetInteractor(interactor)
win.Render()
interactor.Start()
pass
开发者ID:Beastmaster,项目名称:itk-python-example,代码行数:32,代码来源:vtkModifySTLOrientation.py
示例14: createRenderWindow
def createRenderWindow( self, **args ):
blocking = args.get( 'blocking', False )
renWin = args.get( 'renwin', None )
if renWin == None:
renWin = vtk.vtkRenderWindow()
rendWinInteractor = renWin.GetInteractor()
if rendWinInteractor == None:
rendWinInteractor = vtk.vtkRenderWindowInteractor() if blocking else vtk.vtkGenericRenderWindowInteractor()
renWin.SetInteractor( rendWinInteractor )
rendWinInteractor.SetRenderWindow(renWin)
self.renderWindowInteractor = rendWinInteractor
self.renderer = vtk.vtkRenderer()
renWin.AddRenderer( self.renderer )
self.interactorStyle = vtk.vtkInteractorStyleTrackballCamera( )
self.renderWindowInteractor.SetInteractorStyle( self.interactorStyle )
self.interactorStyle.KeyPressActivationOff( )
self.interactorStyle.SetEnabled(1)
if self.useDepthPeeling:
self.renderer.UseDepthPeelingOn( )
self.renderer.SetOcclusionRatio( 0.2 )
renWin.SetAlphaBitPlanes( 1 )
renWin.SetMultiSamples( 0 )
self.renderer.SetBackground(1.0, 1.0, 1.0)
self.renderer.SetNearClippingPlaneTolerance( 0.0001 )
self.renderWindow = renWin
开发者ID:arulalant,项目名称:uvcdat,代码行数:30,代码来源:DV3DPlot.py
示例15: 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
示例16: notebookviz
def notebookviz(output):
width,height = 400, 300
demMapper = vtkPolyDataMapper()
demMapper.SetInputConnection(output.GetOutputPort())
surfaceActor = vtkActor()
surfaceActor.SetMapper(demMapper)
surfaceActor.GetProperty().SetDiffuseColor(1.0000, 0.3882, 0.2784)
surfaceActor.GetProperty().SetSpecularColor(1, 1, 1)
surfaceActor.GetProperty().SetSpecular(.4)
surfaceActor.GetProperty().SetSpecularPower(50)
VtkRenderer = vtkRenderer()
VtkRenderer.SetBackground(1.0, 1.0, 1.0)
VtkRenderer.AddActor(surfaceActor)
renderWindow = vtkRenderWindow()
renderWindow.SetOffScreenRendering(1)
renderWindow.AddRenderer(VtkRenderer)
renderWindow.SetSize(width, height)
renderWindow.Render()
windowToImageFilter = vtkWindowToImageFilter()
windowToImageFilter.SetInput(renderWindow)
windowToImageFilter.Update()
writer = vtkPNGWriter()
writer.SetWriteToMemory(1)
writer.SetInputConnection(windowToImageFilter.GetOutputPort())
writer.Write()
data = str(buffer(writer.GetResult()))
return Image(data)
开发者ID:kezilu,项目名称:pextant,代码行数:33,代码来源:utils.py
示例17: _init_render
def _init_render(self):
window = vtk.vtkRenderWindow()
window.SetSize(int(self.settings.image_width),
int(self.settings.image_height))
window.SetOffScreenRendering(self.settings.offscreen_rendering)
window.AddRenderer(self._renderer.renderer)
self.window = window
开发者ID:ecell,项目名称:pd_visualizer,代码行数:7,代码来源:visualizer.py
示例18: main
def main():
setup_vn()
aPolyVertexGrid1 = Tns.vn.represent_map("pop")[0]
Tns.vn.update_scalars([a/20. for a in Tns.p1_l_x],
[aPolyVertexGrid1],
[len(Tns.p1_l_id)])
aPolyVertexGrid2 = Tns.vn.represent_map("pop2")[0]
# aPolyVertexActor = Tns.vn.make_actor_for_grid(aPolyVertexGrid)
# aPolyVertexActor2 = Tns.vn.make_actor_for_grid(aPolyVertexGrid2)
lvl_to_g = {0:[aPolyVertexGrid1, aPolyVertexGrid2]}
#lvl_to_g = Tns.vn.levels_to_grids()
all_actors = Tns.vn.make_all_actors(lvl_to_g)
# Create the usual rendering stuff.
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
renWin.SetSize(1024, 768)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
ren.SetBackground(.0, .0, .0)
for a in all_actors:
ren.AddActor(a)
ren.ResetCamera()
ren.GetActiveCamera().Azimuth(00)
ren.GetActiveCamera().Elevation(-40)
ren.GetActiveCamera().Dolly(0)
ren.ResetCameraClippingRange()
# Render the scene and start interaction.
iren.Initialize()
renWin.Render()
import time
time.sleep(0.1)
iren.Start()
开发者ID:agravier,项目名称:pycogmo,代码行数:33,代码来源:visualisation_tests.py
示例19: draw
def draw(self):
# Update location and movement
self.update()
# create a rendering window and renderer
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.SetSize(1200, 900)
renWin.AddRenderer(ren)
# Create camera
camera = vtk.vtkCamera()
#camera.SetPosition(0.5,10.0,0.0);
#camera.Roll(-90)
#ren.SetActiveCamera(camera)
# create a renderwindowinteractor
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# Add actors
ren.AddActor(self.modelActor)
ren.AddActor(self.axesActor)
# enable user interface interactor
iren.Initialize()
renWin.Render()
style = vtk.vtkInteractorStyleMultiTouchCamera()
iren.SetInteractorStyle(style)
iren.Start()
开发者ID:dgmato,项目名称:LIAC-Guidance,代码行数:31,代码来源:PyRobotics.py
示例20: RenderVTKVolume
def RenderVTKVolume(image, volprops):
volmap = vtk.vtkVolumeRayCastMapper()
volmap.SetVolumeRayCastFunction(vtk.vtkVolumeRayCastCompositeFunction())
volmap.SetInputConnection(image.GetOutputPort())
vol = vtk.vtkVolume()
vol.SetMapper(volmap)
vol.SetProperty(volprops)
#Standard VTK stuff
ren = vtk.vtkRenderer()
ren.AddVolume(vol)
ren.SetBackground((1, 1, 1))
renwin = vtk.vtkRenderWindow()
renwin.AddRenderer(ren)
istyle = vtk.vtkInteractorStyleSwitch()
istyle.SetCurrentStyleToTrackballCamera()
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renwin)
iren.SetInteractorStyle(istyle)
renwin.Render()
iren.Start()
开发者ID:jiahao,项目名称:openqube,代码行数:26,代码来源:viz.vtkGaussians.py
注:本文中的vtk.vtkRenderWindow函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论