[vtkusers] Fwd: Origin not passed to vtkExtractVOI through Pipeline (bug?)

Paul massivemonkeymayhem at gmail.com
Thu Nov 13 09:47:44 EST 2008


Information does not appear to be getting properly passed through from
the parent data set to a vtkExtractVOI object (particularly, the
object's origin). It was fine in 5.0 but broke in 5.2. I'll let the
short code snippet do the talking. Has this perhaps been fixed in CVS?

---------------------------

import vtk

data = vtk.vtkFloatArray()

for i in range(9):
   data.InsertNextValue(i)

image = vtk.vtkImageData()

image.GetPointData().SetScalars(data)
image.SetOrigin(1,1,1)
image.Update()

roi = vtk.vtkExtractVOI()
roi.SetInput(image)
roi.Update()
roi.GetOutput().GetOrigin()

>>> Out: (1.0, 1.0, 1.0)

# Everything is copacetic

reader = vtk.vtkXMLImageDataReader()
reader.SetFileName('/path/to/some/file.vti')

reader.Update()
reader.GetOutput().GetOrigin()

>>> Out: (0.0, 0.0, 9.0)

roi2 = vtk.vtkExtractVOI()
roi2.SetInputConnection(reader.GetOutputPort())
roi2.Update()
roi2.UpdateWholeExtent()
roi2.GetOutput().GetOrigin()

>>> Out: (0.0, 0.0, 0.0)

# Should be (0.0, 0.0, 9.0) !
# That makes me a saaaaad panda :(

# NB: roi2.GetOutput().GetSpacing() is just fine.

---------------------------

The really screwball thing is that I can't even set the Origin
manually. When I call Render() on the render window, the Origin value
for roi2 reverts back to (0.0, 0.0, 0.0).


Paul



More information about the vtkusers mailing list