[Insight-developers] Pyramid Image Filters and ShrinkImageFilter vs ResampleImageFilter -- reply from Hans

Bradley Lowekamp blowekamp at mail.nih.gov
Mon Mar 30 10:44:37 EDT 2009


>
>
> The difference beting that the ShrinkImageFilter chooses a single  
> pixel in
> the input, and then assigns it to a single pixel in the output.   
> This is the
> case with both the older, faster method and the newer slower method we
> discussed on the TCON.
>
> The ResampleImageFilter, by contrast, interpolates, which means when  
> you
> downsample, it averages the pixels in the volume of the current  
> pixel from
> the input.
>
> It's easy enough to see why this produces different results.  In the
> simplest case, look at the answer you get if you downsample from 2x2  
> to 1x1:
>
> 1 0
> 0 1 -> ShrinkImageFilter = 1
>    -> ResampleImageFilter = 0.5

This illustrated my point as well, which is the switch to using a  
linear interpolation is a change in the algorithms and can  
significantly change the results of this filter. However, in your  
example there are a couple additional things which should be  
considered. First, The Pyramid filter utilizes a Gaussian filter to  
smooth the data. This means there is going to be some averaging and  
reduction in aliasing  as well as making the results much closer.  
Next, let us consider a 3x3 down-sampled to 1x1:

1 0 0
0 1 0
0 0 1

=> ShrinkImageFilter = 1
=> ResampleImageFilter = 1
Average = 1/3

But again, after the Gaussian filter the values would be averaged some  
what. Lastly, as larger down-samplings are performed, and the gaussian  
kernel becomes larger the difference between the two sampling  
algorithms is lessened.

>
>
> If the result from the ShrinkImageFilter is the desirable behavior  
> (for some
> generally agreed-on value of 'desirable'), maybe there needs to be a  
> second
> pair of PyramidFilters that use ResampleImageFilter. But in my  
> (admittedly
> naive) estimation, it really is a good idea to use  
> ResampleImageFilter for
> the Pyramid filters.

As I hopefully have been clear about, I define the desired behavior of  
itkMultiResolutionPyramidImageFilter as the algorithm that has been  
there for years. Certainly bug, and performance improvements can be  
made, but I really don't think this is either for this change.

<Possible Best Solution>
The other approach is to add a new option. Let the pyramid filter  
still use the resampler, but have it default to nearest neighbor  
interplant. Then add another variable and access methods to the  
pyramid to choose, nearest, linear etc.

However, with that being said I think there are numerous improvements  
that could be made to make a better pyramid filter. In fact I had  
begun working on a couple filters which were to be used in a new  
pyramid filter before my registration stopped working. If you would  
like to collaborate or at least share some note and features, please  
let me know.

>
>
> Notice: This UI Health Care e-mail (including attachments) is  
> covered by the Electronic Communications Privacy Act, 18 U.S.C.  
> 2510-2521, is confidential and may be legally privileged.  If you  
> are not the intended recipient, you are hereby notified that any  
> retention, dissemination, distribution, or copying of this  
> communication is strictly prohibited.  Please reply to the sender  
> that you have received the message in error, then delete it.  Thank  
> you.
>
>

========================================================
Bradley Lowekamp
Lockheed Martin Contractor for
Office of High Performance Computing and Communications
National Library of Medicine
blowekamp at mail.nih.gov


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/mailman/private/insight-developers/attachments/20090330/5f18da1c/attachment.htm>


More information about the Insight-developers mailing list