[Insight-users] possible bug in ConstrainedValueDifferenceImageFilter

Marius Staring marius at isi.uu.nl
Wed Feb 21 10:44:13 EST 2007


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



More information about the Insight-users mailing list