Commit f5d8bfd7 authored by Sankhesh Jhaveri's avatar Sankhesh Jhaveri 💬
Browse files

FIX: Python tests for SetInputData, Update and GetWholeExtent

For a filter to do GetWholeExtent,
instead of,
   extent = filter.GetOutput().GetWholeExtent()
new method is,
   extent = filter.GetExecutive().GetWholeExtent(filter.GetOutputInformation(0))

For a vtkImageData object, SetWholeExtent and SetUpdateExtent methods are not required.
parent 93f2ef76
......@@ -55,15 +55,15 @@ class TestBarGraph(vtk.test.Testing.vtkTest):
# Now add the line plots with appropriate colors
line = chart.AddPlot(2)
line.SetInput(table,0,1)
line.SetInputData(table,0,1)
line.SetColor(0,255,0,255)
line = chart.AddPlot(2)
line.SetInput(table,0,2)
line.SetInputData(table,0,2)
line.SetColor(255,0,0,255)
line = chart.AddPlot(2)
line.SetInput(table,0,3)
line.SetInputData(table,0,3)
line.SetColor(0,0,255,255)
view.GetRenderWindow().SetMultiSamples(0)
......
......@@ -52,17 +52,17 @@ class TestLinePlot(vtk.test.Testing.vtkTest):
# Now add the line plots with appropriate colors
line = chart.AddPlot(0)
line.SetInput(table,0,1)
line.SetInputData(table,0,1)
line.SetColor(0,255,0,255)
line.SetWidth(1.0)
line = chart.AddPlot(0)
line.SetInput(table,0,2)
line.SetInputData(table,0,2)
line.SetColor(255,0,0,255)
line.SetWidth(5.0)
line = chart.AddPlot(0)
line.SetInput(table,0,3)
line.SetInputData(table,0,3)
line.SetColor(0,0,255,255)
line.SetWidth(4.0)
......
......@@ -72,7 +72,7 @@ class TestLinePlotColors(vtk.test.Testing.vtkTest):
# Add multiple line plots, setting the colors etc
line0 = chart.AddPlot(vtk.vtkChart.LINE)
line0.SetInput(table, 0, 1)
line0.SetInputData(table, 0, 1)
line0.SetColor(50, 50, 50, 255)
line0.SetWidth(3.0)
line0.GetPen().SetLineType(vtk.vtkPen.SOLID_LINE)
......@@ -82,13 +82,13 @@ class TestLinePlotColors(vtk.test.Testing.vtkTest):
line0.SelectColorArray(1)
line1 = chart.AddPlot(vtk.vtkChart.LINE)
line1.SetInput(table, 0, 2)
line1.SetInputData(table, 0, 2)
line1.GetPen().SetLineType(vtk.vtkPen.NO_PEN)
line1.SetMarkerStyle(vtk.vtkPlotPoints.PLUS)
line1.SetColor(150, 100, 0, 255)
line2 = chart.AddPlot(vtk.vtkChart.LINE)
line2.SetInput(table, 0, 3)
line2.SetInputData(table, 0, 3)
line2.SetColor(100, 100, 100, 255)
line2.SetWidth(3.0)
line2.GetPen().SetLineType(vtk.vtkPen.DASH_LINE)
......
......@@ -77,7 +77,7 @@ class TestParallelCoordinatesColors(vtk.test.Testing.vtkTest):
lut.SetAlpha(0.25)
lut.SetRange(-1, 1)
chart.GetPlot(0).SetInput(table)
chart.GetPlot(0).SetInputData(table)
chart.GetPlot(0).SetScalarVisibility(1)
chart.GetPlot(0).SetLookupTable(lut)
chart.GetPlot(0).SelectColorArray("Cosine")
......
......@@ -73,13 +73,13 @@ class TestScatterPlotColors(vtk.test.Testing.vtkTest):
# Add multiple line plots, setting the colors etc
points0 = chart.AddPlot(vtk.vtkChart.POINTS)
points0.SetInput(table, 0, 1)
points0.SetInputData(table, 0, 1)
points0.SetColor(0, 0, 0, 255)
points0.SetWidth(1.0)
points0.SetMarkerStyle(vtk.vtkPlotPoints.CROSS)
points1 = chart.AddPlot(vtk.vtkChart.POINTS)
points1.SetInput(table, 0, 2)
points1.SetInputData(table, 0, 2)
points1.SetColor(0, 0, 0, 255)
points1.SetMarkerStyle(vtk.vtkPlotPoints.DIAMOND)
points1.SetScalarVisibility(1)
......@@ -87,7 +87,7 @@ class TestScatterPlotColors(vtk.test.Testing.vtkTest):
points1.SelectColorArray(1)
points2 = chart.AddPlot(vtk.vtkChart.POINTS)
points2.SetInput(table, 0, 3)
points2.SetInputData(table, 0, 3)
points2.SetColor(0, 0, 0, 255)
points2.ScalarVisibilityOn()
points2.SetLookupTable(lut2)
......
......@@ -82,7 +82,7 @@ class TestStackedPlot(vtk.test.Testing.vtkTest):
# Create the stacked plot
stack = chart.AddPlot(3)
stack.SetUseIndexForXSeries(True)
stack.SetInput(table)
stack.SetInputData(table)
stack.SetInputArray(1,"Books")
stack.SetInputArray(2,"New / Popular")
stack.SetInputArray(3,"Periodical")
......
......@@ -17,9 +17,9 @@ class SimpleGlyph:
sg.SetCenter(0.5, 0.0, 0.0)
g = self.glyph = vtk.vtkTensorGlyph()
g.SetInputConnection(self.reader.GetOutputPort())
g.SetSource(self.src_glyph.GetOutput())
g.SetSourceConnection(self.src_glyph.GetOutputPort())
g.SetScaleFactor(0.25)
# The normals are needed to generate the right colors and if
# not used some of the glyphs are black.
self.normals = vtk.vtkPolyDataNormals()
......@@ -58,6 +58,7 @@ class TestTensorGlyph(Testing.vtkTest):
data_file = os.path.join(Testing.VTK_DATA_ROOT, "Data",
"tensors.vtk")
reader.SetFileName(data_file)
reader.Update
g1 = SimpleGlyph(reader)
g1.glyph.ColorGlyphsOff()
......
......@@ -47,8 +47,8 @@ class TestTextureGlyph(Testing.vtkTest):
g = vtk.vtkGlyph3D()
g.SetScaleModeToDataScalingOff()
g.SetVectorModeToUseVector()
g.SetInput(pd)
g.SetSource(cs.GetOutput())
g.SetInputData(pd)
g.SetSourceConnection(cs.GetOutputPort())
m = vtk.vtkPolyDataMapper()
m.SetInputConnection(g.GetOutputPort())
......
......@@ -24,7 +24,7 @@ pl3d.Update()
pl3d_output = pl3d.GetOutput().GetBlock(0)
eg = vtk.vtkExtractGrid()
eg.SetInput(pl3d_output)
eg.SetInputData(pl3d_output)
eg.SetSampleRate(4,4,4)
gs = vtk.vtkGlyphSource2D()
......@@ -35,7 +35,7 @@ gs.CrossOff()
glyph = vtk.vtkGlyph3D()
glyph.SetInputConnection(eg.GetOutputPort())
glyph.SetSource(gs.GetOutput())
glyph.SetSourceConnection(gs.GetOutputPort())
glyph.SetScaleFactor( 0.75 )
mapper = vtk.vtkPolyDataMapper()
......
......@@ -24,7 +24,7 @@ pl3d.Update()
pl3d_output = pl3d.GetOutput().GetBlock(0)
outline = vtk.vtkStructuredGridOutlineFilter()
outline.SetInput(pl3d_output)
outline.SetInputData(pl3d_output)
outlineMapper = vtk.vtkPolyDataMapper()
outlineMapper.SetInputConnection(outline.GetOutputPort())
......@@ -38,8 +38,8 @@ seeds.SetPoint2(15, 5, 32)
seeds.SetResolution(10)
sl = vtk.vtkStreamLine()
sl.SetInput(pl3d_output)
sl.SetSource(seeds.GetOutput())
sl.SetInputData(pl3d_output)
sl.SetSourceData(seeds.GetOutput())
sl.SetMaximumPropagationTime(0.1)
sl.SetIntegrationStepLength(0.1)
sl.SetIntegrationDirectionToIntegrateBothDirections()
......
......@@ -24,7 +24,7 @@ pl3d.Update()
pl3d_output = pl3d.GetOutput().GetBlock(0)
outline = vtk.vtkStructuredGridOutlineFilter()
outline.SetInput(pl3d_output)
outline.SetInputData(pl3d_output)
outlineMapper = vtk.vtkPolyDataMapper()
outlineMapper.SetInputConnection(outline.GetOutputPort())
......@@ -41,8 +41,8 @@ integ = vtk.vtkRungeKutta4()
sl = vtk.vtkStreamLine()
sl.SetIntegrator(integ)
sl.SetInput(pl3d_output)
sl.SetSource(seeds.GetOutput())
sl.SetInputData(pl3d_output)
sl.SetSourceData(seeds.GetOutput())
sl.SetMaximumPropagationTime(0.1)
sl.SetIntegrationStepLength(0.1)
sl.SetIntegrationDirectionToBackward()
......
......@@ -24,7 +24,7 @@ pl3d.Update()
pl3d_output = pl3d.GetOutput().GetBlock(0)
outline = vtk.vtkStructuredGridOutlineFilter()
outline.SetInput(pl3d_output)
outline.SetInputData(pl3d_output)
outlineMapper = vtk.vtkPolyDataMapper()
outlineMapper.SetInputConnection(outline.GetOutputPort())
......@@ -41,8 +41,8 @@ integ = vtk.vtkRungeKutta4()
sl = vtk.vtkStreamLine()
sl.SetIntegrator(integ)
sl.SetInput(pl3d_output)
sl.SetSource(seeds.GetOutput())
sl.SetInputData(pl3d_output)
sl.SetSourceData(seeds.GetOutput())
sl.SetMaximumPropagationTime(0.1)
sl.SetIntegrationStepLength(0.1)
sl.SetIntegrationDirectionToBackward()
......
......@@ -24,7 +24,7 @@ pl3d.Update()
pl3d_output = pl3d.GetOutput().GetBlock(0)
outline = vtk.vtkStructuredGridOutlineFilter()
outline.SetInput(pl3d_output)
outline.SetInputData(pl3d_output)
outlineMapper = vtk.vtkPolyDataMapper()
outlineMapper.SetInputConnection(outline.GetOutputPort())
......@@ -41,8 +41,8 @@ integ = vtk.vtkRungeKutta4()
sl = vtk.vtkStreamLine()
sl.SetIntegrator(integ)
sl.SetInput(pl3d_output)
sl.SetSource(seeds.GetOutput())
sl.SetInputData(pl3d_output)
sl.SetSourceData(seeds.GetOutput())
sl.SetMaximumPropagationTime(0.1)
sl.SetIntegrationStepLength(0.1)
sl.SetIntegrationDirectionToBackward()
......
......@@ -39,7 +39,7 @@ vtkActor g3Actor
g3Actor SetMapper g3Mapper
g3Actor AddPosition 0 0 15
vtkDataSetSurfaceFilter gf4
gf4 SetInputConnection [gf2 GetOutputPort]
gf4 SetInputData $output
gf4 UseStripsOn
vtkPolyDataMapper g4Mapper
g4Mapper SetInputConnection [gf4 GetOutputPort]
......@@ -99,7 +99,7 @@ vtkActor g8Actor
g8Actor AddPosition 0 15 0
# Create the RenderWindow, Renderer and both Actors
#
vtkRenderer ren1
vtkRenderWindow renWin
renWin AddRenderer ren1
......
......@@ -30,7 +30,7 @@ class TestMapperLUT(Testing.vtkTest):
p.GetPointData().SetScalars(sc)
l = vtk.vtkLookupTable()
m = vtk.vtkPolyDataMapper()
m.SetInput(p)
m.SetInputData(p)
m.SetScalarRange(0.0, 10.0)
m.SetLookupTable(l)
ret = m.MapScalars(0.5)
......@@ -51,7 +51,7 @@ class TestMapperLUT(Testing.vtkTest):
v16.SetDataSpacing(3.2, 3.2, 1.5)
v16.Update()
xMin, xMax, yMin, yMax, zMin, zMax = v16.GetOutput().GetWholeExtent()
xMin, xMax, yMin, yMax, zMin, zMax = v16.GetExecutive().GetWholeExtent(v16.GetOutputInformation(0))
img_data = v16.GetOutput()
spacing = img_data.GetSpacing()
sx, sy, sz = spacing
......@@ -61,7 +61,7 @@ class TestMapperLUT(Testing.vtkTest):
# An outline is shown for context.
outline = vtk.vtkOutlineFilter()
outline.SetInput(img_data)
outline.SetInputData(img_data)
outlineMapper = vtk.vtkPolyDataMapper()
outlineMapper.SetInputConnection(outline.GetOutputPort())
......@@ -120,7 +120,7 @@ class TestMapperLUT(Testing.vtkTest):
p.SetPoints(pts)
p.GetPointData().SetScalars(sc)
m = vtk.vtkPolyDataMapper()
m.SetInput(p)
m.SetInputData(p)
# Share the lookup table of the widgets.
m.SetLookupTable(planeWidgetX.GetLookupTable())
m.UseLookupTableScalarRangeOn()
......
......@@ -35,7 +35,7 @@ def BuildBackdrop (minX, maxX, minY, maxY, minZ, maxZ, thickness):
if not baseMapper:
baseMapper = vtk.vtkPolyDataMapper()
baseMapper.SetInput(basePlane.GetOutput())
baseMapper.SetInputConnection(basePlane.GetOutputPort())
if not base:
base = vtk.vtkActor()
......@@ -50,7 +50,7 @@ def BuildBackdrop (minX, maxX, minY, maxY, minZ, maxZ, thickness):
if not backMapper:
backMapper = vtk.vtkPolyDataMapper()
backMapper.SetInput(backPlane.GetOutput())
backMapper.SetInputConnection(backPlane.GetOutputPort())
if not back:
back = vtk.vtkActor()
......@@ -65,7 +65,7 @@ def BuildBackdrop (minX, maxX, minY, maxY, minZ, maxZ, thickness):
if not leftMapper:
leftMapper = vtk.vtkPolyDataMapper()
leftMapper.SetInput(leftPlane.GetOutput())
leftMapper.SetInputConnection(leftPlane.GetOutputPort())
if not left:
left = vtk.vtkActor()
......
......@@ -11,7 +11,6 @@ reader SetDataScalarTypeToUnsignedShort
reader Update
set readerOutput [reader GetOutput]
puts [$readerOutput GetClassName]
$readerOutput SetOrigin -63 -63 -46
# Disconnect the output from its reader. First get an extra reference.
......
......@@ -28,7 +28,7 @@ class TestImagePlaneWidget(Testing.vtkTest):
v16.SetDataSpacing(3.2, 3.2, 1.5)
v16.Update()
xMin, xMax, yMin, yMax, zMin, zMax = v16.GetOutput().GetWholeExtent()
xMin, xMax, yMin, yMax, zMin, zMax = v16.GetExecutive().GetWholeExtent(v16.GetOutputInformation(0))
img_data = v16.GetOutput()
# **************************************************
......@@ -37,14 +37,13 @@ class TestImagePlaneWidget(Testing.vtkTest):
# Lets create this data using the data from the reader.
my_img_data = vtk.vtkImageData()
my_img_data.SetDimensions(img_data.GetDimensions())
my_img_data.SetWholeExtent(img_data.GetWholeExtent())
# my_img_data.SetWholeExtent(img_data.GetWholeExtent())
my_img_data.SetExtent(img_data.GetExtent())
my_img_data.SetUpdateExtent(img_data.GetUpdateExtent())
# my_img_data.SetUpdateExtent(img_data.GetUpdateExtent())
my_img_data.SetSpacing(img_data.GetSpacing())
my_img_data.SetOrigin(img_data.GetOrigin())
my_img_data.SetScalarType(img_data.GetScalarType())
my_img_data.SetScalarType(img_data.GetScalarType(), my_img_data.GetInformation())
my_img_data.GetPointData().SetScalars(img_data.GetPointData().GetScalars())
my_img_data.Update()
# hang on to original image data.
orig_img_data = img_data
......@@ -61,7 +60,7 @@ class TestImagePlaneWidget(Testing.vtkTest):
# An outline is shown for context.
outline = vtk.vtkOutlineFilter()
outline.SetInput(img_data)
outline.SetInputData(img_data)
outlineMapper = vtk.vtkPolyDataMapper()
outlineMapper.SetInputConnection(outline.GetOutputPort())
......
......@@ -176,16 +176,17 @@ def compareImageWithSavedImage(src_img, img_fname, threshold=10):
# generate the image
pngw = vtk.vtkPNGWriter()
pngw.SetFileName(_getTempImagePath(img_fname))
pngw.SetInput(src_img)
pngw.SetInputData(src_img)
pngw.Write()
return
pngr = vtk.vtkPNGReader()
pngr.SetFileName(img_fname)
pngr.Update
idiff = vtk.vtkImageDifference()
idiff.SetInput(src_img)
idiff.SetImage(pngr.GetOutput())
idiff.SetInputData(src_img)
idiff.SetImageData(pngr.GetOutput())
idiff.Update()
min_err = idiff.GetThresholdedError()
......@@ -305,12 +306,12 @@ def _handleFailedImage(idiff, pngr, img_fname):
# Write out the image that was generated. Write it out as full so that
# it may be used as a baseline image if the tester deems it valid.
pngw.SetInput(idiff.GetInput())
pngw.SetInputData(idiff.GetInput())
pngw.SetFileName(_getTempImagePath(f_base + ".png"))
pngw.Write()
# write out the valid image that matched.
pngw.SetInput(idiff.GetImage())
pngw.SetInputData(idiff.GetImage())
pngw.SetFileName(_getTempImagePath(f_base + ".valid.png"))
pngw.Write()
......
Supports Markdown
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