本文整理汇总了Python中vtk.util.misc.vtkGetDataRoot函数的典型用法代码示例。如果您正苦于以下问题:Python vtkGetDataRoot函数的具体用法?Python vtkGetDataRoot怎么用?Python vtkGetDataRoot使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了vtkGetDataRoot函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: vtkGetDataRoot
from vtk.util.misc import vtkGetDataRoot
# create planes
# Create the RenderWindow, Renderer
#
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer( ren )
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# create pipeline
#
pl3d = vtk.vtkMultiBlockPLOT3DReader()
pl3d.SetXYZFileName( vtkGetDataRoot() + '/Data/combxyz.bin' )
pl3d.SetQFileName( vtkGetDataRoot() + '/Data/combq.bin' )
pl3d.SetScalarFunctionNumber( 100 )
pl3d.SetVectorFunctionNumber( 202 )
pl3d.Update()
pl3d_output = pl3d.GetOutput().GetBlock(0)
outline = vtk.vtkStructuredGridOutlineFilter()
outline.SetInputData(pl3d_output)
outlineMapper = vtk.vtkPolyDataMapper()
outlineMapper.SetInputConnection(outline.GetOutputPort())
outlineActor = vtk.vtkActor()
outlineActor.SetMapper(outlineMapper)
开发者ID:0004c,项目名称:VTK,代码行数:30,代码来源:tubeComb.py
示例2: vtkGetDataRoot
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# create tensor ellipsoids
# Create the RenderWindow, Renderer and interactive renderer
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.SetMultiSamples(0)
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
#
# Create tensor ellipsoids
#
# generate tensors
ptLoad = vtk.vtkPointLoad()
ptLoad.SetLoadValue(100.0)
ptLoad.SetSampleDimensions(6,6,6)
ptLoad.ComputeEffectiveStressOn()
ptLoad.SetModelBounds(-10,10,-10,10,-10,10)
# extract plane of data
plane = vtk.vtkImageDataGeometryFilter()
plane.SetInputConnection(ptLoad.GetOutputPort())
plane.SetExtent(2,2,0,99,0,99)
# Generate ellipsoids
sphere = vtk.vtkSphereSource()
sphere.SetThetaResolution(8)
开发者ID:0004c,项目名称:VTK,代码行数:31,代码来源:TenEllip.py
示例3: vtkGetDataRoot
See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notice for more information.
=========================================================================
'''
import math
import vtk
from vtk.util.misc import vtkGetDataRoot
fname = vtkGetDataRoot() + '/Data/uGridEx.vtk'
def DumpQualityStats(iq, arrayname):
an = iq.GetOutput().GetFieldData().GetArray(arrayname)
cardinality = an.GetComponent(0, 4)
range = list()
range.append(an.GetComponent(0, 0))
range.append(an.GetComponent(0, 2))
average = an.GetComponent(0, 1)
stdDev = math.sqrt(math.fabs(an.GetComponent(0, 3)))
outStr = '%s%g%s%g%s%g\n%s%g%s%g' % (
' cardinality: ', cardinality,
' , range: ', range[0], ' - ', range[1],
' average: ', average, ' , standard deviation: ', stdDev)
return outStr
开发者ID:0004c,项目名称:VTK,代码行数:31,代码来源:MeshQuality.py
示例4: test
def test(self):
dataRoot = vtkGetDataRoot()
reader = vtk.vtkXMLImageDataReader()
reader.SetFileName("" + str(dataRoot) + "/Data/vase_4comp.vti")
volume = vtk.vtkVolume()
#mapper = vtk.vtkFixedPointVolumeRayCastMapper()
mapper = vtk.vtkGPUVolumeRayCastMapper()
mapper.SetSampleDistance(0.1)
mapper.SetAutoAdjustSampleDistances(0)
ren = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
iRen = vtk.vtkRenderWindowInteractor()
# Set connections
mapper.SetInputConnection(reader.GetOutputPort());
volume.SetMapper(mapper)
ren.AddViewProp(volume)
renWin.AddRenderer(ren)
iRen.SetRenderWindow(renWin)
# Define opacity transfer function and color functions
opacityFunc1 = vtk.vtkPiecewiseFunction()
opacityFunc1.AddPoint(0.0, 0.0);
opacityFunc1.AddPoint(60.0, 0.1);
opacityFunc1.AddPoint(255.0, 0.0);
opacityFunc2 = vtk.vtkPiecewiseFunction()
opacityFunc2.AddPoint(0.0, 0.0);
opacityFunc2.AddPoint(60.0, 0.0);
opacityFunc2.AddPoint(120.0, 0.1);
opacityFunc1.AddPoint(255.0, 0.0);
opacityFunc3 = vtk.vtkPiecewiseFunction()
opacityFunc3.AddPoint(0.0, 0.0);
opacityFunc3.AddPoint(120.0, 0.0);
opacityFunc3.AddPoint(180.0, 0.1);
opacityFunc3.AddPoint(255.0, 0.0);
opacityFunc4 = vtk.vtkPiecewiseFunction()
opacityFunc4.AddPoint(0.0, 0.0);
opacityFunc4.AddPoint(180.0, 0.0);
opacityFunc4.AddPoint(255.0, 0.1);
# Color transfer functions
color1 = vtk.vtkColorTransferFunction()
color1.AddRGBPoint(0.0, 1.0, 0.0, 0.0);
color1.AddRGBPoint(60.0, 1.0, 0.0, 0.0);
color2 = vtk.vtkColorTransferFunction()
color2.AddRGBPoint(60.0, 0.0, 0.0, 1.0);
color2.AddRGBPoint(120.0, 0.0, 0.0, 1.0);
color3 = vtk.vtkColorTransferFunction()
color3.AddRGBPoint(120.0, 0.0, 1.0, 0.0);
color3.AddRGBPoint(180.0, 0.0, 1.0, 0.0);
color4 = vtk.vtkColorTransferFunction()
color4.AddRGBPoint(180.0, 0.0, 0.0, 0.0);
color4.AddRGBPoint(239.0, 0.0, 0.0, 0.0);
# Now set the opacity and the color
volumeProperty = volume.GetProperty()
volumeProperty.SetIndependentComponents(1)
volumeProperty.SetScalarOpacity(0, opacityFunc1)
volumeProperty.SetScalarOpacity(1, opacityFunc2)
volumeProperty.SetScalarOpacity(2, opacityFunc3)
volumeProperty.SetScalarOpacity(3, opacityFunc4)
volumeProperty.SetColor(0, color1)
volumeProperty.SetColor(1, color2)
volumeProperty.SetColor(2, color3)
volumeProperty.SetColor(3, color4)
iRen.Initialize();
ren.SetBackground(0.1,0.4,0.2)
ren.ResetCamera()
renWin.Render()
img_file = "TestGPURayCastIndependentComponent.png"
vtk.test.Testing.compareImage(
iRen.GetRenderWindow(), vtk.test.Testing.getAbsImagePath(img_file), threshold=10)
vtk.test.Testing.interact()
开发者ID:0004c,项目名称:VTK,代码行数:82,代码来源:TestGPURayCastIndependentComponent.py
示例5: range
#!/usr/bin/env python
import sys
for i in range(0, len(sys.argv)):
if sys.argv[i] == '-A' and i < len(sys.argv)-1:
sys.path = sys.path + [sys.argv[i+1]]
import vtk
from vtk.util.misc import vtkGetDataRoot
filename = vtkGetDataRoot() + '/Data/tetraMesh.vtk'
reader = vtk.vtkUnstructuredGridReader()
reader.SetFileName(filename)
a = vtk.vtkMeshQuality()
a.SetInputConnection(reader.GetOutputPort())
a.VolumeOn()
a.RatioOn()
a.Update()
mesh = a.GetOutput().GetFieldData().GetScalars()
for i in range(mesh.GetNumberOfTuples()):
print mesh.GetTuple2(i)
sys.exit(0)
开发者ID:unidevop,项目名称:sjtu-project-pipe,代码行数:29,代码来源:meshQuality.py
示例6: vtkGetDataRoot
import vtk
from vtk.util.misc import vtkGetDataRoot
ren1 = vtk.vtkRenderer()
ren2 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
renWin.AddRenderer(ren2)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
xmlReader = vtk.vtkXMLUnstructuredGridReader()
xmlReader.SetFileName( vtkGetDataRoot() + '/Data/cuttertest.vtu' )
plane = vtk.vtkPlane()
plane.SetOrigin( 50,0,405 )
plane.SetNormal( 0,0,1 )
# pipeline for cutter producing triangles
triCutter = vtk.vtkCutter()
triCutter.SetInputConnection( xmlReader.GetOutputPort() )
triCutter.SetCutFunction( plane )
triMapper = vtk.vtkPolyDataMapper()
triMapper.SetInputConnection( triCutter.GetOutputPort() )
triMapper.ScalarVisibilityOff()
triActor = vtk.vtkActor()
triActor.SetMapper( triMapper )
triActor.GetProperty().SetColor( 1,0,0 )
triActor.GetProperty().EdgeVisibilityOn()
开发者ID:ALouis38,项目名称:VTK,代码行数:31,代码来源:cutter.py
示例7: str
diffuseColor = [0.4, 0.7, 0.6]
program.SetUniform3f("diffuseColorUniform", diffuseColor)
renWin = vtk.vtkRenderWindow()
renWin.SetSize(400, 400)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
ren = vtk.vtkRenderer()
ren.SetBackground(0.0, 0.0, 0.0)
ren.GradientBackgroundOn()
renWin.AddRenderer(ren)
actor = vtk.vtkActor()
ren.AddActor(actor)
reader = vtk.vtkPLYReader()
reader.SetFileName("" + str(vtkGetDataRoot()) + "/Data/dragon.ply")
norms = vtk.vtkTriangleMeshPointNormals()
norms.SetInputConnection(reader.GetOutputPort())
mapper = vtk.vtkOpenGLPolyDataMapper()
mapper.SetInputConnection(norms.GetOutputPort())
actor.SetMapper(mapper)
actor.GetProperty().SetAmbientColor(0.2, 0.2, 1.0)
actor.GetProperty().SetDiffuseColor(1.0, 0.65, 0.7)
actor.GetProperty().SetSpecularColor(1.0, 1.0, 1.0)
actor.GetProperty().SetSpecular(0.5)
actor.GetProperty().SetDiffuse(0.7)
actor.GetProperty().SetAmbient(0.5)
actor.GetProperty().SetSpecularPower(20.0)
actor.GetProperty().SetOpacity(1.0)
sp = actor.GetShaderProperty()
开发者ID:Kitware,项目名称:VTK,代码行数:31,代码来源:TestUserShader2.py
示例8: getVTKDataRoot
def getVTKDataRoot():
VTK_DATA_ROOT = os.environ( 'VTK_DATA_ROOT', vtkGetDataRoot() )
return VTK_DATA_ROOT
开发者ID:imclab,项目名称:vistrails,代码行数:3,代码来源:DemoDataModule.py
示例9:
#!/usr/bin/env python
import os
import vtk
from vtk.util.misc import vtkGetDataRoot
r = vtk.vtkPolyDataReader()
r.AddFileName(vtkGetDataRoot() + "/Data/track1.binary.vtk")
r.AddFileName(vtkGetDataRoot() + "/Data/track2.binary.vtk")
r.AddFileName(vtkGetDataRoot() + "/Data/track3.binary.vtk")
r.UpdateInformation()
assert(r.GetOutputInformation(0).Length(vtk.vtkStreamingDemandDrivenPipeline.TIME_STEPS()) == 3)
r.UpdateTimeStep(1)
rng = r.GetOutput().GetPointData().GetScalars().GetRange(0)
assert(abs(rng[0] - 0.4) < 0.0001)
r.UpdateTimeStep(2)
rng = r.GetOutput().GetPointData().GetScalars().GetRange(0)
assert(abs(rng[1] + 5.8 ) < 0.0001)
开发者ID:ElsevierSoftwareX,项目名称:SOFTX-D-15-00004,代码行数:20,代码来源:TestFileSeries.py
注:本文中的vtk.util.misc.vtkGetDataRoot函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论