MantisBT - VTK
View Issue Details
0001128VTK(No Category)public2004-09-02 12:382016-08-12 09:54
minnus 
Charles Law 
highmajoralways
closedmoved 
 
 
0001128: vtkImageResample produces incorrect extents
input is a 128x128x64 image (extents 0-127,0-127,0-63), if I do the folowing:

resample->SetAxisMagnificationFactor(0, 4);
resample->SetAxisMagnificationFactor(1, 4);
resample->Update();
resample->UpdateWholeExtent();
resample->GetOutput()->Update();

int dims[3];
resample->GetOutput()->GetDimensions(dims);
resample->GetOutput()->Print( cout );
cout<<"Dims: "<<dims[0]<<", "<<dims[1]<<endl;

dims[0] and dims[1] contain "509" and the Print shows extents of 0-508 for the x and y direction.

Expected results are dims of 512 and extents 0-511

the problem appears to be in the "wholeMax" calculation of the ExecuteInformation function.

Thanks.

Martins
No tags attached.
Issue History
2011-06-16 13:11Zack GalbreathCategory => (No Category)
2016-08-12 09:54Kitware RobotNote Added: 0036749
2016-08-12 09:54Kitware RobotStatusexpired => closed
2016-08-12 09:54Kitware RobotResolutionopen => moved

Notes
(0001407)
Mathieu Malaterre   
2004-09-02 13:07   
Adding complete test:

import vtk
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()

v16 = vtk.vtkVolume16Reader()
v16.SetDataDimensions(64, 64)
v16.SetDataByteOrderToLittleEndian()
v16.SetFilePrefix(VTK_DATA_ROOT + "/Data/headsq/quarter")
v16.SetImageRange(1, 93)
v16.SetDataSpacing(3.2, 3.2, 1.5)
v16.Update()

print v16.GetOutput().GetDimensions()

print "Multiplying x,y by 4"

resample = vtk.vtkImageResample()
resample.SetInput( v16.GetOutput() )
resample.SetAxisMagnificationFactor(0, 4)
resample.SetAxisMagnificationFactor(1, 4)
resample.Update();

print resample.GetOutput().GetDimensions()
print resample.GetOutput().GetExtent()
(0001426)
   
2004-09-14 15:13   
Well, I tried looking into this myself but it looks like the problem is related to the following reported earlier:

http://public.kitware.com/pipermail/vtkusers/2004-May/073744.html [^]
http://public.kitware.com/pipermail/vtkusers/2002-July/061960.html [^]
 
Has there been any discussion on changing this in an upcoming release? I understand it would be a pretty big internal change, but it seems unintuitive currently. Thanks.

Martins
(0001860)
David Gobbi   
2005-01-06 11:40   
I think the current behaviour is correct. If an image is 128x128, then the distance from the first pixel to the last pixel is 127. Multiplying by four gives 508, so the output image should have an extent of [0,508].

If a 512x512 image is needed, then don't use vtkImageResample. Instead, use vtkImageReslice and set the OutputSpacing and OutputExtent appropriately.
(0036749)
Kitware Robot   
2016-08-12 09:54   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current VTK Issues page linked in the banner at the top of this page.