[vtk-developers] vtkImageReslice performance questions/improvemnts

Bill Lorensen bill.lorensen at gmail.com
Fri Sep 24 15:46:53 EDT 2010


We went through this rounding mess in ITK about a year ago.  We have
two rounding functions:
RoundHalfIntegerUp with is also called Round
 Round towards nearest integer
and
RoundHalfIntegerToEven
 halfway cases are rounded towards the nearest even  integer, e.g.
 *          RoundHalfIntegerToEven( 1.5) ==  2
 *          RoundHalfIntegerToEven(-1.5) == -2
 *          RoundHalfIntegerToEven( 2.5) ==  2
 *          RoundHalfIntegerToEven( 3.5) ==  4

They are implemented in what I thin is a complex way, but it seems to
work cross platform.

The code is in ITK/Code/Common/itkMath.h

The implementation are in itkMathDetail. It supports various hardware
accelerations.

Bill


On Fri, Sep 24, 2010 at 12:06 PM, Sean McBride <sean at rogue-research.com> wrote:
> On Thu, 23 Sep 2010 17:11:54 -0600, David Gobbi said:
>
>>Ugh.  Yeah, if you really look hard you'll find tons of "Floor" and
>>"Round" definitions in VTK, either as inline functions or as
>>preprocessor macros.  It is so hard to reach a consensus about the
>>best way to do these things.
>
> I didn't mean to imply that we should have one rounding to rule them all...
>
>>But I should definitely unify the code between GridWarp and
>>ImageReslice.  Thanks for pointing that out.
>
> ... I mostly meant that copypasta is bad.  If this one type of rounding/
> flooring is useful in two places, it seems it should be in one single
> place.  We could give it a particular name so that users know it's not a
> general-case rounder.  ex: vtkFunkyFloor() or whatever.
>
> --
> ____________________________________________________________
> Sean McBride, B. Eng                 sean at rogue-research.com
> Rogue Research                        www.rogue-research.com
> Mac Software Developer              Montréal, Québec, Canada
>
>
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtk-developers
>
>



More information about the vtk-developers mailing list