[Insight-users] possible bug in ConstrainedValueDifferenceImageFilter

Bill Lorensen bill.lorensen at gmail.com
Wed Feb 21 11:12:17 EST 2007


Actually, there is also another error here. NonpositiveMin() should replace
min(). Also, it looks like the ConstrainedValueAddImageFilter is wrong. It
assumes only overflow can occur. If the values are negative, then underflow
can occur.

I'll try to fix these before the upcoming release.

Bill



On 2/21/07, Marius Staring <marius at isi.uu.nl> wrote:
>
> Hi,
>
> The implementation of the operator() in the functor of the
> ConstrainedValueDifferenceImageFilter now reads:
>
>    const double dA = static_cast<double>( A );
>    const double dB = static_cast<double>( B );
>    const double diff = dA - dB;
>    const double cdiff = ( diff > NumericTraits<TOutput>::min() ) ? diff
> : NumericTraits<TOutput>::min();
>    return static_cast<TOutput>( cdiff );
>
> I think that should be
>
>    const double dA = static_cast<double>( A );
>    const double dB = static_cast<double>( B );
>    const double diff = dA - dB;
>    const double cdiff1 = ( diff > NumericTraits<TOutput>::min() ) ?
> diff : NumericTraits<TOutput>::min();
>    const double cdiff2 = ( cdiff1 < NumericTraits<TOutput>::max() ) ?
> diffc1 : NumericTraits<TOutput>::max();
>    return static_cast<TOutput>( cdiff2 );
>
> or am I missing something?
>
> Cheers,
>
> --
> Marius Staring
> Image Sciences Institute
> University Medical Centre Utrecht
> Heidelberglaan 100, 3584 CX Utrecht, The Netherlands
> phone: +31 (0)30 250 3186, fax: +31 (0)30 251 3399
> marius at isi.uu.nl, http://www.isi.uu.nl/People/Marius
>
> _______________________________________________
> Insight-users mailing list
> Insight-users at itk.org
> http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070221/2e7f3883/attachment.htm


More information about the Insight-users mailing list