[Insight-developers] fast floor function

Tom Vercauteren tom.vercauteren at m4x.org
Mon Aug 4 12:18:05 EDT 2008


Hi Brad,

Sorry to ask you personally after asking the ITK developers mailing
list (which is kept CC'ed) but I'd like to move forward. I remembered
that you were also a VNL developer and therefore thought you might
give me some advice.

I would like to fix and move the fast floor functions that can be
found in itkBSplineInterpolationWeightFunction.txx and
itkBilateralImageFilter.txx to a more convenient and testable place.

I think that Utilities/vxl/core/vnl/vnl_math.h would be a good place
to move it to. There indeed already is a vnl_math_rnd function there.
We could either modify that function or add a another rounding
function there (say vnl_math_fast_rnd). Of course this would also
imply modifying Utilities/vxl/core/vnl/tests/test_math.cxx.

Would it then be possible to maintain the modified VNL inside ITK or
to port the modifications into VNL?

Let me know if you need further information.

Best regards,
Tom Vercauteren


On Fri, Aug 1, 2008 at 12:07 PM, Tom Vercauteren
<tom.vercauteren at m4x.org> wrote:
> Hi all,
>
> I'd like to fix the following issue but need some insight:
> http://www.itk.org/Bug/view.php?id=2078
> http://www.itk.org/Bug/view.php?id=5692
>
> Basically, within itkBSplineInterpolationWeightFunction.txx there is a
> (private) fast floor function that kind of works on easy tasks but
> fails on some others, e.g. BSplineFloor(0.999999) returns 1 instead of
> 0.
>
>
> I need feedback on several points:
>
> 1) Since this function is only defined in an anonymous namespace
> itkBSplineInterpolationWeightFunction.txx, it cannot be tested in a
> unit test. We should at least be able to test it.
>
> 2) The potential scope of such a function is way broader that is
> actual use. I therefore think it should be placed in a place where
> anybody can access it. I would vote for vnl but don't know if it is
> easy to do that. Where else could it be placed?
>
> 3) In our local source code we have a fast floor function based on
> http://ldesoras.free.fr/doc/articles/rounding_en.pdf that we tested on
> a only few platforms. It works quite well but has some known
> limitations (A: The absolute value of the argument must be less than
> INT_MAX/2   B: It expects that the FPU rounding mode is the default
> one, i.e. if someone changes it we assume that he then restores the
> initial state). I would be happy to share it but it may need some
> additional compatibility work.
>
> Best regards,
> Tom
>


More information about the Insight-developers mailing list