Commit 0061b2d5 authored by David Gobbi's avatar David Gobbi
Browse files

BUG: Update python vtk module for VTK6-style input.

Change-Id: Ifc76340e581c5cf07b6c40b7ecd77f292b96962b
parent 24ea32d7
......@@ -521,7 +521,7 @@ def main():
cone = vtk.vtkConeSource()
cone.SetResolution(80)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
coneMapper.SetInputConnection(cone.GetOutputPort())
#coneActor = vtk.vtkLODActor()
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
......
......@@ -280,7 +280,7 @@ def main():
cone = vtk.vtkConeSource()
cone.SetResolution(80)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
coneMapper.SetInputConnection(cone.GetOutputPort())
#coneActor = vtk.vtkLODActor()
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
......
......@@ -505,7 +505,7 @@ def main():
cone = vtk.vtkConeSource()
cone.SetResolution(80)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
coneMapper.SetInputConnection(cone.GetOutputPort())
#coneActor = vtk.vtkLODActor()
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
......
......@@ -273,7 +273,7 @@ def main():
cone = vtk.vtkConeSource()
cone.SetResolution(80)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
coneMapper.SetInputConnection(cone.GetOutputPort())
#coneActor = vtk.vtkLODActor()
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
......
......@@ -457,7 +457,7 @@ def QVTKRenderWidgetConeExample():
cone.SetResolution(8)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
coneMapper.SetInputConnection(cone.GetOutputPort())
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
......
......@@ -330,7 +330,7 @@ def QVTKRenderWidgetConeExample():
cone.SetResolution(8)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
coneMapper.SetInputConnection(cone.GetOutputPort())
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
......
......@@ -368,7 +368,7 @@ def QVTKRenderWidgetConeExample():
cone.SetResolution(8)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
coneMapper.SetInputConnection(cone.GetOutputPort())
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
......
......@@ -280,14 +280,12 @@ class vtkTkImageViewerWidget(Tkinter.Widget):
# y is flipped upside down
y = self.winfo_height() - y
# make sure point is in the whole extent of the image.
(xMin,xMax,yMin,yMax,zMin,zMax) = input.GetWholeExtent()
# make sure point is in the extent of the image.
(xMin,xMax,yMin,yMax,zMin,zMax) = input.GetExtent()
if (x < xMin or x > xMax or y < yMin or \
y > yMax or z < zMin or z > zMax):
return
input.SetUpdateExtent(x,x,y,y,z,z)
input.Update()
numComps = input.GetNumberOfScalarComponents()
text = ""
for i in xrange(numComps):
......@@ -348,7 +346,7 @@ if __name__ == "__main__":
widget = vtkTkImageViewerWidget(frame,width=512,height=512,double=1)
viewer = widget.GetImageViewer()
viewer.SetInput(canvas.GetOutput())
viewer.SetInputConnection(canvas.GetOutputPort())
viewer.SetColorWindow(256)
viewer.SetColorLevel(127.5)
......
......@@ -450,7 +450,7 @@ def vtkRenderWidgetConeExample():
cone.SetResolution(8)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
coneMapper.SetInputConnection(cone.GetOutputPort())
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
......
......@@ -377,7 +377,7 @@ def vtkRenderWindowInteractorConeExample():
cone.SetResolution(8)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
coneMapper.SetInputConnection(cone.GetOutputPort())
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
......
......@@ -47,7 +47,7 @@ def vtkRegressionTestImage( renWin ):
else:
rt_pngw = vtk.vtkPNGWriter()
rt_pngw.SetFileName(fname)
rt_pngw.SetInput(rt_w2if.GetOutput())
rt_pngw.SetInputConnection(rt_w2if.GetOutputPort())
rt_pngw.Write()
rt_pngw = None
......@@ -55,8 +55,8 @@ def vtkRegressionTestImage( renWin ):
rt_png.SetFileName(fname)
rt_id = vtk.vtkImageDifference()
rt_id.SetInput(rt_w2if.GetOutput())
rt_id.SetImage(rt_png.GetOutput())
rt_id.SetInputConnection(rt_w2if.GetOutputPort())
rt_id.SetImageConnection(rt_png.GetOutputPort())
rt_id.Update()
if rt_id.GetThresholdedError() <= 10:
......
......@@ -10,7 +10,7 @@ To use this class, you must have numpy installed (http://numpy.scipy.org)
Methods
SetInputConnection(vtkAlgorithmOutput) -- connect to VTK image pipeline
SetInput(vtkImageData) -- set an vtkImageData to export
SetInputData(vtkImageData) -- set an vtkImageData to export
GetArray() -- execute pipeline and return a numpy array
Methods from vtkImageExport
......@@ -24,6 +24,7 @@ import umath
import numpy
from vtk import vtkImageExport
from vtk import vtkStreamingDemandDrivenPipeline
from vtk import VTK_SIGNED_CHAR
from vtk import VTK_UNSIGNED_CHAR
from vtk import VTK_SHORT
......@@ -78,17 +79,17 @@ class vtkImageExportToArray:
def SetInputConnection(self,input):
return self.__export.SetInputConnection(input)
def SetInput(self,input):
return self.__export.SetInput(input)
def SetInputData(self,input):
return self.__export.SetInputData(input)
def GetInput(self):
return self.__export.GetInput()
def GetArray(self):
self.__export.Update()
input = self.__export.GetInput()
input.UpdateInformation()
extent = input.GetExtent()
type = input.GetScalarType()
extent = input.GetWholeExtent()
numComponents = input.GetNumberOfScalarComponents()
dim = (extent[5]-extent[4]+1,
extent[3]-extent[2]+1,
......
......@@ -748,7 +748,7 @@ def wxVTKRenderWindowConeExample():
cone.SetResolution(8)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
coneMapper.SetInputConnection(cone.GetOutputPort())
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
......
......@@ -695,7 +695,7 @@ def wxVTKRenderWindowInteractorConeExample():
cone.SetResolution(8)
coneMapper = vtk.vtkPolyDataMapper()
coneMapper.SetInput(cone.GetOutput())
coneMapper.SetInputConnection(cone.GetOutputPort())
coneActor = vtk.vtkActor()
coneActor.SetMapper(coneMapper)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment