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


Python VisualizationModule.updateRendering方法代码示例

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


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

示例1: updateRendering

# 需要导入模块: from Visualizer.VisualizationModules import VisualizationModule [as 别名]
# 或者: from Visualizer.VisualizationModules.VisualizationModule import updateRendering [as 别名]
	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,代码行数:30,代码来源:PDB.py

示例2: updateRendering

# 需要导入模块: from Visualizer.VisualizationModules import VisualizationModule [as 别名]
# 或者: from Visualizer.VisualizationModules.VisualizationModule import updateRendering [as 别名]
	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,代码行数:9,代码来源:Axes.py

示例3: updateRendering

# 需要导入模块: from Visualizer.VisualizationModules import VisualizationModule [as 别名]
# 或者: from Visualizer.VisualizationModules.VisualizationModule import updateRendering [as 别名]
	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,代码行数:31,代码来源:Orthogonal.py

示例4: updateRendering

# 需要导入模块: from Visualizer.VisualizationModules import VisualizationModule [as 别名]
# 或者: from Visualizer.VisualizationModules.VisualizationModule import updateRendering [as 别名]
	def updateRendering(self):
		"""
		Update the Rendering of this module
		"""
		data = self.getInput(1)
		x,y,z = self.dataUnit.getDimensions()
		data = optimize.optimize(image = data, updateExtent = (0, x-1, 0, y-1, 0, z-1))
		if data.GetNumberOfScalarComponents() > 3:
			extract = vtk.vtkImageExtractComponents()
			extract.SetInput(data)
			extract.SetComponents(1, 1, 1)
			data = extract.GetOutput()
		if data.GetNumberOfScalarComponents() > 1:
			self.luminance.SetInput(data)
			data = self.luminance.GetOutput()
		
		z = self.parameters["Slice"]
		ext = (0, x - 1, 0, y - 1, z, z)

		voi = vtk.vtkExtractVOI()
		voi.SetVOI(ext)
		voi.SetInput(data)
		slice = voi.GetOutput()
		self.geometry.SetInput(slice)         
		
		self.warp.SetInput(self.geometry.GetOutput())
		self.warp.SetScaleFactor(self.parameters["Scale"])		
		self.merge.SetGeometry(self.warp.GetOutput())
		
		if slice.GetNumberOfScalarComponents() == 1:
			maptocol = vtk.vtkImageMapToColors()
			ctf = self.getInputDataUnit(1).getColorTransferFunction()
			maptocol.SetInput(slice)
			maptocol.SetLookupTable(ctf)
			maptocol.Update()
			scalars = maptocol.GetOutput()
		else:
			scalars = slice
			
		self.merge.SetScalars(scalars)
		data = self.merge.GetOutput()
		
		if self.parameters["Normals"]:
			self.normals.SetInput(data)
			self.normals.SetFeatureAngle(self.parameters["FeatureAngle"])
			print "Feature angle=", self.parameters["FeatureAngle"]            
			data = self.normals.GetOutput()
		
		self.mapper.SetInput(data)
		self.mapper.Update()
		VisualizationModule.updateRendering(self)
		self.parent.Render()
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:54,代码来源:WarpScalar.py

示例5: updateRendering

# 需要导入模块: from Visualizer.VisualizationModules import VisualizationModule [as 别名]
# 或者: from Visualizer.VisualizationModules.VisualizationModule import updateRendering [as 别名]
	def updateRendering(self):
		"""
		Update the Rendering of this module
		"""
		input = self.getInput(1)
		if self.parameters["InsideOut"]:
			self.boxWidget.InsideOutOn()
		else:
			self.boxWidget.InsideOutOff()
		self.boxWidget.SetInput(input)
#        self.mapper.SetInput(data)
		
		#self.mapper.Update()
		VisualizationModule.updateRendering(self)
		self.parent.Render()
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:17,代码来源:CutWidget.py

示例6: updateRendering

# 需要导入模块: from Visualizer.VisualizationModules import VisualizationModule [as 别名]
# 或者: from Visualizer.VisualizationModules.VisualizationModule import updateRendering [as 别名]
	def updateRendering(self):
		"""
		Update the Rendering of this module
		"""             
		
		if self.renew:
			self.renew = 0
		
		if not self.on:
			self.angleWidget.On()
			self.on = 1
		
		#self.mapper.Update()
		VisualizationModule.updateRendering(self, input)
		self.parent.Render()    
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:17,代码来源:Angle.py

示例7: updateRendering

# 需要导入模块: from Visualizer.VisualizationModules import VisualizationModule [as 别名]
# 或者: from Visualizer.VisualizationModules.VisualizationModule import updateRendering [as 别名]
	def updateRendering(self):
		"""
		Method: updateRendering()
		Update the Rendering of this module
		"""             
		if self.renew:
			self.spline.SetInput(self.data)
		
		if not self.on:
			self.spline.On()
			self.on = 1
		
		#self.mapper.Update()
		VisualizationModule.updateRendering(self, input)
		self.parent.Render()    
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:17,代码来源:Spline.py

示例8: updateRendering

# 需要导入模块: from Visualizer.VisualizationModules import VisualizationModule [as 别名]
# 或者: from Visualizer.VisualizationModules.VisualizationModule import updateRendering [as 别名]
	def updateRendering(self, input = None):
		"""
		Update the Rendering of this module
		"""
		self.updateMethod()
		self.updateQuality()
		self.updateInterpolation()
		self.setShading(self.parameters["UseShading"])
		
		if not input:
			input = self.getInput(1)
		x, y, z = self.dataUnit.getDimensions()

		input = optimize.optimize(image = input, updateExtent = (0, x - 1, 0, y - 1, 0, z - 1))
		
		ncomps = input.GetNumberOfScalarComponents()
		Logging.info("Number of comps=", ncomps, kw = "rendering")
		dataType = input.GetScalarType()
		if (ncomps > 1 or dataType not in [3, 5]) and self.parameters["Method"] == TEXTURE_MAPPING:
			self.setParameter("Method", 0)
			lib.messenger.send(None, "update_module_settings")
		if ncomps > 1:
			self.volumeProperty.IndependentComponentsOff()
		else:
			self.volumeProperty.IndependentComponentsOn()
			
		Logging.info("Rendering using, ", self.mapper.__class__, kw = "rendering")
		self.mapper.SetInput(input)
		if self.mapperUpdated:
			self.volume.SetMapper(self.mapper)
			self.mapperUpdated = False
		if not self.volumeAdded:
			self.parent.getRenderer().AddVolume(self.volume)
			self.volumeAdded = True
			
		VisualizationModule.updateRendering(self, input)
		self.parent.Render()
		if self.parameters["Method"] == TEXTURE_MAPPING_3D:
			if not self.mapper.IsRenderSupported(self.volumeProperty, self.renderer):
				lib.messenger.send(None, \
								"show_error", \
								"3D texture mapping not supported", \
								"Your graphics hardware does not support 3D accelerated texture mapping. \
								Please use one of the other volume rendering methods.")
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:46,代码来源:Volume.py

示例9: updateRendering

# 需要导入模块: from Visualizer.VisualizationModules import VisualizationModule [as 别名]
# 或者: from Visualizer.VisualizationModules.VisualizationModule import updateRendering [as 别名]
	def updateRendering(self):
		"""
		Update the Rendering of this module
		"""
		#self.outline.SetInput(self.data)
		#self.outlineMapper.SetInput(self.outline.GetOutput())
		
		#self.outlineMapper.Update()

		if self.renew:
			data = self.getInput(1)
			self.planeWidget.SetInput(data)
			self.renew = 0
		
		if not self.on:
			self.planeWidget.On()
			self.on = 1
		
		#self.mapper.Update()
		VisualizationModule.updateRendering(self, input)
		self.parent.Render()    
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:23,代码来源:ClippingPlane.py

示例10: updateRendering

# 需要导入模块: from Visualizer.VisualizationModules import VisualizationModule [as 别名]
# 或者: from Visualizer.VisualizationModules.VisualizationModule import updateRendering [as 别名]
    def updateRendering(self):
        """
		Update the Rendering of this module
		"""
        method = self.parameters["Method"]
        self.setMethod(method)

        if self.volumeModule:
            self.volumeModule.function = vtk.vtkVolumeRayCastIsosurfaceFunction()
            self.volumeModule.function.SetIsoValue(self.parameters["IsoValue"])
            self.volumeModule.showTimepoint(self.timepoint)
            return

        if not self.init:
            self.init = 1
            self.mapper.ColorByArrayComponent(0, 0)
        self.mapper.AddObserver("ProgressEvent", lib.messenger.send)
        lib.messenger.connect(self.mapper, "ProgressEvent", self.updateProgress)
        dataUnit = self.getInputDataUnit(1)
        if not dataUnit:
            dataUnit = self.dataUnit
        dataCtf = dataUnit.getColorTransferFunction()
        if self.parameters["SolidColor"]:
            minval, maxval = dataCtf.GetRange()
            ctf = vtk.vtkColorTransferFunction()
            ctf.AddRGBPoint(int(minval), 0, 0, 0)
            r, g, b = dataCtf.GetColor(maxval)
            ctf.AddRGBPoint(int(minval) + 1, r, g, b)
            ctf.AddRGBPoint(maxval, r, g, b)
        else:
            ctf = dataCtf
        self.mapper.SetLookupTable(ctf)
        self.mapper.ScalarVisibilityOn()

        minVal, maxVal = self.data.GetScalarRange()
        self.setScalarRange(minVal, maxVal)

        self.mapper.SetScalarRange(minVal, maxVal)
        self.mapper.SetColorModeToMapScalars()

        opacity = self.parameters["Transparency"]
        opacity = (100 - opacity) / 100.0
        Logging.info("Using opacity ", opacity, kw="visualizer")
        if opacity != 1:
            cullers = self.parent.getRenderer().GetCullers()
            cullers.InitTraversal()
            culler = cullers.GetNextItem()
            culler.SetSortingStyleToBackToFront()
            # print cullers, culler
            # self.parent.getRenderer().GetRenderWindow().SetAlphaBitPlanes(1)
            # self.parent.getRenderer().GetRenderWindow().SetMultiSamples(0)
            # self.parent.getRenderer().SetUseDepthPeeling(1)
            # self.parent.getRenderer().SetMaximumNumberOfPeels(100)
            # self.parent.getRenderer().SetOcclusionRatio(1.0)
            # print self.parent.getRenderer().GetLastRenderingUsedDepthPeeling()

        self.actor.GetProperty().SetOpacity(opacity)

        polyinput = self.getPolyDataInput(1)
        if polyinput:
            Logging.info("Using polydata input", kw="visualizer")
            self.mapper.SetInput(polyinput)
            VisualizationModule.updateRendering(self, polyinput)
            self.parent.Render()
            return

        x, y, z = self.dataUnit.getDimensions()
        input = self.getInput(1)
        input = optimize.optimize(image=input, updateExtent=(0, x - 1, 0, y - 1, 0, z - 1))

        if self.parameters["Gaussian"]:
            Logging.info("Doing gaussian smoothing", kw="visualizer")
            if not self.smooth:
                self.smooth = vtk.vtkImageGaussianSmooth()
            self.smooth.SetInput(input)
            input = self.smooth.GetOutput()

        self.contour.SetInput(input)
        input = self.contour.GetOutput()

        multi = self.parameters["MultipleSurfaces"]

        if not multi:
            Logging.info("Using single isovalue=%d" % int(self.parameters["IsoValue"]), kw="visualizer")
            self.contour.SetValue(0, self.parameters["IsoValue"])
        else:
            begin = self.parameters["SurfaceRangeBegin"]
            end = self.parameters["SurfaceRangeEnd"]
            n = self.parameters["SurfaceAmnt"]
            Logging.info("Generating %d values in range %d-%d" % (n, begin, end), kw="visualizer")
            self.contour.GenerateValues(n, begin, end)
            n = self.contour.GetNumberOfContours()
            for i in range(0, n):
                self.contour.SetValue(i, int(self.contour.GetValue(i)))
                # print self.contour

                # TODO: should decimateLevel and preserveTopology be instance variables?
        decimateLevel = self.parameters["Simplify"]
        preserveTopology = self.parameters["PreserveTopology"]
        if decimateLevel != 0:
#.........这里部分代码省略.........
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:103,代码来源:NewSurface.py

示例11: updateRendering

# 需要导入模块: from Visualizer.VisualizationModules import VisualizationModule [as 别名]
# 或者: from Visualizer.VisualizationModules.VisualizationModule import updateRendering [as 别名]
    def updateRendering(self):
        """
		Update the Rendering of this module
		"""
        self.mapper.AddObserver("ProgressEvent", lib.messenger.send)
        lib.messenger.connect(self.mapper, "ProgressEvent", self.updateProgress)
        dataUnit = self.getInputDataUnit(1)
        inputDataUnit2 = self.getInputDataUnit(2)

        settings = inputDataUnit2.getSettings()
        filterList = settings.get("FilterList")

        if not dataUnit:
            dataUnit = self.dataUnit
        self.mapper.SetLookupTable(dataUnit.getColorTransferFunction())
        self.mapper.ScalarVisibilityOn()

        min, max = self.data.GetScalarRange()

        # if (min,max) != self.scalarRange:
        self.setScalarRange(min, max)

        dataUnit = self.getInputDataUnit(1)
        self.mapper.ColorByArrayComponent(0, 0)
        self.mapper.SetScalarRange(min, max)
        self.mapper.SetColorModeToMapScalars()
        self.mapper.SetLookupTable(dataUnit.getColorTransferFunction())
        self.mapper.ScalarVisibilityOn()

        self.updateOpacity()
        # self.actor2.GetProperty().SetOpacity(opacity)

        polyinput = self.getPolyDataInput(1)
        if polyinput:
            Logging.info("Using polydata input", kw="visualizer")
            VisualizationModule.updateRendering(self, polyinput)
        else:
            input = self.getInput(1)

            x, y, z = self.dataUnit.getDimensions()
            input = optimize.optimize(image=input, updateExtent=(0, x - 1, 0, y - 1, 0, z - 1))
            self.contour.SetInput(input)
            polyinput = self.contour.GetOutput()

        input2 = self.getInput(2)
        minval, maxval = input2.GetScalarRange()

        input2.Update()
        self.contour2.SetInput(input2)
        print "Generating", maxval - 1, "values in range", 1, maxval
        self.contour2.GenerateValues(maxval - 1, 1, maxval)
        n = self.contour2.GetNumberOfContours()
        for i in range(0, n):
            self.contour2.SetValue(i, int(self.contour2.GetValue(i)))

        self.mapper2.ColorByArrayComponent(0, 0)
        self.mapper2.SetScalarRange(min, max)

        if not self.parameters["MarkColor"]:
            self.mapper2.SetLookupTable(inputDataUnit2.getColorTransferFunction())
        else:
            self.setLookupTableBasedOnDistance(self.parameters["Distance"])

        print "\n\n\n*** INPUT DATAUNIT2=", inputDataUnit2
        self.mapper2.SetColorModeToMapScalars()
        self.mapper2.ScalarVisibilityOn()

        polyinput2 = self.contour2.GetOutput()

        decimateLevel = self.parameters["Simplify"]
        preserveTopology = self.parameters["PreserveTopology"]
        if decimateLevel != 0:
            self.decimate.SetPreserveTopology(preserveTopology)
            if not preserveTopology:
                self.decimate.SplittingOn()
                self.decimate.BoundaryVertexDeletionOn()
            else:
                self.decimate.SplittingOff()
                self.decimate.BoundaryVertexDeletionOff()
            self.decimate.SetTargetReduction(decimateLevel / 100.0)

            Logging.info(
                "Decimating %.2f%%, preserve topology: %s" % (decimateLevel, preserveTopology), kw="visualizer"
            )
            self.decimate.SetInput(polyinput)
            polyinput = self.decimate.GetOutput()

        if self.parameters["Normals"]:
            angle = self.parameters["FeatureAngle"]
            Logging.info("Generating normals at angle", angle, kw="visualizer")
            self.normals.SetFeatureAngle(angle)
            self.normals.SetInput(polyinput)
            polyinput = self.normals.GetOutput()

        self.mapper.SetInput(polyinput)
        self.mapper2.SetInput(polyinput2)
        self.init = True
        VisualizationModule.updateRendering(self, polyinput)
        self.parent.Render()
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:101,代码来源:PolydataVisualization.py

示例12: updateRendering

# 需要导入模块: from Visualizer.VisualizationModules import VisualizationModule [as 别名]
# 或者: from Visualizer.VisualizationModules.VisualizationModule import updateRendering [as 别名]
	def updateRendering(self):
		"""
		Update the Rendering of this module
		"""
		for actor in self.actors:
			self.renderer.RemoveActor(actor)
		self.actors = []
		if self.showTracks:
			edges = vtk.vtkCellArray()
			inputUnit = self.getInputDataUnit(1)
			timepoint = scripting.visualizer.getTimepoint()
			timepoints = scripting.visualizer.getNumberOfTimepoints()

			tubeRadius = self.parameters["TubeRadius"]
			sphereRadius = self.parameters["SphereRadius"]

			tracks = self.getPoints(self.showTracks)
			appendLines  = vtk.vtkAppendPolyData()
			appendSpheres = vtk.vtkAppendPolyData()
			appendFirst = vtk.vtkAppendPolyData()
			appendLast = vtk.vtkAppendPolyData()
			appendCurrent = vtk.vtkAppendPolyData()
			
			lineactor = vtk.vtkActor()
			lineactor.SetMapper(self.lineMapper)
			lineactor.GetProperty().SetDiffuseColor(1, 1, 1)
			spheresActor = vtk.vtkActor()
			spheresActor.SetMapper(self.sphereMapper)
			spheresActor.GetProperty().SetDiffuseColor(0, 1, 1)
			
			firstActor = vtk.vtkActor()
			firstActor.SetMapper(self.firstMapper)
			firstActor.GetProperty().SetDiffuseColor(0, 1, 0)
			
			lastActor = vtk.vtkActor()
			lastActor.SetMapper(self.lastMapper)
			lastActor.GetProperty().SetDiffuseColor(1, 0, 0)
			
			currentActor = vtk.vtkActor()
			currentActor.SetMapper(self.currentMapper)
			currentActor.GetProperty().SetDiffuseColor(0, 0, 1)
			
			dataw, datay, dataz = inputUnit.getDimensions()
			for track in tracks:
				dx, dy, dz = 0,0,0
				if self.parameters["SameStartingPoint"]:
					dx = -track[0][1][0]
					dy = -track[0][1][1]
					dz = -track[0][1][2]
					dx += dataw/2
					dy += datay/2
					dz += dataz/2

				for i, (t,(x, y, z)) in enumerate(track[:-1]):
					x += dx
					y += dy
					z += dz
					t2, (x2,y2,z2) = track[i + 1]
					x2 += dx
					y2 += dy
					z2 += dz

					if x != x2 or y != y2 or z != z2:
						linesource = vtk.vtkLineSource()
						linesource.SetPoint1(x, y, z)
						linesource.SetPoint2(x2, y2, z2)
						tubeFilter = vtk.vtkTubeFilter()
						tubeFilter.SetRadius(tubeRadius)
						tubeFilter.SetNumberOfSides(10)
						tubeFilter.SetInput(linesource.GetOutput())
						appendLines.AddInput(tubeFilter.GetOutput())
					
					sph = vtk.vtkSphereSource()
					sph.SetPhiResolution(20)
					sph.SetThetaResolution(20)
					sph.SetCenter(x, y, z)
					sph.SetRadius(sphereRadius)
					
					if t == timepoint:
						appendCurrent.AddInput(sph.GetOutput())
					elif i != 0:
						appendSpheres.AddInput(sph.GetOutput())

				if timepoint != track[0][0]:
					sph = vtk.vtkSphereSource()
					sph.SetPhiResolution(20)
					sph.SetThetaResolution(20)
					x,y,z = track[0][1]
					x += dx
					y += dy
					z += dz
					sph.SetCenter((x,y,z))
					sph.SetRadius(sphereRadius)
					appendFirst.AddInput(sph.GetOutput())

				sph = vtk.vtkSphereSource()
				sph.SetPhiResolution(20)
				sph.SetThetaResolution(20)
				x,y,z = track[-1][1]
				x += dx
#.........这里部分代码省略.........
开发者ID:chalkie666,项目名称:bioimagexd-svn-import-from-sourceforge,代码行数:103,代码来源:VisualizeTrack.py


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