<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
To improve myself:<br>
<br>
the NumericTraits<TOutput>::min() should also be
NumericTraits<TOutput>::NonPositiveMin(), I guess.<br>
<br>
Also the documentation seems incorrect. At line 39 it reads:<br>
<br>
* - compute the constrained value (constrained to be greater than
or equal to the minimum value of the<br>
* input 1 pixel type<br>
But the implementation is that it should be greater than the minimum
value of the <b>*output*</b> type.<br>
<br>
Similar possible errors are made in the
ConstrainedValueAdditionImageFilter.<br>
<br>
Regards,<br>
<br>
Marius<br>
<br>
Marius Staring wrote:
<blockquote cite="mid45DC68CD.8040707@isi.uu.nl" type="cite">Hi,
<br>
<br>
The implementation of the operator() in the functor of the
ConstrainedValueDifferenceImageFilter now reads:
<br>
<br>
const double dA = static_cast<double>( A );
<br>
const double dB = static_cast<double>( B );
<br>
const double diff = dA - dB;
<br>
const double cdiff = ( diff > NumericTraits<TOutput>::min()
) ? diff : NumericTraits<TOutput>::min();
<br>
return static_cast<TOutput>( cdiff );
<br>
<br>
I think that should be
<br>
<br>
const double dA = static_cast<double>( A );
<br>
const double dB = static_cast<double>( B );
<br>
const double diff = dA - dB;
<br>
const double cdiff1 = ( diff >
NumericTraits<TOutput>::min() ) ? diff :
NumericTraits<TOutput>::min();
<br>
const double cdiff2 = ( cdiff1 <
NumericTraits<TOutput>::max() ) ? diffc1 :
NumericTraits<TOutput>::max();
<br>
return static_cast<TOutput>( cdiff2 );
<br>
<br>
or am I missing something?
<br>
<br>
Cheers,
<br>
<br>
</blockquote>
<br>
<pre class="moz-signature" cols="60">--
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
<a class="moz-txt-link-abbreviated" href="mailto:marius@isi.uu.nl">marius@isi.uu.nl</a>, <a class="moz-txt-link-freetext" href="http://www.isi.uu.nl/People/Marius">http://www.isi.uu.nl/People/Marius</a></pre>
</body>
</html>