本文整理汇总了Python中vtk.vtkRenderer函数的典型用法代码示例。如果您正苦于以下问题:Python vtkRenderer函数的具体用法?Python vtkRenderer怎么用?Python vtkRenderer使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkRenderer函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: Render
def Render(self):
self.Viewport1 = [0.0, 0.0, 0.5, 0.5]
self.Viewport2 = [0.5, 0.0, 1.0, 0.5]
self.Viewport3 = [0.0, 0.5, 0.5, 1.0]
self.Viewport4 = [0.5, 0.5, 1.0, 1.0]
self.Renderer1 = vtk.vtkRenderer()
self.Renderer2 = vtk.vtkRenderer()
self.Renderer3 = vtk.vtkRenderer()
self.Renderer4 = vtk.vtkRenderer()
self.renderWindow.AddRenderer(self.Renderer1)
self.Renderer1.SetViewport(self.Viewport1)
self.Renderer1.SetBackground(0.6, 0.5, 0.3)
self.renderWindow.AddRenderer(self.Renderer2)
self.Renderer2.SetViewport(self.Viewport2)
self.Renderer2.SetBackground(0.5, 0.5, 0.4)
self.renderWindow.AddRenderer(self.Renderer3)
self.Renderer3.SetViewport(self.Viewport3)
self.Renderer3.SetBackground(0.4, 0.5, 0.5)
self.renderWindow.AddRenderer(self.Renderer4)
self.Renderer4.SetViewport(self.Viewport4)
self.Renderer4.SetBackground(0.0, 0.5, 0.6)
self.Renderer1.AddActor(self.inputActor1)
self.Renderer2.AddActor(self.inputActor2)
self.Renderer3.AddActor(self.inputActor3)
self.Renderer4.AddActor(self.inputActor4)
self.camera = vtk.vtkCamera()
self.Renderer1.SetActiveCamera(self.camera)
self.Renderer2.SetActiveCamera(self.camera)
self.Renderer3.SetActiveCamera(self.camera)
self.Renderer4.SetActiveCamera(self.camera)
self.Renderer1.ResetCamera()
self.renderWindow.Render()
self.interactor.Start()
开发者ID:KaWaiTsoi,项目名称:Test,代码行数:33,代码来源:visualHierarchyCompare.py
示例2: __init__
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self.ui = Ui_Form()
self.ui.setupUi(self)
self.reader = vtk.vtkDICOMImageReader()
#self.viewerL = vtk.vtkImageViewer2()
#self.viewerR = vtk.vtkImageViewer2()
self.renL = vtk.vtkRenderer()
self.ui.leftVtk.GetRenderWindow().AddRenderer(self.renL)
self.renR = vtk.vtkRenderer()
self.ui.rightVtk.GetRenderWindow().AddRenderer(self.renR)
self.mapperL = vtk.vtkImageMapper()
self.mapperL.SetInputConnection(self.reader.GetOutputPort())
self.mapperR = vtk.vtkImageMapper()
self.actorL = vtk.vtkActor2D()
self.actorL.SetMapper(self.mapperL)
self.actorR = vtk.vtkActor2D()
self.actorR.SetMapper(self.mapperR)
self.renL.AddActor2D(self.actorL)
self.renR.AddActor2D(self.actorR)
self.importer = vtk.vtkImageImport()
self.mapperR.SetInputConnection(self.importer.GetOutputPort())
self.loadImage(os.path.join(STARTINGPATH, FILENAME))
self.setWindowingAlg()
开发者ID:MKozuch,项目名称:MIEnhancer,代码行数:32,代码来源:ImagingEnhancer.py
示例3: create_slice_window
def create_slice_window(self):
renderer = vtk.vtkRenderer()
renderer.SetLayer(0)
cam = renderer.GetActiveCamera()
overlay_renderer = vtk.vtkRenderer()
overlay_renderer.SetLayer(1)
overlay_renderer.SetActiveCamera(cam)
overlay_renderer.SetInteractive(0)
self.interactor.GetRenderWindow().SetNumberOfLayers(2)
self.interactor.GetRenderWindow().AddRenderer(overlay_renderer)
self.interactor.GetRenderWindow().AddRenderer(renderer)
actor = vtk.vtkImageActor()
# TODO: Create a option to let the user set if he wants to interpolate
# the slice images.
#actor.InterpolateOff()
slice_data = sd.SliceData()
slice_data.SetOrientation(self.orientation)
slice_data.renderer = renderer
slice_data.overlay_renderer = overlay_renderer
slice_data.actor = actor
slice_data.SetBorderStyle(sd.BORDER_ALL)
renderer.AddActor(actor)
renderer.AddActor(slice_data.text.actor)
renderer.AddViewProp(slice_data.box_actor)
return slice_data
开发者ID:RuanAragao,项目名称:invesalius3,代码行数:28,代码来源:viewer_slice.py
示例4: __init__
def __init__(self, interactor):
self.interactor = interactor
self.window = interactor.GetRenderWindow()
self.renderer = vtk.vtkRenderer()
self.renderer.SetViewport(0, 0, 1, 1)
self.renderer.SetBackground(1, 1, 1)
# Used to overlay actors above widgets
self.actor_renderer = vtk.vtkRenderer()
self.actor_renderer.SetViewport(0, 0, 1, 1)
self.actor_renderer.SetBackground(1, 1, 1)
self.window.AddRenderer(self.renderer)
self.window.AddRenderer(self.actor_renderer)
self.widgets = []
self.timer_listener = self.interactor.AddObserver(
"TimerEvent",
self.__render)
self.window_mod = self.window.AddObserver(
"ModifiedEvent",
self.__place,
30)
self.render_listener = self.window.AddObserver(
"RenderEvent",
self.__rendered)
self.last_size = None
self.timer = None
开发者ID:NESII,项目名称:uvcdat,代码行数:28,代码来源:manager.py
示例5: __init__
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
self.frame = QtGui.QFrame()
self.vl = QtGui.QGridLayout()
self.vtkWidget_right_femur = QVTKRenderWindowInteractor(self.frame)
self.vtkWidget_right_hip = QVTKRenderWindowInteractor(self.frame)
self.vtkWidget_left_femur = QVTKRenderWindowInteractor(self.frame)
self.vtkWidget_left_hip = QVTKRenderWindowInteractor(self.frame)
title_right_femur = QtGui.QLabel('Femur derecho')
title_right_hip = QtGui.QLabel('Cadera derecha')
title_left_femur = QtGui.QLabel('Femur izquierdo')
title_left_hip = QtGui.QLabel('Cadera izquierda')
self.vl.addWidget(title_right_femur, 0, 0)
self.vl.addWidget(self.vtkWidget_right_femur, 1, 0)
self.vl.addWidget(title_right_hip, 0, 1)
self.vl.addWidget(self.vtkWidget_right_hip, 1, 1)
self.vl.addWidget(title_left_femur, 2, 0)
self.vl.addWidget(self.vtkWidget_left_femur, 3, 0)
self.vl.addWidget(title_left_hip, 2, 1)
self.vl.addWidget(self.vtkWidget_left_hip, 3, 1)
self.ren_right_femur = vtk.vtkRenderer()
self.ren_right_hip = vtk.vtkRenderer()
self.ren_left_femur = vtk.vtkRenderer()
self.ren_left_hip = vtk.vtkRenderer()
self.vtkWidget_right_femur.GetRenderWindow().AddRenderer(self.ren_right_femur)
self.vtkWidget_right_hip.GetRenderWindow().AddRenderer(self.ren_right_hip)
self.vtkWidget_left_femur.GetRenderWindow().AddRenderer(self.ren_left_femur)
self.vtkWidget_left_hip.GetRenderWindow().AddRenderer(self.ren_left_hip)
self.iren_right_femur = self.vtkWidget_right_femur.GetRenderWindow().GetInteractor()
self.iren_right_hip = self.vtkWidget_right_hip.GetRenderWindow().GetInteractor()
self.iren_left_femur = self.vtkWidget_left_femur.GetRenderWindow().GetInteractor()
self.iren_left_hip = self.vtkWidget_left_hip.GetRenderWindow().GetInteractor()
openFile = QtGui.QAction(QtGui.QIcon('open.png'), 'Open', self)
openFile.setShortcut('Ctrl+O')
openFile.setStatusTip('Open new File')
openFile.triggered.connect(self.show_dialog)
menubar = self.menuBar()
fileMenu = menubar.addMenu('&File')
fileMenu.addAction(openFile)
self.image_processing = ImageProcessing()
self.frame.setLayout(self.vl)
self.setCentralWidget(self.frame)
self.setGeometry(50, 50, 1200, 800)
self.show()
开发者ID:elpisco,项目名称:hip-dysplasia,代码行数:55,代码来源:main.py
示例6: __init__
def __init__(self):
super(RenderWidget, self).__init__()
# Default volume renderer
self.renderer = vtkRenderer()
self.renderer.SetBackground2(0.4, 0.4, 0.4)
self.renderer.SetBackground(0.1, 0.1, 0.1)
self.renderer.SetGradientBackground(True)
self.renderer.SetLayer(0)
# Overlay renderer which is synced with the default renderer
self.rendererOverlay = vtkRenderer()
self.rendererOverlay.SetLayer(1)
self.rendererOverlay.SetInteractive(0)
self.renderer.GetActiveCamera().AddObserver("ModifiedEvent", self._syncCameras)
self.rwi = QVTKRenderWindowInteractor(parent=self)
self.rwi.SetInteractorStyle(vtkInteractorStyleTrackballCamera())
self.rwi.GetRenderWindow().AddRenderer(self.renderer)
self.rwi.GetRenderWindow().AddRenderer(self.rendererOverlay)
self.rwi.GetRenderWindow().SetNumberOfLayers(2)
self.rwi.SetDesiredUpdateRate(0)
self.imagePlaneWidgets = [vtkImagePlaneWidget() for i in range(3)]
for index in range(3):
self.imagePlaneWidgets[index].DisplayTextOn()
self.imagePlaneWidgets[index].SetInteractor(self.rwi)
# Disable the margin for free rotation
self.imagePlaneWidgets[index].SetMarginSizeX(0.0)
self.imagePlaneWidgets[index].SetMarginSizeY(0.0)
self.mapper = vtkOpenGLGPUVolumeRayCastMapper()
self.mapper.SetAutoAdjustSampleDistances(1)
self.volume = None
self.imageData = None
self.VolumeVisualization = None
self.shouldResetCamera = False
self.gridItems = []
self.orientationGridItems = []
self.clippingBox = ClippingBox()
self.clippingBox.setWidget(self)
# Keep track of the base and user transforms
self.baseTransform = vtkTransform()
self.userTransform = vtkTransform()
self.setMinimumWidth(340)
self.setMinimumHeight(340)
layout = QGridLayout(self)
layout.setSpacing(0)
layout.setContentsMargins(0, 0, 0, 0)
layout.addWidget(self.rwi, 0, 0)
self.setLayout(layout)
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:55,代码来源:RenderWidget.py
示例7: renderers
def renderers(window, rows=1, cols=1):
renderer = vtk.vtkRenderer()
rows = np.linspace(0,1,rows+1)
cols = np.linspace(0,1,cols+1)
rows, cols = np.meshgrid(rows, cols)
renderers = []
for r, c in zip(range(rows.shape[0]-1), range(cols.shape[1]-1)):
viewport = rows[r, r], cols[c, c], rows[r+1, r+1], cols[c+1, c+1]
renderers.append(vtk.vtkRenderer())
window.AddRenderer(renderers[-1])
renderers[-1].SetViewport(viewport)
renderers[-1].SetBackground(1., 1., 1.)
return renderers
开发者ID:pfernique,项目名称:wanda,代码行数:13,代码来源:frame.py
示例8: clean_gui
def clean_gui(self):
self.ren_right_femur = vtk.vtkRenderer()
self.ren_right_hip = vtk.vtkRenderer()
self.ren_left_femur = vtk.vtkRenderer()
self.ren_left_hip = vtk.vtkRenderer()
self.vtkWidget_right_femur.GetRenderWindow().AddRenderer(self.ren_right_femur)
self.vtkWidget_right_hip.GetRenderWindow().AddRenderer(self.ren_right_hip)
self.vtkWidget_left_femur.GetRenderWindow().AddRenderer(self.ren_left_femur)
self.vtkWidget_left_hip.GetRenderWindow().AddRenderer(self.ren_left_hip)
self.iren_right_femur = self.vtkWidget_right_femur.GetRenderWindow().GetInteractor()
self.iren_right_hip = self.vtkWidget_right_hip.GetRenderWindow().GetInteractor()
self.iren_left_femur = self.vtkWidget_left_femur.GetRenderWindow().GetInteractor()
self.iren_left_hip = self.vtkWidget_left_hip.GetRenderWindow().GetInteractor()
开发者ID:elpisco,项目名称:hip-dysplasia,代码行数:15,代码来源:main.py
示例9: view
def view(stlfilename):
reader = vtk.vtkSTLReader()
reader.SetFileName(stlfilename)
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(reader.GetOutputPort())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
# Create a rendering window and renderer
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren)
# Create a renderwindowinteractor
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# Assign actor to the renderer
ren.AddActor(actor)
# Enable user interface interactor
iren.Initialize()
renWin.Render()
iren.Start()
开发者ID:Mouse-Imaging-Centre,项目名称:minc-stuffs,代码行数:26,代码来源:vtk_meshconvert.py
示例10: 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
示例11: 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
示例12: __init__
def __init__(self):
GtkGLExtVTKRenderWindowInteractor.__init__(self)
EventHandler().attach(self)
self.interactButtons = (1,2,3)
self.renderOn = 1
self.Initialize()
self.Start()
self.renderer = vtk.vtkRenderer()
self.renWin = self.GetRenderWindow()
self.renWin.AddRenderer(self.renderer)
self.interactor = self.renWin.GetInteractor()
#self.camera = self.renderer.GetActiveCamera()
self.pressFuncs = {1 : self._Iren.LeftButtonPressEvent,
2 : self._Iren.MiddleButtonPressEvent,
3 : self._Iren.RightButtonPressEvent}
self.releaseFuncs = {1 : self._Iren.LeftButtonReleaseEvent,
2 : self._Iren.MiddleButtonReleaseEvent,
3 : self._Iren.RightButtonReleaseEvent}
self.pressHooks = {}
self.releaseHooks = {}
self.lastLabel = None
self.vtk_interact_mode = False
开发者ID:alexsavio,项目名称:nidoodles,代码行数:27,代码来源:marker_window_interactor.py
示例13: vtkRenderWindowInteractorConeExample
def vtkRenderWindowInteractorConeExample():
"""Like it says, just a simple example
"""
# create root window
root = Tkinter.Tk()
# create vtkTkRenderWidget
pane = vtkTkRenderWindowInteractor(root, width=300, height=300)
pane.Initialize()
def quit(obj=root):
obj.quit()
pane.AddObserver("ExitEvent", lambda o,e,q=quit: q())
ren = vtk.vtkRenderer()
pane.GetRenderWindow().AddRenderer(ren)
cone = vtk.vtkConeSource()
cone.SetResolution(8)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
ren.AddActor(coneActor)
# pack the pane into the tk root
pane.pack(fill='both', expand=1)
pane.Start()
# start the tk mainloop
root.mainloop()
开发者ID:SRabbelier,项目名称:Casam,代码行数:35,代码来源:vtkTkRenderWindowInteractor.py
示例14: __init__
def __init__(self, volume):
super(InteractiveIsosurface, self).__init__()
self._default_size = (600, 600)
self.resize(*self._default_size)
#self._volume = numpy.ascontiguousarray(volume, dtype="float32")
self._surface_object = IsoSurface(volume)
self._central_widget = QtGui.QWidget(self)
self._vtk_widget = QVTKRenderWindowInteractor(self._central_widget)
self._vtk_widget.SetInteractorStyle(_vtk.vtkInteractorStyleRubberBandPick())
self._renderer = _vtk.vtkRenderer()
self._renderer.SetBackground(0., 0., 0.)
self._surface_object.set_renderer(self._renderer)
self._THRESHOLD_SLIDER_MAXIMUM = 1000
self._THRESHOLD_SLIDER_INIT = self._THRESHOLD_SLIDER_MAXIMUM/2
self._threshold_table = self._adaptive_slider_values(volume, self._THRESHOLD_SLIDER_MAXIMUM, volume.min(), volume.max())
self._threshold_slider = QtGui.QSlider(QtCore.Qt.Horizontal)
self._threshold_slider.setMaximum(self._THRESHOLD_SLIDER_MAXIMUM)
self._layout = QtGui.QVBoxLayout()
self._layout.addWidget(self._vtk_widget)
self._layout.addWidget(self._threshold_slider)
self._central_widget.setLayout(self._layout)
self.setCentralWidget(self._central_widget)
开发者ID:ekeberg,项目名称:Python-tools,代码行数:29,代码来源:vtk_tools.py
示例15: 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
示例16: add
def add(**kwargs):
ren = vtk.vtkRenderer()
ren.SetBackground(0.5, 0.5, 0.5)
#ren.SetViewport(0, 0, 0.5, 1)
renWin.AddRenderer(ren)
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(elev.GetOutputPort())
mapper.SetLookupTable(lut)
mapper.SetInterpolateScalarsBeforeMapping(kwargs['interpolate_scalars_before_mapping'])
mapper.SetScalarMaterialMode(kwargs["material_mode"])
actor = vtk.vtkActor()
actor.SetMapper(mapper)
ren.AddActor(actor)
prop = actor.GetProperty()
prop.SetAmbient(kwargs['ambient'])
prop.SetDiffuse(kwargs['diffuse'])
prop.SetAmbientColor(1, 0, 0)
prop.SetDiffuseColor(0, 1, 0)
textActorL = vtk.vtkTextActor()
txt = " InterpolateScalarsBeforeMapping: %d\n"\
" ScalarMaterialMode: %s\n"\
" Ambient: %.2f\t Ambient Color: 1, 0, 0\n"\
" Diffuse: %.2f\t Diffuse Color: 0, 1, 0"
txt = txt % (kwargs['interpolate_scalars_before_mapping'],
mapper.GetScalarMaterialModeAsString(), prop.GetAmbient(), prop.GetDiffuse())
textActorL.SetInput(txt)
ren.AddActor(textActorL)
return (ren, actor, mapper)
开发者ID:dtmoodie,项目名称:VTK,代码行数:32,代码来源:TestScalarMaterialMode.py
示例17: __init__
def __init__(self, input=None, MinOpacity=0.0, MaxOpacity=0.1) :
import qt
import vtk
from vtk.qt.QVTKRenderWindowInteractor import QVTKRenderWindowInteractor
self.__MinOpacity__ = MinOpacity
self.__MaxOpacity__ = MaxOpacity
# every QT app needs an app
self.__app__ = qt.QApplication(['itkviewer'])
# create the widget
self.__widget__ = QVTKRenderWindowInteractor()
self.__ren__ = vtk.vtkRenderer()
self.__widget__.GetRenderWindow().AddRenderer(self.__ren__)
self.__itkvtkConverter__ = None
self.__volumeMapper__ = vtk.vtkVolumeTextureMapper2D()
self.__volume__ = vtk.vtkVolume()
self.__volumeProperty__ = vtk.vtkVolumeProperty()
self.__volume__.SetMapper(self.__volumeMapper__)
self.__volume__.SetProperty(self.__volumeProperty__)
self.__ren__.AddVolume(self.__volume__)
self.__outline__ = None
self.__outlineMapper__ = None
self.__outlineActor__ = None
self.AdaptColorAndOpacity(0, 255)
if input :
self.SetInput(input)
self.AdaptColorAndOpacity()
开发者ID:giacomo21,项目名称:Image-analysis,代码行数:26,代码来源:itkvtkExtras.py
示例18: __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
示例19: initialize
def initialize(self, VTKWebApp, args):
if not VTKWebApp.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
VTKWebApp.view = renderWindow
self.Application.GetObjectIdMap().SetActiveObject("VIEW", renderWindow)
开发者ID:Halfnhav,项目名称:tangelo,代码行数:25,代码来源:vtkweb_cone.py
示例20: QVTKRenderWidgetConeExample
def QVTKRenderWidgetConeExample():
"""A simple example that uses the QVTKRenderWindowInteractor
class. """
# every QT app needs an app
app = qt.QApplication(['QVTKRenderWindowInteractor'])
# create the widget
widget = QVTKRenderWindowInteractor()
widget.Initialize()
widget.Start()
# if you dont want the 'q' key to exit comment this.
widget.AddObserver("ExitEvent", lambda o, e, a=app: a.quit())
ren = vtk.vtkRenderer()
widget.GetRenderWindow().AddRenderer(ren)
cone = vtk.vtkConeSource()
cone.SetResolution(8)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInputConnection(cone.GetOutputPort())
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
ren.AddActor(coneActor)
# show the widget
widget.show()
# close the application when window is closed
app.setMainWidget(widget)
# start event processing
app.exec_loop()
开发者ID:151706061,项目名称:VTK,代码行数:34,代码来源:QVTKRenderWindowInteractor.py
注:本文中的vtk.vtkRenderer函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论