[vtkusers] [vtk-developers] About vtkImageReslice interpolation
Simon ESNEAULT
simon.esneault at gmail.com
Tue Jul 8 08:56:31 EDT 2014
Hi David,
Thanks for your explanation, very clear as usual !
However, this look like a bug to me, at least from the user point of view.
When the linear or cubic interpolation is activated, the user expect to get
an interpolation even for simple case where is could be assimilated to a
decimation.
Will try out your new vtkImageResize that seems promising !
Thanks
Simon
2014-07-08 14:08 GMT+02:00 David Gobbi <david.gobbi at gmail.com>:
> Hi Simon,
>
> If you are downsampling the image by simply changing the output
> spacing, without introducing a shift in the positions of the samples,
> then downsampling is a decimation operation (i.e. downsampling
> by a factor of three is the same as taking every 3rd voxel). This is
> true whether you use linear, cubic, or NN interpolation. The code
> optimizes such decimations by turning off the interpolation.
>
> In VTK, the Origin is at the center of the first voxel, so a
> straightforward
> downsampling places centers each output voxel at exactly the position
> of one of the input voxels, which is why downsampling becomes
> decimation. To avoid this, you must shift the output Origin relative to
> the input Origin.
>
> The new vtkImageResize filter has BorderOn()/BorderOff() methods
> to control this behavior. If Border is Off (the default) the behavior is
> like vtkImageReslice. If Border in On, then the output origin is
> automatically shifted relative to the input origin so that the shrink
> factors are applied relative to the outer corner of the first voxel,
> rather than relative to the center of the first voxel.
>
> I'm not sure if that was a clear explanation, so let me know if you
> still have questions.
>
> - David
>
>
> On Tue, Jul 8, 2014 at 3:41 AM, Simon ESNEAULT <simon.esneault at gmail.com>
> wrote:
> > Hi All,
> >
> > We use vtkImageResample/vtkImageReslice (from vtk 5.8.1) quite a lot
> here,
> > and I've noticed a strange behavior.
> >
> > If we down sample a volume by a factor of 2 in all 3 directions, the
> output
> > image will be the exact same if we use a nearest neighborhood, linear or
> > cubic interpolation. There seems to be no interpolation at all if the
> > reduction factor is a power of two.
> > If the reduction factor is set to 2.00001, the interpolation is performed
> > correctly when asked for linear or cubic.
> >
> > Is this an intended behavior ?
> >
> > After some debugging :
> > In the file vtkImageReslice.cxx, method vtkTricubicInterpCoeffs (line
> 1503)
> > with a power of 2 factor we always fall back to the part with the
> comment //
> > no interpolation (line 1510), but I don't understand why.
> >
> > And last question : there is a new vtkImageResize that was introduced in
> vtk
> > 5.10, will the behavior be the same ?
> >
> > Thanks for your help
> >
> > -Simon
>
--
------------------------------------------------------------------
Simon Esneault
13 rue Vasselot
35000 Rennes, France
Tel : 06 64 61 30 94
Mail : simon.esneault at gmail.com
------------------------------------------------------------------
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/vtkusers/attachments/20140708/44ac4f52/attachment.html>
More information about the vtkusers
mailing list