Commit d7a8e57f authored by Nikhil Shetty's avatar Nikhil Shetty

Using add_test_python macro for FiltersCore.

This commit does the following things.

- Fixes the add_test_python
- Adds python tests
- Brings in auto generated python tests (tcl to python)

Note: All test may not pass. More work is needed to make correct them.

Change-Id: I3b5bfecc8eb99d350ccea7fb3ceb1c6946620287
parent 12f00a0a
if(VTK_PYTHON_EXE)
foreach(tfile
TestCompositeCutter
)
if(VTK_DATA_ROOT)
add_test(NAME ${vtk-module}Python-${tfile}
COMMAND ${VTK_PYTHON_EXE}
${CMAKE_CURRENT_SOURCE_DIR}/${tfile}.py -D ${VTK_DATA_ROOT})
endif()
endforeach()
endif()
add_test_python(CellDataToPointData.py Graphics)
add_test_python(Delaunay2D.py Graphics)
add_test_python(Delaunay2DAlpha.py Graphics)
add_test_python(Delaunay2DTransform.py Graphics)
add_test_python(Delaunay3D.py Graphics)
add_test_python(QuadricDecimation.py Graphics)
add_test_python(StreamPolyData.py Graphics)
add_test_python(TestCompositeCutter.py)
add_test_python(TestGridSynchronizedTemplates3D.py Graphics)
add_test_python(TestMarchingSquares.py Graphics)
add_test_python(TestRectilinearSynchronizedTemplates.py Graphics)
add_test_python(TestSynchronizedTemplates2D.py Graphics)
add_test_python(TestSynchronizedTemplates3D.py Graphics)
add_test_python(TestTensorGlyph.py Graphics)
add_test_python(TestTextureGlyph.py Graphics)
add_test_python(TestTriangleFilter.py Graphics)
add_test_python(capCow.py Graphics)
add_test_python(capSphere.py Graphics)
add_test_python(clipArt.py Graphics)
add_test_python(combStreamers.py Graphics)
add_test_python(combStreamers2.py Graphics)
add_test_python(constrainedDelaunay.py Graphics)
add_test_python(contourCells.py Graphics)
add_test_python(contourQuadraticCells.py Graphics)
add_test_python(createBFont.py Graphics)
add_test_python(cutLoop.py Graphics)
add_test_python(dispPlot.py Graphics)
add_test_python(fieldToPolyData.py Graphics)
add_test_python(fieldToRGrid.py Graphics)
add_test_python(fieldToSGrid.py Graphics)
add_test_python(fieldToUGrid.py Graphics)
add_test_python(financialField.py Graphics)
add_test_python(glyphComb.py Graphics)
add_test_python(hull.py Graphics)
add_test_python(mergeFilter.py Graphics)
add_test_python(multipleComponentContour.py Graphics)
add_test_python(multipleIso.py Graphics)
add_test_python(polyConn.py Graphics)
add_test_python(probeComb.py Graphics)
add_test_python(reverseNormals.py Graphics)
add_test_python(smoothMeshOnMesh.py Graphics)
add_test_python(streamComb.py Graphics)
add_test_python(streamSurface.py Graphics)
add_test_python(streamSurface2.py Graphics)
add_test_python(stripF.py Graphics)
add_test_python(teapotHulls.py Graphics)
add_test_python(tubeComb.py Graphics)
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# cell scalars to point scalars
# get the interactor ui
# Create the RenderWindow, Renderer and RenderWindowInteractor
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# create a 2*2 cell/3*3 pt structuredgrid
points = vtk.vtkPoints()
points.InsertNextPoint(-1,1,0)
points.InsertNextPoint(0,1,0)
points.InsertNextPoint(1,1,0)
points.InsertNextPoint(-1,0,0)
points.InsertNextPoint(0,0,0)
points.InsertNextPoint(1,0,0)
points.InsertNextPoint(-1,-1,0)
points.InsertNextPoint(0,-1,0)
points.InsertNextPoint(1,-1,0)
faceColors = vtk.vtkFloatArray()
faceColors.InsertNextValue(0)
faceColors.InsertNextValue(1)
faceColors.InsertNextValue(1)
faceColors.InsertNextValue(2)
sgrid = vtk.vtkStructuredGrid()
sgrid.SetDimensions(3,3,1)
sgrid.SetPoints(points)
sgrid.GetCellData().SetScalars(faceColors)
Cell2Point = vtk.vtkCellDataToPointData()
Cell2Point.SetInputData(sgrid)
Cell2Point.PassCellDataOn()
Cell2Point.Update()
mapper = vtk.vtkDataSetMapper()
mapper.SetInputData(Cell2Point.GetStructuredGridOutput())
mapper.SetScalarModeToUsePointData()
mapper.SetScalarRange(0,2)
actor = vtk.vtkActor()
actor.SetMapper(mapper)
# Add the actors to the renderer, set the background and size
ren1.AddActor(actor)
ren1.SetBackground(0.1,0.2,0.4)
renWin.SetSize(256,256)
# render the image
iren.Initialize()
# --- end of script --
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Create the RenderWindow, Renderer and both Actors
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.SetMultiSamples(0)
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# create some points
#
math = vtk.vtkMath()
points = vtk.vtkPoints()
i = 0
while i < 1000:
points.InsertPoint(i,math.Random(0,1),math.Random(0,1),0.0)
i = i + 1
profile = vtk.vtkPolyData()
profile.SetPoints(points)
# triangulate them
#
del1 = vtk.vtkDelaunay2D()
del1.SetInputData(profile)
del1.BoundingTriangulationOn()
del1.SetTolerance(0.001)
del1.SetAlpha(0.0)
shrink = vtk.vtkShrinkPolyData()
shrink.SetInputConnection(del1.GetOutputPort())
map = vtk.vtkPolyDataMapper()
map.SetInputConnection(shrink.GetOutputPort())
triangulation = vtk.vtkActor()
triangulation.SetMapper(map)
triangulation.GetProperty().SetColor(1,0,0)
# Add the actors to the renderer, set the background and size
#
ren1.AddActor(triangulation)
ren1.SetBackground(1,1,1)
renWin.SetSize(500,500)
renWin.Render()
cam1 = ren1.GetActiveCamera()
cam1.Zoom(1.5)
renWin.Render()
# prevent the tk window from showing up then start the event loop
# --- end of script --
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Create the RenderWindow, Renderer and both Actors
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# create some points
#
math = vtk.vtkMath()
points = vtk.vtkPoints()
i = 0
while i < 100:
points.InsertPoint(i,math.Random(0,1),math.Random(0,1),0.0)
i = i + 1
profile = vtk.vtkPolyData()
profile.SetPoints(points)
# triangulate them
#
del1 = vtk.vtkDelaunay2D()
del1.SetInputData(profile)
del1.SetTolerance(0.001)
del1.SetAlpha(0.1)
shrink = vtk.vtkShrinkPolyData()
shrink.SetInputConnection(del1.GetOutputPort())
map = vtk.vtkPolyDataMapper()
map.SetInputConnection(shrink.GetOutputPort())
triangulation = vtk.vtkActor()
triangulation.SetMapper(map)
triangulation.GetProperty().SetColor(1,0,0)
# Add the actors to the renderer, set the background and size
#
ren1.AddActor(triangulation)
ren1.SetBackground(1,1,1)
renWin.SetSize(300,300)
renWin.Render()
cam1 = ren1.GetActiveCamera()
cam1.Zoom(1.5)
renWin.Render()
# prevent the tk window from showing up then start the event loop
# --- end of script --
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Create the RenderWindow, Renderer and both Actors
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# create some points on a sphere such that the data is not in the form
# of z = f(x,y)
#
math1 = vtk.vtkMath()
points = vtk.vtkPoints()
vectors = vtk.vtkFloatArray()
vectors.SetNumberOfComponents(3)
i = 0
while i < 100:
theta = math1.Random(0.31415,2.8)
phi = math1.Random(0.31415,2.8)
points.InsertPoint(i,expr.expr(globals(), locals(),["cos","(","theta",")*","sin","(","phi",")"]),expr.expr(globals(), locals(),["sin","(","theta",")*","sin","(","phi",")"]),expr.expr(globals(), locals(),["cos","(","phi",")"]))
vectors.InsertTuple3(i,expr.expr(globals(), locals(),["cos","(","theta",")*","sin","(","phi",")"]),expr.expr(globals(), locals(),["sin","(","theta",")*","sin","(","phi",")"]),expr.expr(globals(), locals(),["cos","(","phi",")"]))
i = i + 1
profile = vtk.vtkPolyData()
profile.SetPoints(points)
profile.GetPointData().SetVectors(vectors)
# build a transform that rotates this data into z = f(x,y)
#
transform = vtk.vtkTransform()
transform.RotateX(90)
# triangulate the data using the specified transform
#
del1 = vtk.vtkDelaunay2D()
del1.SetInputData(profile)
del1.SetTransform(transform)
del1.BoundingTriangulationOff()
del1.SetTolerance(0.001)
del1.SetAlpha(0.0)
shrink = vtk.vtkShrinkPolyData()
shrink.SetInputConnection(del1.GetOutputPort())
map = vtk.vtkPolyDataMapper()
map.SetInputConnection(shrink.GetOutputPort())
triangulation = vtk.vtkActor()
triangulation.SetMapper(map)
triangulation.GetProperty().SetColor(1,0,0)
triangulation.GetProperty().BackfaceCullingOn()
# Add the actors to the renderer, set the background and size
#
ren1.AddActor(triangulation)
ren1.SetBackground(1,1,1)
renWin.SetSize(300,300)
renWin.Render()
cam1 = ren1.GetActiveCamera()
cam1.Zoom(1.5)
cam1.Azimuth(90)
cam1.Elevation(30)
cam1.Azimuth(-60)
# render the image
#
renWin.Render()
# prevent the tk window from showing up then start the event loop
# --- end of script --
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# create some random points in the unit cube centered at (.5,.5,.5)
#
math = vtk.vtkMath()
points = vtk.vtkPoints()
i = 0
while i < 25:
points.InsertPoint(i,math.Random(0,1),math.Random(0,1),math.Random(0,1))
i = i + 1
profile = vtk.vtkPolyData()
profile.SetPoints(points)
# triangulate them
#
del1 = vtk.vtkDelaunay3D()
del1.SetInputData(profile)
del1.BoundingTriangulationOn()
del1.SetTolerance(0.01)
del1.SetAlpha(0.2)
del1.BoundingTriangulationOff()
shrink = vtk.vtkShrinkFilter()
shrink.SetInputConnection(del1.GetOutputPort())
shrink.SetShrinkFactor(0.9)
map = vtk.vtkDataSetMapper()
map.SetInputConnection(shrink.GetOutputPort())
triangulation = vtk.vtkActor()
triangulation.SetMapper(map)
triangulation.GetProperty().SetColor(1,0,0)
# Create graphics stuff
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# Add the actors to the renderer, set the background and size
#
ren1.AddActor(triangulation)
ren1.SetBackground(1,1,1)
renWin.SetSize(250,250)
renWin.Render()
cam1 = ren1.GetActiveCamera()
cam1.Zoom(1.5)
# render the image
#
renWin.Render()
# prevent the tk window from showing up then start the event loop
# --- end of script --
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# pipeline stuff
#
pl3d = vtk.vtkMultiBlockPLOT3DReader()
pl3d.SetXYZFileName("" + str(VTK_DATA_ROOT) + "/Data/combxyz.bin")
pl3d.SetQFileName("" + str(VTK_DATA_ROOT) + "/Data/combq.bin")
pl3d.SetScalarFunctionNumber(100)
pl3d.SetVectorFunctionNumber(202)
pl3d.Update()
pl3d_output = pl3d.GetOutput().GetBlock(0)
gf = vtk.vtkGeometryFilter()
gf.SetInputData(pl3d_output)
tf = vtk.vtkTriangleFilter()
tf.SetInputConnection(gf.GetOutputPort())
gMapper = vtk.vtkPolyDataMapper()
gMapper.SetInputConnection(gf.GetOutputPort())
gMapper.SetScalarRange(pl3d_output.GetScalarRange())
gActor = vtk.vtkActor()
gActor.SetMapper(gMapper)
# Don't look at attributes
mesh = vtk.vtkQuadricDecimation()
mesh.SetInputConnection(tf.GetOutputPort())
mesh.SetTargetReduction(.90)
mesh.AttributeErrorMetricOn()
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(mesh.GetOutputPort())
actor = vtk.vtkActor()
actor.SetMapper(mapper)
# This time worry about attributes
mesh2 = vtk.vtkQuadricDecimation()
mesh2.SetInputConnection(tf.GetOutputPort())
mesh2.SetTargetReduction(.90)
mesh2.AttributeErrorMetricOff()
mapper2 = vtk.vtkPolyDataMapper()
mapper2.SetInputConnection(mesh2.GetOutputPort())
actor2 = vtk.vtkActor()
actor2.SetMapper(mapper2)
actor2.AddPosition(0,12,0)
# Create rendering instances
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# Set up the camera parameters
#
camera = vtk.vtkCamera()
camera.SetPosition(19.34,6.128,-11.96)
camera.SetFocalPoint(8.25451,6.0,29.77)
camera.SetViewUp(0.9664,0.00605,0.256883)
camera.SetViewAngle(30)
camera.SetClippingRange(26,64)
ren1.SetActiveCamera(camera)
# Add the actors to the renderer, set the background and size
#
ren1.AddActor(actor)
ren1.AddActor(actor2)
ren1.SetBackground(1,1,1)
renWin.SetSize(400,400)
iren.Initialize()
# render the image
#
# prevent the tk window from showing up then start the event loop
threshold = 50
# --- end of script --
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
NUMBER_OF_PIECES = 5
# Generate implicit model of a sphere
#
# Create renderer stuff
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# create pipeline that handles ghost cells
sphere = vtk.vtkSphereSource()
sphere.SetRadius(3)
sphere.SetPhiResolution(100)
sphere.SetThetaResolution(150)
# sphere AddObserver StartEvent {tk_messageBox -message "Executing with piece [[sphere GetOutput] GetUpdatePiece]"}
# Just playing with an alternative that is not currently used.
def NotUsed (__vtk__temp0=0,__vtk__temp1=0):
# This filter actually spoils the example because it asks for the whole input.
# The only reason it is here is because sphere complains it cannot generate ghost cells.
vtkExtractPolyDataPiece.piece()
piece.SetInputConnection(sphere.GetOutputPort())
# purposely put seams in here.
piece.CreateGhostCellsOff()
# purposely put seams in here.
pdn = vtk.vtkPolyDataNormals()
pdn.SetInputConnection(piece.GetOutputPort())
# Just playing with an alternative that is not currently used.
deci = vtk.vtkDecimatePro()
deci.SetInputConnection(sphere.GetOutputPort())
# this did not remove seams as I thought it would
deci.BoundaryVertexDeletionOff()
#deci PreserveTopologyOn
# Since quadric Clustering does not handle borders properly yet,
# the pieces will have dramatic "eams"
q = vtk.vtkQuadricClustering()
q.SetInputConnection(sphere.GetOutputPort())
q.SetNumberOfXDivisions(5)
q.SetNumberOfYDivisions(5)
q.SetNumberOfZDivisions(10)
q.UseInputPointsOn()
streamer = vtk.vtkPolyDataStreamer()
#streamer SetInputConnection [deci GetOutputPort]
streamer.SetInputConnection(q.GetOutputPort())
#streamer SetInputConnection [pdn GetOutputPort]
streamer.SetNumberOfStreamDivisions(NUMBER_OF_PIECES)
mapper = vtk.vtkPolyDataMapper()
mapper.SetInputConnection(streamer.GetOutputPort())
mapper.ScalarVisibilityOff()
mapper.SetPiece(0)
mapper.SetNumberOfPieces(2)
mapper.ImmediateModeRenderingOn()
actor = vtk.vtkActor()
actor.SetMapper(mapper)
actor.GetProperty().SetColor(english_red)
# Add the actors to the renderer, set the background and size
#
ren1.GetActiveCamera().SetPosition(5,5,10)
ren1.GetActiveCamera().SetFocalPoint(0,0,0)
ren1.AddActor(actor)
ren1.SetBackground(1,1,1)
renWin.SetSize(300,300)
iren.Initialize()
# render the image
#
# prevent the tk window from showing up then start the event loop
# --- end of script --
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# cut data
pl3d = vtk.vtkMultiBlockPLOT3DReader()
pl3d.SetXYZFileName("" + str(VTK_DATA_ROOT) + "/Data/combxyz.bin")
pl3d.SetQFileName("" + str(VTK_DATA_ROOT) + "/Data/combq.bin")
pl3d.SetScalarFunctionNumber(100)
pl3d.SetVectorFunctionNumber(202)
pl3d.Update()
pl3d_output = pl3d.GetOutput().GetBlock(0)
range = pl3d_output.GetPointData().GetScalars().GetRange()
min = lindex(range,0)
max = lindex(range,1)
value = expr.expr(globals(), locals(),["(","min","+","max",")","/","2.0"])
#vtkGridSynchronizedTemplates3D cf
cf = vtk.vtkContourFilter()
cf.SetInputData(pl3d_output)
cf.SetValue(0,value)
#cf ComputeNormalsOff
cfMapper = vtk.vtkPolyDataMapper()
cfMapper.ImmediateModeRenderingOn()
cfMapper.SetInputConnection(cf.GetOutputPort())
cfMapper.SetScalarRange(pl3d_output.GetPointData().GetScalars().GetRange())
cfActor = vtk.vtkActor()
cfActor.SetMapper(cfMapper)
#outline
outline = vtk.vtkStructuredGridOutlineFilter()
outline.SetInputData(pl3d_output)
outlineMapper = vtk.vtkPolyDataMapper()
outlineMapper.SetInputConnection(outline.GetOutputPort())
outlineActor = vtk.vtkActor()
outlineActor.SetMapper(outlineMapper)
outlineActor.GetProperty().SetColor(0,0,0)
## Graphics stuff
# Create the RenderWindow, Renderer and both Actors
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.SetMultiSamples(0)
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# Add the actors to the renderer, set the background and size
#
ren1.AddActor(outlineActor)
ren1.AddActor(cfActor)
ren1.SetBackground(1,1,1)
renWin.SetSize(400,400)
cam1 = ren1.GetActiveCamera()
cam1.SetClippingRange(3.95297,50)
cam1.SetFocalPoint(9.71821,0.458166,29.3999)
cam1.SetPosition(2.7439,-37.3196,38.7167)
cam1.SetViewUp(-0.16123,0.264271,0.950876)
iren.Initialize()
# render the image
#
# loop over surfaces
i = 0
while i < 17:
cf.SetValue(0,expr.expr(globals(), locals(),["min","+","(","i","/","16.0",")*(","max","-","min",")"]))
renWin.Render()
i = i + 1
cf.SetValue(0,expr.expr(globals(), locals(),["min","+","(","0.2",")*(","max","-","min",")"]))
renWin.Render()
# prevent the tk window from showing up then start the event loop
# --- end of script --
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Create the RenderWindow, Renderer and both Actors
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
# create pipeline
#
v16 = vtk.vtkVolume16Reader()
v16.SetDataDimensions(64,64)
v16.GetOutput().SetOrigin(0.0,0.0,0.0)
v16.SetDataByteOrderToLittleEndian()
v16.SetFilePrefix("" + str(VTK_DATA_ROOT) + "/Data/headsq/quarter")
v16.SetImageRange(1,93)
v16.SetDataSpacing(3.2,3.2,1.5)
v16.Update()
myLocator = vtk.vtkMergePoints()
isoXY = vtk.vtkMarchingSquares()
isoXY.SetInputConnection(v16.GetOutputPort())
isoXY.GenerateValues(2,600,1200)
isoXY.SetImageRange(0,32,32,63,45,45)
isoXY.SetLocator(myLocator)
isoXYMapper = vtk.vtkPolyDataMapper()
isoXYMapper.SetInputConnection(isoXY.GetOutputPort())
isoXYMapper.SetScalarRange(600,1200)
isoXYActor = vtk.vtkActor()
isoXYActor.SetMapper(isoXYMapper)
isoYZ = vtk.vtkMarchingSquares()
isoYZ.SetInputConnection(v16.GetOutputPort())
isoYZ.GenerateValues(2,600,1200)
isoYZ.SetImageRange(32,32,32,63,46,92)
isoYZMapper = vtk.vtkPolyDataMapper()
isoYZMapper.SetInputConnection(isoYZ.GetOutputPort())
isoYZMapper.SetScalarRange(600,1200)
isoYZActor = vtk.vtkActor()
isoYZActor.SetMapper(isoYZMapper)
isoXZ = vtk.vtkMarchingSquares()
isoXZ.SetInputConnection(v16.GetOutputPort())
isoXZ.GenerateValues(2,600,1200)
isoXZ.SetImageRange(0,32,32,32,0,46)
isoXZMapper = vtk.vtkPolyDataMapper()
isoXZMapper.SetInputConnection(isoXZ.GetOutputPort())
isoXZMapper.SetScalarRange(600,1200)
isoXZActor = vtk.vtkActor()
isoXZActor.SetMapper(isoXZMapper)
outline = vtk.vtkOutlineFilter()
outline.SetInputConnection(v16.GetOutputPort())
outlineMapper = vtk.vtkPolyDataMapper()
outlineMapper.SetInputConnection(outline.GetOutputPort())
outlineActor = vtk.vtkActor()
outlineActor.SetMapper(outlineMapper)
outlineActor.VisibilityOff()
# Add the actors to the renderer, set the background and size
#
ren1.AddActor(outlineActor)
ren1.AddActor(isoXYActor)
ren1.AddActor(isoYZActor)
ren1.AddActor(isoXZActor)
ren1.SetBackground(0.9,.9,.9)
renWin.SetSize(200,200)
ren1.GetActiveCamera().SetPosition(324.368,284.266,-19.3293)
ren1.GetActiveCamera().SetFocalPoint(73.5683,120.903,70.7309)
ren1.GetActiveCamera().SetViewAngle(30)
ren1.GetActiveCamera().SetViewUp(-0.304692,-0.0563843,-0.950781)
iren.Initialize()
# render the image
#
# prevent the tk window from showing up then start the event loop
# --- end of script --
#!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# create pipeline - rectilinear grid
#
rgridReader = vtk.vtkRectilinearGridReader()
rgridReader.SetFileName("" + str(VTK_DATA_ROOT) + "/Data/RectGrid2.vtk")
rgridReader.Update()
contour = vtk.vtkRectilinearSynchronizedTemplates()
contour.SetInputConnection(rgridReader.GetOutputPort())
contour.SetValue(0,1)
contour.ComputeScalarsOff()
contour.ComputeNormalsOn()
contour.ComputeGradientsOn()
cMapper = vtk.vtkPolyDataMapper()
cMapper.SetInputConnection(contour.GetOutputPort())
cActor = vtk.vtkActor()
cActor.SetMapper(cMapper)
# Create the RenderWindow, Renderer and both Actors
#
ren1 = vtk.vtkRenderer()
renWin = vtk.vtkRenderWindow()
renWin.AddRenderer(ren1)
renWin.SetSize(200,200)
iren = vtk.vtkRenderWindowInteractor()
iren.SetRenderWindow(renWin)
ren1.AddActor(cActor)
iren.Initialize()
# render the image
#
# prevent the tk window from showing up then start the event loop