• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Python vtk.vtkVolumeProperty函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: __init__

	def __init__(self):
		super(VolumeVisualizationCT, self).__init__()

		self.visualizationType = VisualizationTypeCT

		# Cloth, Skin, Muscle, Vascular stuff, Cartilage, Bones
		self.sections = [-3000.0, -964.384, -656.56, 20.144, 137.168, 233.84, 394.112, 6000.0]
		self.sectionsOpacity = [0.0, 0.0, 0.0, 0.0, 0.07, 0.1, 0.2]
		self.sectionNames = ["Air:", "Cloth:", "Skin:", "Muscle:", "Blood vessels:", "Cartilage:", "Bones:"]

		# sectionColors should be specified for each boundary
		# Just like opacity should be tweaked. A section can have any slope / configuration
		self.sectionColors = [(1.0, 1.0, 1.0),
							(0.0, 1.0, 0.0),
							(1.0, 0.9, 0.8),
							(1.0, 0.7, 0.6),
							(1.0, 0.2, 0.2),
							(1.0, 0.9, 0.7),
							(0.9, 1.0, 0.9)]

		# Create property and attach the transfer function
		self.volProp = vtkVolumeProperty()
		self.volProp.SetIndependentComponents(True)
		self.volProp.SetInterpolationTypeToLinear()
		self.volProp.ShadeOn()
		self.volProp.SetAmbient(0.1)
		self.volProp.SetDiffuse(0.9)
		self.volProp.SetSpecular(0.2)
		self.volProp.SetSpecularPower(10.0)
		self.volProp.SetScalarOpacityUnitDistance(0.8919)
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:30,代码来源:VolumeVisualizationCT.py


示例2: axonComparison

def axonComparison(axons, N):
    axonsToRender = []
    for i in range(N):
        axon = axons.pop(random.randrange(len(axons)))
        axonsToRender.append(axon)
    bins = main.BINS
    data_matrix = numpy.zeros([500, 500, 500], dtype=numpy.uint16)
    dataImporter = vtk.vtkImageImport()
    data_string = data_matrix.tostring()
    dataImporter.CopyImportVoidPointer(data_string, len(data_string))
    dataImporter.SetDataScalarTypeToUnsignedChar()
    dataImporter.SetNumberOfScalarComponents(1)
    dataImporter.SetDataExtent(0, 500, 0, 500, 0, 500)
    dataImporter.SetWholeExtent(0, 500, 0, 500, 0, 500)
    volumeProperty = vtk.vtkVolumeProperty()
    compositeFunction = vtk.vtkVolumeRayCastCompositeFunction()
    volumeMapper = vtk.vtkVolumeRayCastMapper()
    volumeMapper.SetVolumeRayCastFunction(compositeFunction)
    volumeMapper.SetInputConnection(dataImporter.GetOutputPort())
    volume = vtk.vtkVolume()
    volume.SetMapper(volumeMapper)
    volume.SetProperty(volumeProperty)
    renderer = vtk.vtkRenderer()
    renderWin = vtk.vtkRenderWindow()
    renderWin.AddRenderer(renderer)
    renderInteractor = vtk.vtkRenderWindowInteractor()
    renderInteractor.SetRenderWindow(renderWin)
    renderer.SetBackground(1, 1, 1)
    renderWin.SetSize(400, 400)
    for axon in axonsToRender:
        renderer = Utils.renderSingleAxon(axon, renderer, [random.random(), random.random(), random.random()])
    renderWin.AddObserver("AbortCheckEvent", exitCheck)
    renderInteractor.Initialize()
    renderWin.Render()
    renderInteractor.Start()
开发者ID:EthanGlasserman,项目名称:Brainbow,代码行数:35,代码来源:Draw.py


示例3: volumeRender

def volumeRender(img, tf=[],spacing=[1.0,1.0,1.0]):
    importer = numpy2VTK(img,spacing)

    # Transfer Functions
    opacity_tf = vtk.vtkPiecewiseFunction()
    color_tf = vtk.vtkColorTransferFunction()

    if len(tf) == 0:
        tf.append([img.min(),0,0,0,0])
        tf.append([img.max(),1,1,1,1])

    for p in tf:
        color_tf.AddRGBPoint(p[0], p[1], p[2], p[3])
        opacity_tf.AddPoint(p[0], p[4])

    volMapper = vtk.vtkGPUVolumeRayCastMapper()
    volMapper.SetInputConnection(importer.GetOutputPort())

    # The property describes how the data will look
    volProperty =  vtk.vtkVolumeProperty()
    volProperty.SetColor(color_tf)
    volProperty.SetScalarOpacity(opacity_tf)
    volProperty.ShadeOn()
    volProperty.SetInterpolationTypeToLinear()

    vol = vtk.vtkVolume()
    vol.SetMapper(volMapper)
    vol.SetProperty(volProperty)
    
    return [vol]
开发者ID:zadacka,项目名称:MSC_Project,代码行数:30,代码来源:kevin_numpy_converter.py


示例4: volumeRender

def volumeRender(reader,ren,renWin):
	#Create transfer mapping scalar value to opacity
	opacityTransferFunction = vtk.vtkPiecewiseFunction()
	opacityTransferFunction.AddPoint(1, 0.0)
	opacityTransferFunction.AddPoint(100, 0.1)
	opacityTransferFunction.AddPoint(255,1.0)

	colorTransferFunction = vtk.vtkColorTransferFunction()
	colorTransferFunction.AddRGBPoint(0.0,0.0,0.0,0.0)	
	colorTransferFunction.AddRGBPoint(64.0,1.0,0.0,0.0)	
	colorTransferFunction.AddRGBPoint(128.0,0.0,0.0,1.0)	
	colorTransferFunction.AddRGBPoint(192.0,0.0,1.0,0.0)	
	colorTransferFunction.AddRGBPoint(255.0,0.0,0.2,0.0)	

	volumeProperty = vtk.vtkVolumeProperty()
	volumeProperty.SetColor(colorTransferFunction)
	volumeProperty.SetScalarOpacity(opacityTransferFunction)
	volumeProperty.ShadeOn()
	volumeProperty.SetInterpolationTypeToLinear()

	compositeFunction = vtk.vtkVolumeRayCastCompositeFunction()
	volumeMapper = vtk.vtkFixedPointVolumeRayCastMapper()
	volumeMapper.SetInputConnection(reader.GetOutputPort())

	volume = vtk.vtkVolume()
	volume.SetMapper(volumeMapper)
	volume.SetProperty(volumeProperty)

	ren.RemoveAllViewProps()

	ren.AddVolume(volume)
	ren.SetBackground(1,1,1)

	renWin.Render()
开发者ID:kvkenyon,项目名称:projects,代码行数:34,代码来源:App.py


示例5: __init__

	def __init__(self):
		super(VolumeVisualizationSimple, self).__init__()

		self.visualizationType = VisualizationTypeSimple

		# Create the volume property
		self.volProp = vtkVolumeProperty()
		self.volProp.SetIndependentComponents(True)
		self.volProp.SetInterpolationTypeToLinear()
		self.volProp.ShadeOn()
		self.volProp.SetAmbient(0.3)
		self.volProp.SetDiffuse(0.8)
		self.volProp.SetSpecular(0.2)
		self.volProp.SetSpecularPower(10.0)
		self.volProp.SetScalarOpacityUnitDistance(0.8919)

		self.minimum = 0
		self.maximum = 1
		self.lowerBound = 0
		self.upperBound = 1
		colors = [[255, 139, 0], [0, 147, 255], [0, 255, 147], [213, 100, 255], [255, 75, 75]]
		self.colors = map(lambda x: [x[0] / 255.0, x[1] / 255.0, x[2] / 255.0], colors)
		self.color = self.colors[0]
		self.opacity = 1.0
		self.colorFunction = None
		self.opacityFunction = None
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:26,代码来源:VolumeVisualizationSimple.py


示例6: __init__

  def __init__(self, name, image_data):
    if not isinstance(image_data, vtk.vtkImageData):
      raise TypeError("input has to be vtkImageData")

    self.name = name

    # Create transfer mapping scalar value to opacity.
    opacity_function = vtk.vtkPiecewiseFunction()
    opacity_function.AddPoint(0,   0.0)
    opacity_function.AddPoint(127, 0.0)
    opacity_function.AddPoint(128, 0.2)
    opacity_function.AddPoint(255, 0.2)
    
    # Create transfer mapping scalar value to color.
    color_function = vtk.vtkColorTransferFunction()
    color_function.SetColorSpaceToHSV()
    color_function.AddHSVPoint(0,   0.0, 0.0, 0.0)
    color_function.AddHSVPoint(127, 0.0, 0.0, 0.0)
    color_function.AddHSVPoint(128, 0.0, 0.0, 1.0)
    color_function.AddHSVPoint(255, 0.0, 0.0, 1.0)
    
    volume_property = vtk.vtkVolumeProperty()
    volume_property.SetColor(color_function)
    volume_property.SetScalarOpacity(opacity_function)
    volume_property.ShadeOn()
    volume_property.SetInterpolationTypeToLinear()
    
    volume_mapper = vtk.vtkSmartVolumeMapper()
    volume_mapper.SetInputData(image_data)
    
    self.volume = vtk.vtkVolume()
    self.volume.SetMapper(volume_mapper)
    self.volume.SetProperty(volume_property)
开发者ID:papazov3d,项目名称:invipy,代码行数:33,代码来源:vtkvol.py


示例7: _create_pipeline

    def _create_pipeline(self):
        # setup our pipeline

        self._otf = vtk.vtkPiecewiseFunction()
        self._ctf = vtk.vtkColorTransferFunction()

        self._volume_property = vtk.vtkVolumeProperty()
        self._volume_property.SetScalarOpacity(self._otf)
        self._volume_property.SetColor(self._ctf)
        self._volume_property.ShadeOn()
        self._volume_property.SetAmbient(0.1)
        self._volume_property.SetDiffuse(0.7)
        self._volume_property.SetSpecular(0.2)
        self._volume_property.SetSpecularPower(10)

        self._volume_raycast_function = vtk.vtkVolumeRayCastMIPFunction()
        self._volume_mapper = vtk.vtkVolumeRayCastMapper()

        # can also used FixedPoint, but then we have to use:
        # SetBlendModeToMaximumIntensity() and not SetVolumeRayCastFunction
        #self._volume_mapper = vtk.vtkFixedPointVolumeRayCastMapper()
        
        self._volume_mapper.SetVolumeRayCastFunction(
            self._volume_raycast_function)

        
        module_utils.setup_vtk_object_progress(self, self._volume_mapper,
                                           'Preparing render.')

        self._volume = vtk.vtkVolume()
        self._volume.SetProperty(self._volume_property)
        self._volume.SetMapper(self._volume_mapper)
开发者ID:fvpolpeta,项目名称:devide,代码行数:32,代码来源:MIPRender.py


示例8: _initialize

    def _initialize (self):
        debug ("In Volume::_initialize ()")
        self.data_range = dr = self.mod_m.get_scalar_data_range ()
        
        ctf = default_color_transfer_function(dr[0], dr[1])
        otf = default_opacity_transfer_function(dr[0], dr[1])

        self.rc_func = 0 # 0 - composite, 1 - MIP, 2 - Isosurface
        self.ray_cast_func = self.get_ray_cast_function()

        self.vp_func = 0 # 0 - composite, 1 - MAXIP, 2 - MINIP

        # 0 - Ray cast, 1 - TextureMapper, 2 -- VolumeProMapper
        self.map_type = -1 # Uninitialized
        map_type = 0 # default to ray cast.
        
        self.set_map_type(map_type)
            
        self.map.SetInput (self.mod_m.GetOutput ())
        
        # The property describes how the data will look
        volumeProperty = vtk.vtkVolumeProperty()
        volumeProperty.SetColor(ctf)
        volumeProperty.SetScalarOpacity(otf)
        volumeProperty.SetInterpolationTypeToLinear()
        volumeProperty.ShadeOn()
                
        self.act.SetMapper (self.map)
        self.act.SetProperty (volumeProperty)
        
        self.renwin.add_actors (self.act)
        # used for the pipeline browser
        self.pipe_objs = self.act
开发者ID:sldion,项目名称:DNACC,代码行数:33,代码来源:Volume.py


示例9: create_volume_rendering

    def create_volume_rendering(self):

        opacityfunction=vtk.vtkPiecewiseFunction()

        opacityfunction.AddPoint(0,0.0)
        opacityfunction.AddPoint(0.1,0.01)
        opacityfunction.AddPoint(1,0.02)
        opacityfunction.AddPoint(1.5,0.03)

        volproperty=vtk.vtkVolumeProperty()
        volproperty.SetColor(self.arrowColor)
        volproperty.SetScalarOpacity(opacityfunction)
        volproperty.ShadeOn()
        volproperty.SetInterpolationTypeToLinear()


        volumeMapper = vtk.vtkGPUVolumeRayCastMapper()
        volumeMapper.SetInputConnection(self.vol_reader.GetOutputPort())
        volumeMapper.SetSampleDistance(0.01)

        volume = vtk.vtkVolume()
        volume.SetMapper(volumeMapper)
        volume.SetProperty(volproperty)

        return volume
开发者ID:svelezsaffon,项目名称:Diffusion_Tensor_Visualization_VTK,代码行数:25,代码来源:fa_hyper.py


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


示例11: _createPipeline

    def _createPipeline(self):
        # setup our pipeline
        self._splatMapper = vtkdevide.vtkOpenGLVolumeShellSplatMapper()
        self._splatMapper.SetOmegaL(0.9)
        self._splatMapper.SetOmegaH(0.9)
        # high-quality rendermode
        self._splatMapper.SetRenderMode(0)

        self._otf = vtk.vtkPiecewiseFunction()
        self._otf.AddPoint(0.0, 0.0)
        self._otf.AddPoint(0.9, 0.0)
        self._otf.AddPoint(1.0, 1.0)

        self._ctf = vtk.vtkColorTransferFunction()
        self._ctf.AddRGBPoint(0.0, 0.0, 0.0, 0.0)
        self._ctf.AddRGBPoint(0.9, 0.0, 0.0, 0.0)
        self._ctf.AddRGBPoint(1.0, 1.0, 0.937, 0.859)

        self._volumeProperty = vtk.vtkVolumeProperty()
        self._volumeProperty.SetScalarOpacity(self._otf)
        self._volumeProperty.SetColor(self._ctf)
        self._volumeProperty.ShadeOn()
        self._volumeProperty.SetAmbient(0.1)
        self._volumeProperty.SetDiffuse(0.7)
        self._volumeProperty.SetSpecular(0.2)
        self._volumeProperty.SetSpecularPower(10)

        self._volume = vtk.vtkVolume()
        self._volume.SetProperty(self._volumeProperty)
        self._volume.SetMapper(self._splatMapper)
开发者ID:fvpolpeta,项目名称:devide,代码行数:30,代码来源:shellSplatSimple.py


示例12: get_volume

    def get_volume(self, color_file=None, volume_opacity=0.25):
        """
        Default Volume Rendering
        Return vtkActor. For volume rendering it is vtkVolume
        """
        if not self.flag_read:
            sys.stderr.write('No Image Loaded.')
            return

        # TEST
        print self.is_blank_image()

        transfer_func = self.get_transfer_functioin(color_file, volume_opacity)
        prop_volume = vtk.vtkVolumeProperty()
        prop_volume.ShadeOff()
        prop_volume.SetColor(transfer_func[0])
        prop_volume.SetScalarOpacity(transfer_func[1])
        prop_volume.SetGradientOpacity(transfer_func[2])
        prop_volume.SetInterpolationTypeToLinear()
        prop_volume.SetAmbient(0.4)
        prop_volume.SetDiffuse(0.6)
        prop_volume.SetSpecular(0.2)

        mapper = vtk.vtkSmartVolumeMapper()
        mapper.SetRequestedRenderMode(0)
        # mapper = vtk.vtkGPUVolumeRayCastMapper()
        mapper.SetInputData(self.reader)

        actor = vtk.vtkVolume()
        actor.SetMapper(mapper)

        actor.SetProperty(prop_volume)

        return actor
开发者ID:quentan,项目名称:Work_Test_4,代码行数:34,代码来源:medical_object.py


示例13: __init__

 def __init__(self, img, color):
     self.volume = vtk.vtkVolume()
     self.__color = color
     dataImporter = vtk.vtkImageImport()
     simg = np.ascontiguousarray(img, np.uint8)
     dataImporter.CopyImportVoidPointer(simg.data, len(simg.data))
     dataImporter.SetDataScalarTypeToUnsignedChar()
     dataImporter.SetNumberOfScalarComponents(1)
     dataImporter.SetDataExtent(0, simg.shape[2]-1, 0, simg.shape[1]-1, 0, simg.shape[0]-1)
     dataImporter.SetWholeExtent(0, simg.shape[2]-1, 0, simg.shape[1]-1, 0, simg.shape[0]-1)
     self.__smoother = vtk.vtkImageGaussianSmooth()
     self.__smoother.SetStandardDeviation(1, 1, 1)
     self.__smoother.SetInputConnection(dataImporter.GetOutputPort())
     volumeMapper = vtk.vtkSmartVolumeMapper()
     volumeMapper.SetInputConnection(self.__smoother.GetOutputPort())
     self.__volumeProperty = vtk.vtkVolumeProperty()
     self.__colorFunc = vtk.vtkColorTransferFunction()
     self.__alpha = vtk.vtkPiecewiseFunction()
     for i in range(256):
         self.__colorFunc.AddRGBPoint(i, i * color[0], i * color[1], i * color[2])
     self.__alpha.AddPoint(5, .01)
     self.__alpha.AddPoint(10, .03)
     self.__alpha.AddPoint(50, .1)
     self.__alpha.AddPoint(150, .2)
     self.__volumeProperty.SetColor(self.__colorFunc)
     self.__volumeProperty.SetScalarOpacity(self.__alpha)
     self.volume.SetMapper(volumeMapper)
     self.volume.SetProperty(self.__volumeProperty)
开发者ID:LeeKamentsky,项目名称:q3dstack,代码行数:28,代码来源:q3dstack.py


示例14: vtkKWVolumeMaterialPropertyWidgetEntryPoint

def vtkKWVolumeMaterialPropertyWidgetEntryPoint(parent, win):

    app = parent.GetApplication()
    
    # -----------------------------------------------------------------------
    
    # Create the volume property that will be modified by the widget
    
    volprop1 = vtkVolumeProperty()
    
    # -----------------------------------------------------------------------
    
    # Create the material widget
    # Assign our volume property to the editor
    
    volprop1_widget = vtkKWVolumeMaterialPropertyWidget()
    volprop1_widget.SetParent(parent)
    volprop1_widget.Create()
    volprop1_widget.SetBalloonHelpString(
        "A volume material property widget.")
    
    volprop1_widget.SetVolumeProperty(volprop1)
    
    app.Script(
        "pack %s -side top -anchor nw -expand n -padx 2 -pady 2",
        volprop1_widget.GetWidgetName())
    
    # -----------------------------------------------------------------------
    
    # Create another material widget, in popup mode
    # Assign our volume property to the editor
    
    volprop2_widget = vtkKWVolumeMaterialPropertyWidget()
    volprop2_widget.SetParent(parent)
    volprop2_widget.PopupModeOn()
    volprop2_widget.Create()
    volprop2_widget.SetMaterialColor(0.3, 0.4, 1.0)
    volprop2_widget.SetBalloonHelpString(
        "A volume material property widget, created in popup mode. Note that "
        "it edits the same volume property object as the first widget.")
    
    volprop2_widget.SetVolumeProperty(volprop1)
    
    app.Script(
        "pack %s -side top -anchor nw -expand n -padx 2 -pady 15",
        volprop2_widget.GetWidgetName())
    
    # Both editor are linked to the same vol prop, so they should notify
    # each other of any changes to refresh the preview nicely
    
    volprop2_widget.SetPropertyChangingCommand(volprop1_widget, "Update")
    volprop2_widget.SetPropertyChangedCommand(volprop1_widget, "Update")
    
    volprop1_widget.SetPropertyChangingCommand(volprop2_widget, "Update")
    volprop1_widget.SetPropertyChangedCommand(volprop2_widget, "Update")
    
    
    
    return "TypeVTK"
开发者ID:FNNDSC,项目名称:KWWidgets,代码行数:59,代码来源:vtkKWVolumeMaterialPropertyWidget.py


示例15: _createVolPropFromImageData

	def _createVolPropFromImageData(self, imageData):
		volProp = vtkVolumeProperty()
		if imageData is not None:
			color, opacityFunction = CreateRangeFunctions(imageData)
		else:
			color, opacityFunction = CreateEmptyFunctions()
		volProp.SetColor(color)
		volProp.SetScalarOpacity(opacityFunction)

		return volProp
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:10,代码来源:MultiVolumeVisualizationMIP.py


示例16: SetPresetVolumeProperty

    def SetPresetVolumeProperty(self):
        '''Create the transfer functions and set volume properties in a vtkVolumeProperty object'''

        # parse the xml file which is loaded in the same path as the vmtkimagevolumeviewer.py file at runtime
        presetElementTree = ET.parse(os.path.join(os.path.dirname(__file__), 'share', 'vmtkimagevolumeviewerpresets.xml'))
        presetRoot = presetElementTree.getroot()
        volProperties = presetRoot.findall('VolumeProperty[@name="' + self.Preset + '"]') # should return a list with only one element
        volPropertiesDict = volProperties[0].attrib
        
        def _chunks(l, n):
            """Yield successive n-sized chunks from l."""
            PY3 = sys.version_info[0] == 3
            if PY3:
                range_func = range
            else:
                range_func = xrange
            for i in range_func(0, len(l), n):
                yield l[i:i + n]

        # need to convert the space seperated string displaying values into a list of floats
        colorList = [float(i) for i in volPropertiesDict['colorTransfer'].split()]
        gradientOpacityList = [float(i) for i in volPropertiesDict['gradientOpacity'].split()]
        opacityList = [float(i) for i in volPropertiesDict['scalarOpacity'].split()]

        # create an array of arrays with each list split into subarrays of desired size
        colorMapList = _chunks(colorList, 4)
        gradientOpacityMapList = _chunks(gradientOpacityList, 2)
        opacityMapList = _chunks(opacityList, 2)

        # create vtk objects from the mapped lists (now arrays of arrays)
        self.ColorTransferFunction = self.BuildVTKColorTransferFunction(colorMapList)
        self.GradientOpacityTransferFunction = self.BuildVTKPiecewiseFunction(gradientOpacityMapList)
        self.OpacityTransferFunction = self.BuildVTKPiecewiseFunction(opacityMapList)

        # assign other properties from the element tree to variables with the appropriate type
        self.InterpolationType = int(volPropertiesDict['interpolation'])
        self.Shade = int(volPropertiesDict['shade'])
        self.SpecularPower = float(volPropertiesDict['specularPower'])
        self.Specular = float(volPropertiesDict['specular'])
        self.Diffuse = float(volPropertiesDict['diffuse'])
        self.Ambient = float(volPropertiesDict['ambient'])

        # set transfer function and lighting properties of the vtk volume object
        volumeProperty = vtk.vtkVolumeProperty()
        volumeProperty.SetScalarOpacity(self.OpacityTransferFunction)
        volumeProperty.SetGradientOpacity(self.GradientOpacityTransferFunction)
        volumeProperty.SetColor(self.ColorTransferFunction)
        volumeProperty.SetInterpolationType(self.InterpolationType)
        volumeProperty.SetShade(self.Shade)
        volumeProperty.SetSpecularPower(self.SpecularPower)
        volumeProperty.SetSpecular(self.Specular)
        volumeProperty.SetDiffuse(self.Diffuse)
        volumeProperty.SetAmbient(self.Ambient)

        self.VolumeProperty = volumeProperty
开发者ID:vmtk,项目名称:vmtk,代码行数:55,代码来源:vmtkimagevolumeviewer.py


示例17: originalObject

	def originalObject(self):
		volumeProperty = vtkVolumeProperty()
		volumeProperty.SetIndependentComponents(self.independentComponents)
		volumeProperty.SetInterpolationType(self.interpolationType)
		volumeProperty.SetShade(self.shade)
		volumeProperty.SetAmbient(self.ambient)
		volumeProperty.SetDiffuse(self.diffuse)
		volumeProperty.SetSpecular(self.specular)
		volumeProperty.SetSpecularPower(self.specularPower)
		volumeProperty.SetScalarOpacityUnitDistance(self.scalarOpacityUnitDistance)
		return volumeProperty
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:11,代码来源:vtkObjectWrapper.py


示例18: setVolumeVisualization

	def setVolumeVisualization(self, visualization):
		self.visualization = visualization
		if self.visualization is None:
			color, opacityFunction = CreateEmptyFunctions()
			self.fixedVolumeProperty = vtkVolumeProperty()
			self.fixedVolumeProperty.SetColor(color)
			self.fixedVolumeProperty.SetScalarOpacity(opacityFunction)
			self.movingVolumeProperty = vtkVolumeProperty()
			self.movingVolumeProperty.SetColor(color)
			self.movingVolumeProperty.SetScalarOpacity(opacityFunction)
		else:
			self.fixedVolumeProperty = self.visualization.fixedVolProp
			self.movingVolumeProperty = self.visualization.movingVolProp
			self.visualization.setMapper(self.mapper)
			if self.visualization.fixedVisualization:
				self._updateMapper(self.visualization.fixedVisualization, 1)
			if self.visualization.movingVisualization:
				self._updateMapper(self.visualization.movingVisualization, 2)

		self._updateVolumeProperties()
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:20,代码来源:MultiRenderWidget.py


示例19: _create_pipeline

    def _create_pipeline(self):
        # setup our pipeline

        self._volume_property = vtk.vtkVolumeProperty()
        self._volume_property.ShadeOn()

        self._volume_mapper = None

        self._volume = vtk.vtkVolume()
        self._volume.SetProperty(self._volume_property)
        self._volume.SetMapper(self._volume_mapper)
开发者ID:fvpolpeta,项目名称:devide,代码行数:11,代码来源:VolumeRender.py


示例20: __init__

	def __init__(self):
		super(VolumeVisualizationMIDA, self).__init__()

		self.visualizationType = VisualizationTypeMIDA
		self.mapper = None

		# TODO: add two sliders with which to threshold the data
		# Create property and attach the transfer function
		self.volProp = vtkVolumeProperty()
		self.volProp.SetIndependentComponents(True)
		self.volProp.SetInterpolationTypeToLinear()
开发者ID:berendkleinhaneveld,项目名称:Registrationshop,代码行数:11,代码来源:VolumeVisualizationMIDA.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python vtk.vtkVolumeRayCastCompositeFunction函数代码示例发布时间:2022-05-26
下一篇:
Python vtk.vtkVolume16Reader函数代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap