[Insight-users] possible bug in ConstrainedValueDifferenceImageFilter

Marius Staring marius at isi.uu.nl
Wed Feb 21 11:08:37 EST 2007


To improve myself:

the NumericTraits<TOutput>::min() should also be 
NumericTraits<TOutput>::NonPositiveMin(), I guess.

Also the documentation seems incorrect. At line 39 it reads:

     * - compute the constrained value (constrained to be greater than 
or equal to the minimum value of the
     *   input 1 pixel type
But the implementation is that it should be greater than the minimum 
value of the **output** type.

Similar possible errors are made in the ConstrainedValueAdditionImageFilter.

Regards,

Marius

Marius Staring 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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://public.kitware.com/pipermail/insight-users/attachments/20070221/ef2033dc/attachment.htm


More information about the Insight-users mailing list