[vtkusers] image resizing - spacing/extent problems?
Tim Hutton
tim.hutton at gmail.com
Thu Sep 20 12:15:52 EDT 2007
Hello,
I'm trying to shrink an image (to make image pyramids). The following
code appears to work:
vtkImageResample *downsampler = vtkImageResample::New();
downsampler->SetInput(smoother->GetOutput());
downsampler->SetInterpolationModeToLinear();
downsampler->SetDimensionality(2);
double shrink_factor = pow(0.5,(double)iCurrentLevel);
downsampler->SetAxisMagnificationFactor(0,shrink_factor);
downsampler->SetAxisMagnificationFactor(1,shrink_factor);
downsampler->Update();
When I save out the image it appears at the size I want. However, the
rest of my algorithm doesn't work unless I then read-in the image I've
just saved out, and use that instead. What would cause this odd
behaviour? Could it be something to do with the extent, or the
spacing, or the origin?
Many thanks for any guidance.
--
Tim Hutton - http://www.sq3.org.uk
Take the Organic Builder challenge -
http://www.sq3.org.uk/Evolution/Squirm3/OrganicBuilder/
More information about the vtkusers
mailing list