本文整理汇总了Python中vtk.vtkImagePlaneWidget函数的典型用法代码示例。如果您正苦于以下问题:Python vtkImagePlaneWidget函数的具体用法?Python vtkImagePlaneWidget怎么用?Python vtkImagePlaneWidget使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkImagePlaneWidget函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: Execute
def Execute(self):
if self.Image == None:
self.PrintError('Error: no Image.')
if self.Interactive == 1:
if not self.vmtkRenderer:
self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
self.vmtkRenderer.Initialize()
self.OwnRenderer = 1
self.vmtkRenderer.RegisterScript(self)
self.PlaneWidgetX = vtk.vtkImagePlaneWidget()
self.PlaneWidgetX.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
self.PlaneWidgetY = vtk.vtkImagePlaneWidget()
self.PlaneWidgetY.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
self.PlaneWidgetZ = vtk.vtkImagePlaneWidget()
self.PlaneWidgetZ.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
self.BoxWidget = vtk.vtkBoxWidget()
self.BoxWidget.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
self.vmtkRenderer.AddKeyBinding('i','Interact.', self.InteractCallback)
self.Display()
while (self.BoxActive == 1):
self.PaintVOI()
self.Display()
else:
self.PaintVOI()
if self.OwnRenderer:
self.vmtkRenderer.Deallocate()
开发者ID:SaraZanchi,项目名称:vmtk,代码行数:33,代码来源:vmtkimagevoipainter.py
示例2: _setup_slices
def _setup_slices(self):
"""Create the slices. No actor required in this case"""
picker = vtk.vtkCellPicker()
picker_tolerance = 0.005
picker.SetTolerance(picker_tolerance)
text_color = (0., 0., 0.)
self._planes.append(vtk.vtkImagePlaneWidget())
self._planes[0].SetInputData(self._volume)
self._planes[0].UserControlledLookupTableOn()
self._planes[0].SetLookupTable(self._lut)
self._planes[0].SetPlaneOrientationToXAxes()
self._planes[0].SetSliceIndex(self._volume.GetExtent()[1]/2) # GetExtent returns a six length array, begin-end pairs
self._planes[0].DisplayTextOn()
self._planes[0].GetTextProperty().SetColor(text_color)
self._planes[0].SetPicker(picker)
self._planes[0].SetLeftButtonAction(1)
self._planes[0].SetMiddleButtonAction(2)
self._planes[0].SetRightButtonAction(0)
self._planes[0].SetInteractor(self._vtk_widget)
# self._planes[0].On()
self._planes.append(vtk.vtkImagePlaneWidget())
self._planes[1].SetInputData(self._volume)
self._planes[1].UserControlledLookupTableOn()
self._planes[1].SetLookupTable(self._lut)
self._planes[1].SetPlaneOrientationToZAxes()
self._planes[1].SetSliceIndex(self._volume.GetExtent()[5]/2) # GetExtent returns a six length array, begin-end pairs
self._planes[1].DisplayTextOn()
self._planes[1].GetTextProperty().SetColor(text_color)
self._planes[1].SetPicker(picker)
self._planes[1].SetLeftButtonAction(1)
self._planes[1].SetMiddleButtonAction(2)
self._planes[1].SetRightButtonAction(0)
self._planes[1].SetInteractor(self._vtk_widget)
开发者ID:FilipeMaia,项目名称:emc,代码行数:35,代码来源:modelmap_module.py
示例3: __init__
def __init__(self, imageData=None):
MarkerWindowInteractor.__init__(self)
ThreeDimRenderWindow.__init__(self)
if shared.debug: print "PlaneWidgetsXYZ.__init__()"
self.vtksurface = None
self.interactButtons = (1,2,3)
self.sharedPicker = vtk.vtkCellPicker()
#self.sharedPicker.SetTolerance(0.005)
self.SetPicker(self.sharedPicker)
self.pwX = vtk.vtkImagePlaneWidget()
self.pwY = vtk.vtkImagePlaneWidget()
self.pwZ = vtk.vtkImagePlaneWidget()
self.axes_labels = []
self.set_image_data(imageData)
self.Render()
self.vtk_translation = np.zeros(3, 'd')
self.vtk_rotation = np.zeros(3, 'd')
开发者ID:neurodebian,项目名称:PyLocator,代码行数:25,代码来源:plane_widgets_xyz.py
示例4: Execute
def Execute(self):
if self.Image == None:
self.PrintError('Error: no Image.')
self.CroppedImage.DeepCopy(self.Image)
if self.Interactive == 1:
if not self.vmtkRenderer:
self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
self.vmtkRenderer.Initialize()
self.OwnRenderer = 1
self.PlaneWidgetX = vtk.vtkImagePlaneWidget()
self.PlaneWidgetX.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
self.PlaneWidgetY = vtk.vtkImagePlaneWidget()
self.PlaneWidgetY.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
self.PlaneWidgetZ = vtk.vtkImagePlaneWidget()
self.PlaneWidgetZ.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
self.BoxWidget = vtk.vtkBoxWidget()
self.BoxWidget.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
self.Display()
while (self.BoxActive == 1):
self.ExtractVOI()
self.Image = self.CroppedImage
self.Display()
else:
self.ExtractVOI()
if self.OwnRenderer:
self.vmtkRenderer.Deallocate()
self.Image = self.CroppedImage
开发者ID:ValentinaRossi,项目名称:vmtk,代码行数:35,代码来源:vmtkimagevoiselector.py
示例5: __init__
def __init__(self, imageData=None):
MarkerWindowInteractor.__init__(self) #does this really just control the markers or is it for the other frames too?
print "PlaneWidgetsXYZ.__init__()"
self.vtksurface = None
self.interactButtons = (1,2,3)
self.sharedPicker = vtk.vtkCellPicker()
#self.sharedPicker.SetTolerance(0.005)
self.SetPicker(self.sharedPicker)
#initialize all three axes slice objects on the bottom of the window
self.pwX = vtk.vtkImagePlaneWidget()
self.pwY = vtk.vtkImagePlaneWidget()
self.pwZ = vtk.vtkImagePlaneWidget()
self.textActors = {}
self.boxes = {}
self.set_image_data(imageData)
self.Render()
self.vtk_translation = zeros(3, 'd')
self.vtk_rotation = zeros(3, 'd')
开发者ID:ashwinashok9111993,项目名称:pbrain,代码行数:25,代码来源:plane_widgets_xyz.py
示例6: __init__
def __init__(self, imageData=None):
MarkerWindowInteractor.__init__(self)
print "PlaneWidgetsXYZ.__init__()"
self.vtksurface = None
self.interactButtons = (1,2,3)
self.sharedPicker = vtk.vtkCellPicker()
#self.sharedPicker.SetTolerance(0.005)
self.SetPicker(self.sharedPicker)
self.pwX = vtk.vtkImagePlaneWidget()
self.pwY = vtk.vtkImagePlaneWidget()
self.pwZ = vtk.vtkImagePlaneWidget()
self.textActors = {}
self.boxes = {}
self.set_image_data(imageData)
self.Render()
self.vtk_translation = zeros(3, 'd')
self.vtk_rotation = zeros(3, 'd')
开发者ID:alexsavio,项目名称:nidoodles,代码行数:25,代码来源:plane_widgets_xyz.py
示例7: __init__
def __init__(self, rwi, renderer):
# nnsmit-edit
self.overlay_active = 0;
# end edit
self.rwi = rwi
self.renderer = renderer
istyle = vtk.vtkInteractorStyleTrackballCamera()
rwi.SetInteractorStyle(istyle)
# we unbind the existing mousewheel handler so it doesn't
# interfere
rwi.Unbind(wx.EVT_MOUSEWHEEL)
rwi.Bind(wx.EVT_MOUSEWHEEL, self._handler_mousewheel)
self.ipws = [vtk.vtkImagePlaneWidget() for _ in range(3)]
lut = self.ipws[0].GetLookupTable()
for ipw in self.ipws:
ipw.SetInteractor(rwi)
ipw.SetLookupTable(lut)
# nnsmit-edit
self.overlay_ipws = [vtk.vtkImagePlaneWidget() for _ in range(3)]
lut2 = self.overlay_ipws[0].GetLookupTable()
lut2.SetNumberOfTableValues(3)
lut2.SetTableValue(0,0,0,0,0)
lut2.SetTableValue(1,0.5,0,1,1)
lut2.SetTableValue(2,1,0,0,1)
lut2.Build()
for ipw_overlay in self.overlay_ipws:
ipw_overlay.SetInteractor(rwi)
ipw_overlay.SetLookupTable(lut2)
ipw_overlay.AddObserver('InteractionEvent', wx.EVT_MOUSEWHEEL)
# now actually connect the sync_overlay observer
for i,ipw in enumerate(self.ipws):
ipw.AddObserver('InteractionEvent',lambda vtk_o, vtk_e, i=i: self.observer_sync_overlay(self.ipws,i))
# end edit
# we only set the picker on the visible IPW, else the
# invisible IPWs block picking!
self.picker = vtk.vtkCellPicker()
self.picker.SetTolerance(0.005)
self.ipws[0].SetPicker(self.picker)
self.outline_source = vtk.vtkOutlineCornerFilter()
m = vtk.vtkPolyDataMapper()
m.SetInput(self.outline_source.GetOutput())
a = vtk.vtkActor()
a.SetMapper(m)
a.PickableOff()
self.outline_actor = a
self.dv_orientation_widget = DVOrientationWidget(rwi)
# this can be used by clients to store the current world
# position
self.current_world_pos = (0,0,0)
self.current_index_pos = (0,0,0)
开发者ID:fvpolpeta,项目名称:devide,代码行数:59,代码来源:comedi_utils.py
示例8: __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
示例9: __init__
def __init__(self, interactor, renderer):
self.interactor = interactor
self.renderer = renderer
self.pwX = vtk.vtkImagePlaneWidget()
self.pwY = vtk.vtkImagePlaneWidget()
self.pwZ = vtk.vtkImagePlaneWidget()
self._usingPlanes = False
self.readerDlg = image_reader.widgets['dlgReader']
self.propsDlg = self.make_prop_dialog()
开发者ID:ashwinashok9111993,项目名称:pbrain,代码行数:9,代码来源:image_manager.py
示例10: __init__
def __init__(self):
""" initialize visualization with standard vtk actors, renders, windowsn, interactors """
# use cell picker for interacting with the image orthogonal views.
self.picker = vtk.vtkCellPicker()
self.picker.SetTolerance(0.005)
# Create 3 orthogonal view using the ImagePlaneWidget
self.xImagePlaneWidget = vtk.vtkImagePlaneWidget()
self.yImagePlaneWidget = vtk.vtkImagePlaneWidget()
self.zImagePlaneWidget = vtk.vtkImagePlaneWidget()
# The 3 image plane widgets
self.xImagePlaneWidget.DisplayTextOn();
self.xImagePlaneWidget.SetPicker(self.picker);
self.xImagePlaneWidget.RestrictPlaneToVolumeOn();
self.xImagePlaneWidget.SetKeyPressActivationValue('x');
self.xImagePlaneWidget.GetPlaneProperty().SetColor(1, 0, 0);
self.xImagePlaneWidget.SetResliceInterpolateToNearestNeighbour();
self.yImagePlaneWidget.DisplayTextOn();
self.yImagePlaneWidget.SetPicker(self.picker);
self.yImagePlaneWidget.RestrictPlaneToVolumeOn();
self.yImagePlaneWidget.SetKeyPressActivationValue('y');
self.yImagePlaneWidget.GetPlaneProperty().SetColor(0, 1, 0);
self.yImagePlaneWidget.SetLookupTable(self.xImagePlaneWidget.GetLookupTable());
self.zImagePlaneWidget.DisplayTextOn();
self.zImagePlaneWidget.SetPicker(self.picker);
self.zImagePlaneWidget.SetKeyPressActivationValue('z');
self.zImagePlaneWidget.GetPlaneProperty().SetColor(0, 0, 1);
self.zImagePlaneWidget.SetLookupTable(self.xImagePlaneWidget.GetLookupTable());
self.zImagePlaneWidget.SetRightButtonAutoModifier(1);
# Create a renderer, render window, and render window interactor to
# display the results.
self.renderer1 = vtk.vtkRenderer()
self.renWin1 = vtk.vtkRenderWindow()
self.iren1 = vtk.vtkRenderWindowInteractor()
self.renWin1.SetSize(1000, 800);
self.renWin1.AddRenderer(self.renderer1)
self.iren1.SetRenderWindow(self.renWin1)
self.xImagePlaneWidget.SetInteractor( self.iren1 )
self.yImagePlaneWidget.SetInteractor( self.iren1 )
self.zImagePlaneWidget.SetInteractor( self.iren1 )
# Set Up Camera view
self.camera = self.renderer1.GetActiveCamera()
self.renderer1.SetBackground(0.0, 0.0, 0.0)
self.iren1.SetPicker(self.picker)
self.T1origin = [0,0,0]
self.T2origin = [0,0,0]
self.T2extent = [0,0,0,0,0,0]
self.T1extent = [0,0,0,0,0,0]
self.T1spacing = [0,0,0]
开发者ID:cgallego,项目名称:segmentationValidation,代码行数:57,代码来源:display.py
示例11: ImagePlaneDemo
def ImagePlaneDemo(img):
# create a window
window = vtk.vtkRenderWindow()
# create interactor
interactor = vtk.vtkRenderWindowInteractor()
window.SetInteractor(interactor)
# create 4 renderers
xmins = [0,.5,0,.5]
xmaxs = [0.5,1,0.5,1]
ymins = [0,0,0.5,0.5]
ymaxs = [0.5,0.5,1,1]
render_list = []
for i in range(4):
renderer = vtk.vtkRenderer()
render_list.append(renderer)
window.AddRenderer(renderer)
renderer.SetViewport(xmins[i],ymins[i],xmaxs[i],ymaxs[i])
# create plane source here
plane_X = vtk.vtkImagePlaneWidget()
plane_Y = vtk.vtkImagePlaneWidget()
plane_Z = vtk.vtkImagePlaneWidget()
plane_X.SetInteractor(interactor)
plane_Y.SetInteractor(interactor)
plane_Z.SetInteractor(interactor)
plane_X.SetDefaultRenderer(render_list[0])
plane_Y.SetDefaultRenderer(render_list[1])
plane_Z.SetDefaultRenderer(render_list[2])
plane_X.SetCurrentRenderer(render_list[3])
plane_Y.SetCurrentRenderer(render_list[3])
plane_Z.SetCurrentRenderer(render_list[3])
plane_X.SetInputData(img)
plane_Y.SetInputData(img)
plane_Z.SetInputData(img)
plane_X.SetPlaneOrientationToXAxes()
plane_Y.SetPlaneOrientationToYAxes()
plane_Z.SetPlaneOrientationToZAxes()
plane_X.On()
plane_Y.On()
plane_Z.On()
window.Render()
interactor.Start()
开发者ID:Beastmaster,项目名称:itk-python-example,代码行数:53,代码来源:vtkImagePlaneWidgetDemo.py
示例12: _createIPWs
def _createIPWs(self):
self._ipw1 = vtk.vtkImagePlaneWidget()
self._ipw2 = vtk.vtkImagePlaneWidget()
for ipw, vtkImporter in ((self._ipw1, self._vtkImporter1),
(self._ipw2, self._vtkImporter2)):
vtkImporter.Update()
ipw.SetInput(vtkImporter.GetOutput())
ipw.SetPlaneOrientation(2)
ipw.SetInteractor(self.viewerFrame.threedRWI)
ipw.On()
ipw.InteractionOff()
self._setModeRedGreen()
开发者ID:fvpolpeta,项目名称:devide,代码行数:14,代码来源:register2D.py
示例13: add_overlay
def add_overlay(self, id, rgba_colour):
"""Creates and ads a new (set of) image plane widgets corresponding to a new overlay.
id : the string id which will be used to identify this overlay for future lookups.
rgba_colour : a length 4 vector giving the red,green,blue,opacity value for this overlay. Range = [0,1]
"""
if self.ipw_triads.has_key(id):
raise ValueError('The overlay id = "%s" is already in use! Cannot this id - aborting.' % id)
else:
new_ipw_triad = [vtk.vtkImagePlaneWidget() for _ in range(3)]
lut = new_ipw_triad[0].GetLookupTable()
lut.SetNumberOfTableValues(2)
if len(self.ipw_triads) == 0:
lut.SetTableValue(0,0,0,0,0.1) #Almost-transparent black - for showing the pickable plane
else:
lut.SetTableValue(0,0,0,0,0) #Transparent: for non-interfering overlay on existing layers
lut.SetTableValue(1,rgba_colour[0],rgba_colour[1],rgba_colour[2],rgba_colour[3]) #Specified RGBA for binary "true"
lut.Build()
for ipw in new_ipw_triad:
ipw.SetInteractor(self.rwi)
ipw.SetLookupTable(lut)
self.ipw_triads[id] = new_ipw_triad
base_ipw_triad = self.ipw_triads[0]
# now actually connect the sync_overlay observer
for i,ipw in enumerate(base_ipw_triad):
ipw.AddObserver('InteractionEvent',lambda vtk_o, vtk_e, i=i: self.observer_sync_overlay(base_ipw_triad, new_ipw_triad, i))
开发者ID:fvpolpeta,项目名称:devide,代码行数:28,代码来源:OverlaySliceViewer.py
示例14: DisplayComponent
def DisplayComponent(source):
renderer = vtk.vtkRenderer()
win = vtk.vtkRenderWindow()
win.AddRenderer(renderer)
style = vtk.vtkInteractorStyleImage()
intact = vtk.vtkRenderWindowInteractor()
intact.SetInteractorStyle(style)
intact.SetRenderWindow(win)
planeX = vtk.vtkImagePlaneWidget()
planeY = vtk.vtkImagePlaneWidget()
planeZ = vtk.vtkImagePlaneWidget()
planeX.SetInteractor(intact)
planeY.SetInteractor(intact)
planeZ.SetInteractor(intact)
planeX.SetInputData(source)
planeY.SetInputData(source)
planeZ.SetInputData(source)
planeX.SetPlaneOrientationToXAxes()
planeY.SetPlaneOrientationToYAxes()
planeZ.SetPlaneOrientationToZAxes()
planeX.On()
planeY.On()
planeZ.On()
global pos
pos = 1
def myCallback(obj,event):
global pos
#print obj.__class__.__name__," called"
key = obj.GetKeySym()
if key=="Up":
pos = pos+1
planeX.SetSliceIndex(pos)
print pos
win.Render()
else:
pass
intact.AddObserver(vtk.vtkCommand.KeyPressEvent,myCallback)
intact.Start()
开发者ID:Beastmaster,项目名称:itk-python-example,代码行数:45,代码来源:vtkThreshold.py
示例15: Execute
def Execute(self):
if (self.Image == None) & (self.Display == 1):
self.PrintError('Error: no Image.')
if not self.vmtkRenderer:
self.vmtkRenderer = vmtkrenderer.vmtkRenderer()
self.vmtkRenderer.Initialize()
self.OwnRenderer = 1
self.PaintedImage = vtk.vtkImageData()
self.PaintedImage.DeepCopy(self.Image)
self.vmtkRenderer.RegisterScript(self)
##self.PrintLog('Ctrl + left click to add seed.')
self.Picker = vtk.vtkCellPicker()
self.Picker.SetTolerance(0.005)
self.PlaneWidgetX = vtk.vtkImagePlaneWidget()
self.PlaneWidgetX.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
self.PlaneWidgetX.AddObserver("StartInteractionEvent", self.StartInteraction)
self.PlaneWidgetX.AddObserver("InteractionEvent", self.Interaction)
self.PlaneWidgetX.AddObserver("EndInteractionEvent", self.EndInteraction)
self.PlaneWidgetX.SetPicker(self.Picker)
self.PlaneWidgetY = vtk.vtkImagePlaneWidget()
self.PlaneWidgetY.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
self.PlaneWidgetY.AddObserver("StartInteractionEvent", self.StartInteraction)
self.PlaneWidgetY.AddObserver("InteractionEvent", self.Interaction)
self.PlaneWidgetY.AddObserver("EndInteractionEvent", self.EndInteraction)
self.PlaneWidgetY.SetPicker(self.Picker)
self.PlaneWidgetZ = vtk.vtkImagePlaneWidget()
self.PlaneWidgetZ.SetInteractor(self.vmtkRenderer.RenderWindowInteractor)
self.PlaneWidgetZ.AddObserver("StartInteractionEvent", self.StartInteraction)
self.PlaneWidgetZ.AddObserver("InteractionEvent", self.Interaction)
self.PlaneWidgetZ.AddObserver("EndInteractionEvent", self.EndInteraction)
self.PlaneWidgetZ.SetPicker(self.Picker)
self.BuildView()
self.WidgetsOff()
if self.OwnRenderer:
self.vmtkRenderer.Deallocate()
开发者ID:tangui,项目名称:vmtk,代码行数:43,代码来源:vmtkimagepainter.py
示例16: __init__
def __init__(self):
super(ClippingBox, self).__init__()
self.widget = None
self.clippingBox = vtkBoxWidget()
self.planes = [vtkImagePlaneWidget() for _ in range(6)]
self.transform = vtkTransform() # For future functionality
self._clippingBoxState = False
self._clippingPlanesState = False
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:10,代码来源:ClippingBox.py
示例17: widget
def widget(self):
img = vtk.vtkImagePlaneWidget()
img.SetInputData(self.rdr.GetOutput())
img.SetInteractor(self.interactor)
img_data = self.rdr.GetOutput()
dimensions = img_data.GetDimensions()
mid_point=int(dimensions[1]/2)
img.SetSliceIndex(mid_point)
img.On()
self.img = img
开发者ID:lauragarciabernal,项目名称:Superprob,代码行数:10,代码来源:border.py
示例18: __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
示例19: SetInput
def SetInput(self, imagedata):
axes = PLANE_DATA[self.orientation][0] # "x", "y" or "z"
colour = PLANE_DATA[self.orientation][1]
#if self.orientation == SAGITAL:
# spacing = min(imagedata.GetSpacing())
# permute = vtk.vtkImagePermute()
# permute.SetInput(imagedata)
# permute.GetOutput().ReleaseDataFlagOn()
# permute.SetOutputSpacing(spacing, spacing, spacing)
# imagedata = permute.GetOutput()
# Picker for enabling plane motion.
# Allows selection of a cell by shooting a ray into graphics window
picker = vtk.vtkCellPicker()
picker.SetTolerance(0.005)
picker.PickFromListOn()
# 3D widget for reslicing image data.
# This 3D widget defines a plane that can be interactively placed in an image volume.
widget = vtk.vtkImagePlaneWidget()
widget.SetInput(imagedata)
widget.SetSliceIndex(self.index)
widget.SetPicker(picker)
widget.SetKeyPressActivationValue(axes)
widget.SetInteractor(self.iren)
widget.TextureVisibilityOff()
widget.DisplayTextOff()
widget.RestrictPlaneToVolumeOff()
exec("widget.SetPlaneOrientationTo"+axes.upper()+"Axes()")
widget.AddObserver("InteractionEvent",self.Update)
self.widget = widget
prop = widget.GetPlaneProperty()
prop.SetColor(colour)
# Syncronize coloured outline with texture appropriately
source = vtk.vtkPlaneSource()
source.SetOrigin(widget.GetOrigin())
source.SetPoint1(widget.GetPoint1())
source.SetPoint2(widget.GetPoint2())
source.SetNormal(widget.GetNormal())
self.source = source
mapper = vtk.vtkPolyDataMapper()
mapper.SetInput(source.GetOutput())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor.SetTexture(widget.GetTexture())
actor.VisibilityOff()
self.actor = actor
self.render.AddActor(actor)
开发者ID:invesalius,项目名称:invesalius3,代码行数:54,代码来源:volume_widgets.py
示例20: __init__
def __init__(self, vtk_image_data, name = "VtkVolumeModel"):
if not isinstance(vtk_image_data, vtk.vtkImageData):
raise TypeError("input has to be vtkImageData")
VtkModel.__init__(self, name)
self.__vtk_image_data = vtk_image_data
# The slicer for the volume data
self.__image_slicer = vtk.vtkImagePlaneWidget()
self.__image_slicer.SetResliceInterpolateToCubic()
self.__image_slicer.SetInputData(vtk_image_data)
self.__image_slicer.SetPlaneOrientationToZAxes()
开发者ID:zibneuro,项目名称:brainvispy,代码行数:13,代码来源:vtkvol.py
注:本文中的vtk.vtkImagePlaneWidget函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论