当前位置: 首页>>代码示例>>Python>>正文


Python VisualizationModules.VisualizationModule类代码示例

本文整理汇总了Python中Visualizer.VisualizationModules.VisualizationModule的典型用法代码示例。如果您正苦于以下问题:Python VisualizationModule类的具体用法?Python VisualizationModule怎么用?Python VisualizationModule使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了VisualizationModule类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __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.distanceWidget = vtk.vtkDistanceWidget()
		self.obsTag = self.distanceWidget.AddObserver("EndInteractionEvent", self.onPlacePoint)
		self.representation = vtkbxd.vtkDistanceRepresentationScaled2D()
		self.representation.SetScaleX(1.0)
		self.representation.SetScaleZ(1.0)
		self.distanceWidget.SetRepresentation(self.representation)
		self.renderer = self.parent.getRenderer()
		iactor = self.wxrenwin.GetRenderWindow().GetInteractor()
		self.distanceWidget.SetInteractor(iactor)
		self.picker = vtk.vtkCellPicker()
		self.currentPlane = None

		#self.picker.SetTolerance(0.05)
		#self.updateRendering()
		self.filterDesc = "Measure distance in 3D view"
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:25,代码来源:Distance.py

示例2: showTimepoint

	def showTimepoint(self, value):
		"""
		Method: showTimepoint(tp)
		Set the timepoint to be displayed
		"""          
		self.renew = 1
		VisualizationModule.showTimepoint(self, value)
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:7,代码来源:Spline.py

示例3: setDataUnit

	def setDataUnit(self, dataunit):
		"""
		Sets the dataunit this module uses for visualization
		"""
		if dataunit == None:
			return
		VisualizationModule.setDataUnit(self, dataunit)
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:7,代码来源:PDB.py

示例4: __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

示例5: updateRendering

	def updateRendering(self):
		"""
		Update the Rendering of this module
		"""
		filename = self.parameters["FileName"]
		if not os.path.exists(filename) or not self.enabled:
			return

		self.reader.SetFileName(filename)
		self.reader.SetHBScale(1.0)
		self.reader.SetBScale(1.0)

		self.sphereSource.SetRadius(self.parameters['SphereRadius'])
		self.tubeFilter.SetRadius(self.parameters['TubeRadius'])
		
		self.glyph3D.SetInputConnection(self.reader.GetOutputPort())
		self.mapper.SetInputConnection(self.glyph3D.GetOutputPort())
		self.tubeFilter.SetInputConnection(self.reader.GetOutputPort())
		self.mapper2.SetInputConnection(self.tubeFilter.GetOutputPort())
		
		if not self.actorsInitialized:
			self.renderer.AddActor(self.tubeActor)
			self.renderer.AddActor(self.actor)
			self.actorsInitialized = True

		self.mapper.Update()
		VisualizationModule.updateRendering(self)
		self.parent.Render()
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:28,代码来源:PDB.py

示例6: __set_pure_state__

	def __set_pure_state__(self, state):
		"""
		Set the state of the light
		"""        
		VisualizationModule.__set_pure_state__(self, state)
		self.parameters = state.parameters
		self.sendUpdateGUI()
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:7,代码来源:CutWidget.py

示例7: setDataUnit

	def setDataUnit(self, dataunit):
		"""
		Sets the dataunit this module uses for visualization
		"""       
		VisualizationModule.setDataUnit(self, dataunit)
		if self.dataUnit.isProcessed():
			data = self.dataUnit.getSourceDataUnits()[0].getTimepoint(0)
		else:
			data = self.dataUnit.getTimepoint(0)
		self.origin = data.GetOrigin()
		self.spacing = data.GetSpacing()
		self.extent = data.GetWholeExtent()

		x = self.extent[1] / 2
		y = self.extent[3] / 2
		z = self.extent[5] / 2
		self.setDisplaySlice(x, y, z)

		ctf = self.dataUnit.getColorTransferFunction()
		self.planeWidgetX.GetColorMap().SetLookupTable(ctf)
		self.planeWidgetX.maxDim = x
		
		self.planeWidgetY.GetColorMap().SetLookupTable(ctf)
		self.planeWidgetY.maxDim = y
		
		self.planeWidgetZ.GetColorMap().SetLookupTable(ctf)
		self.planeWidgetZ.maxDim = z
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:27,代码来源:Orthogonal.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.name = "Scale bar"
		self.renew = 1
		self.mapper = vtk.vtkDataSetMapper()
		
		self.actor = vtk.vtkActor()
		self.actor.SetMapper(self.mapper)
		self.width = 10
		self.widthPx = 100
		self.voxelSize = (1, 1, 1)
		
		self.renderer = self.parent.getRenderer()
		self.renderer.AddActor(self.actor)
		

		self.polyLine = vtk.vtkPolyLine()
		#self.mapper.SetInput(self.polyLine.GetOutput())
		self.actor.GetProperty().SetColor(1, 1, 1)
			   
		self.textActor = vtk.vtkTextActor()
		#self.textActor.ScaledTextOn()
		self.renderer.AddActor2D(self.textActor)
		
		iactor = self.wxrenwin.GetRenderWindow().GetInteractor()
		style = iactor.GetInteractorStyle()
#        style.AddObserver("StartInteractionEvent",self.updateLine)
		style.AddObserver("EndInteractionEvent", self.updateRendering)
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:32,代码来源:ScaleBar.py

示例9: __init__

	def __init__(self, parent, visualizer, **kws):
		"""
		Initialization
		"""
		self.x, self.y, self.z = -1, -1, -1
		#self.name = "Clipping Plane"
		self.parent = parent        
		self.on = 0
		self.renew = 1
		self.currentPlane = None
		self.clipped = 0
		self.clippedModules = []
		self.planeWidget = vtk.vtkPlaneWidget()
		self.planeWidget.AddObserver("InteractionEvent", self.clipVolumeRendering)
		self.planeWidget.SetResolution(20)
		self.planeWidget.SetRepresentationToOutline()
		self.planeWidget.NormalToXAxisOn()
		self.renderer = self.parent.getRenderer()
		self.plane = vtk.vtkPlane()

		iactor = parent.wxrenwin.GetRenderWindow().GetInteractor()
		self.planeWidget.SetInteractor(iactor)
		VisualizationModule.__init__(self, parent, visualizer, **kws)
		
		self.descs = {"ShowControl": "Show controls",
					  "AllModules": "Clip all modules",
					  "ClippedModule": "Module to clip"}
		self.filterDesc = "Clip rendering using a plane"
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:28,代码来源:ClippingPlane.py

示例10: setParameter

	def setParameter(self, parameter, value):
		"""
		Set a value for the parameter
		"""
		#if parameter == "AllTracks":
		#	lib.messenger.send(None, "visualize_all_tracks", value)
		VisualizationModule.setParameter(self, parameter, value)
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:7,代码来源:VisualizeTrack.py

示例11: updateRendering

	def updateRendering(self, e1 = None, e2 = None):
		"""
		Update the Rendering of this module
		"""             
		#self.mapper.Update()
		VisualizationModule.updateRendering(self, input)
		self.wxrenwin.Render()    
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:7,代码来源:Axes.py

示例12: setParameter

	def setParameter(self, parameter, value):
		"""
		set a parameter to given value
		"""
		VisualizationModule.setParameter(self, parameter, value)
		if parameter == "ShowControls" and self.boxWidget:
			self.showPlane(value)
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:7,代码来源:CutWidget.py

示例13: updateRendering

	def updateRendering(self):
		"""
		Update the Rendering of this module
		"""
		if self.useOutline:
			self.outline.SetInput(self.data)
			self.outlineMapper.SetInput(self.outline.GetOutput())
			self.outlineMapper.Update()

		if self.renew:
			self.planeWidgetX.SetInput(self.data)
			self.planeWidgetZ.SetInput(self.data)
			self.planeWidgetY.SetInput(self.data)
			self.renew = 0
			for i in ["X", "Y", "Z"]:
				eval("self.planeWidget%s.SetPlaneOrientationTo%sAxes()" % (i, i))            
		self.planeWidgetX.SetSliceIndex(self.x)
		self.planeWidgetY.SetSliceIndex(self.y)
		self.planeWidgetZ.SetSliceIndex(self.z)
		
		if not self.on:
			self.planeWidgetX.On()
			self.planeWidgetY.On()
			self.planeWidgetZ.On()
			self.on = 1
		
		#self.mapper.Update()
		VisualizationModule.updateRendering(self, input)
		self.parent.Render()    
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:29,代码来源:Orthogonal.py

示例14: __init__

	def __init__(self, parent, visualizer, **kws):
		"""
		Method: __init__(parent)
		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 Camera Path"
		

		self.spline = spline = vtk.vtkSplineWidget()
		self.spline.GetLineProperty().SetColor(1, 0, 0)
		self.spline.GetHandleProperty().SetColor(0, 1, 0)
		self.spline.SetResolution(1000)

		#TODO: endInteraction is in GUI.Urmas.SplineEditor
		self.spline.AddObserver("EndInteractionEvent", self.endInteraction)
		self.spline.AddObserver("InteractionEvent", self.endInteraction)

		#TODO: iren is in GUI.Urmas.SplineEditor
		self.spline.SetInteractor(self.iren)
		#self.spline.On()
		
		#self.spline.SetEnabled(1)        
		self.renderer = self.parent.getRenderer()
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:28,代码来源:Spline.py

示例15: __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


注:本文中的Visualizer.VisualizationModules.VisualizationModule类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。