[vtkusers] vtkImageReslice ERROR

David Gobbi dgobbi at imaging.robarts.ca
Thu Dec 2 10:45:55 EST 2004


Hi Benoit,

I know why the problem is occurring, but I don't know enough about the
new VTK pipeline to be sure of the best fix.

The error is also generated with the most recent VTK cvs.  It is a result
of your code performing two updates, where the WholeExtent is different
for the second update because you have rotated the volume.

For Update 1:  WholeExtent is (0, 200, 0, 100, 0, 0)
For Update 2:  WholeExtent is (0, 100, 0, 100, 0, 0)

The issue is that VTK uses the UpdateExtent from the first update, as the
UpdateExtent for the second update, at which time it is outside the
bounds of the WholeExtent, hence the error.

An easy fix is to do your updates like this:
reslice.GetOutput().UpdateInformation()
reslice.GetOutput().SetUpdateExtentToWholeExtent()
reslice.Update()

Another fix is to avoid the use of reslice.AutoCropOutputOn(),
and instead use reslice.SetOutputExtent(...).

 - David

On Thu, 2 Dec 2004, Benoit Regrain wrote:

> Hi,
>
> I'm using a nightly version of VTK from 29 oct. 2004
> And when I'm using the vtkImageReslice on an image that have an anisotropic spacing
> (example : 0.5, 1, 1), I obtain the following message (the source code is at the end of
> the mail) :
>
> ERROR: In C:\Creatis\VTK\Filtering\vtkStreamingDemandDrivenPipeline.cxx, line 55
> 4
> vtkStreamingDemandDrivenPipeline (0CF10460): The update extent specified in the
> information for output port 0 on algorithm vtkImageReslice(0CF102D8) is 0 200 0
> 100 0 0, which is outside the whole extent 0 100 0 100 0 0.
>
> Has anyone an idea to solve it ?
>
> Cheers
> Benoit Regrain
>
>
> Source code to obtain the vtkImageReslice ERROR message :
> -----------------------------------------------------------------------------------------------
> from vtkpython import *
> import sys
>
> transform=vtkTransform()
> transform.PostMultiply()
>
> src=vtkImageEllipsoidSource()
> src.SetOutputScalarType(5)
> src.SetWholeExtent(0,100,0,100,0,100)
> src.SetCenter(50,50,50)
> src.SetRadius(50,40,30)
> src.SetOutputScalarTypeToUnsignedChar()
>
> info=vtkImageChangeInformation()
> info.SetInput(src.GetOutput())
> info.SetOutputSpacing(0.5,1,1)
>
> reslice=vtkImageReslice()
> reslice.SetInput(info.GetOutput())
> reslice.SetOutputDimensionality(2)
> reslice.SetResliceAxesDirectionCosines(1,0,0,0,1,0,0,0,1)
> reslice.SetResliceAxesOrigin(0,0,0)
> reslice.AutoCropOutputOn()
> reslice.SetResliceTransform(transform)
>
> print "Update 1"
> transform.Identity()
> transform.RotateWXYZ(90,0,1,0)
> reslice.Update()
>
> print "Update 2"
> transform.Identity()
> transform.RotateWXYZ(-90,1,0,0)
> reslice.Update()
> ############# Here I obtain the ERROR message
>
> sys.stdin.read(1)
>




More information about the vtkusers mailing list