HI Dominique,<br><br>I may not have enough coffee yet,...<br><br>but as far as I can tell from looking at the code<br>your observation seems to be correct.<br><br><br>It looks like the two table elements are set in<br>line 194-195:<br>
<br>  m_QuantileTable[0][m_NumberOfMatchPoints + 1] = m_SourceMaxValue;<br>  m_QuantileTable[1][m_NumberOfMatchPoints + 1] = m_ReferenceMaxValue;<br><br>and their values do not change from there<br>to the lines 237 and 241 where they are used in<br>
the subtraction.<br><br>It seems that &quot;denominator&quot; in line 237 will always<br>be zero, which prevents the code in lines 241 -243<br>from execution.<br><br>Also, as you pointed out, even if the code in 241-243<br>
where executed, it will still compute m_UpperGradient<br>as zero, given that <br><br>m_QuantileTable[1][m_NumberOfMatchPoints + 1] = m_ReferenceMaxValue;<br><br><br>This seems to be a bug....<br><br><br>Looking at the potential uses of m_UpperGradient,<br>
it is only used for interpolating the histogram points<br>that are after the Nth matching point.  In lines 357-361.<br><br>This problem doesn&#39;t seem to occur for m_LowerGradient,<br>which may provide a hint for the solution of the (potential)<br>
bug...<br><br><br>More coffee needed here....<br><br><br>     Luis<br><br><br>-------------------------------------------------------------------------<br><div class="gmail_quote">2009/6/16 Dominique Töpfer <span dir="ltr">&lt;<a href="mailto:dominique@toepfer-web.de">dominique@toepfer-web.de</a>&gt;</span><br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hello,<br>
<br>
I have some difficulties understanding the code of the HistogramMatchingImageFilter. In the method BeforeThreadedGenerateData() m_UpperGradient is set by the following code:<br>
<br>
denominator = m_QuantileTable[0][m_NumberOfMatchPoints+1] - m_SourceMaxValue;<br>
if ( denominator != 0)<br>
 {<br>
   m_UpperGradient = m_QuantileTable[1][m_NumberOfMatchPoints+1] -<br>
     m_ReferenceMaxValue;<br>
   m_UpperGradient /= denominator;<br>
 }<br>
 else<br>
 {<br>
   m_UpperGradient = 0.0;<br>
 }<br>
<br>
<br>
But considering<br>
<br>
m_QuantileTable[0][m_NumberOfMatchPoints + 1] = m_SourceMaxValue;<br>
m_QuantileTable[1][m_NumberOfMatchPoints + 1] = m_ReferenceMaxValue;<br>
<br>
(same method) m_UpperGradient is always set to 0.0. So why is this variable necessary? Did I overlook something?<br>
Thanks in advance!<br>
<br>
Dominique<br>
<br>
_____________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at<br>
<a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ITK FAQ at: <a href="http://www.itk.org/Wiki/ITK_FAQ" target="_blank">http://www.itk.org/Wiki/ITK_FAQ</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.itk.org/mailman/listinfo/insight-users" target="_blank">http://www.itk.org/mailman/listinfo/insight-users</a><br>
</blockquote></div><br>