[Insight-users] Understanding the code of HistogramMatchingImageFilter
Luis Ibanez
luis.ibanez at kitware.com
Wed Jun 17 07:33:35 EDT 2009
HI Dominique,
I may not have enough coffee yet,...
but as far as I can tell from looking at the code
your observation seems to be correct.
It looks like the two table elements are set in
line 194-195:
m_QuantileTable[0][m_NumberOfMatchPoints + 1] = m_SourceMaxValue;
m_QuantileTable[1][m_NumberOfMatchPoints + 1] = m_ReferenceMaxValue;
and their values do not change from there
to the lines 237 and 241 where they are used in
the subtraction.
It seems that "denominator" in line 237 will always
be zero, which prevents the code in lines 241 -243
from execution.
Also, as you pointed out, even if the code in 241-243
where executed, it will still compute m_UpperGradient
as zero, given that
m_QuantileTable[1][m_NumberOfMatchPoints + 1] = m_ReferenceMaxValue;
This seems to be a bug....
Looking at the potential uses of m_UpperGradient,
it is only used for interpolating the histogram points
that are after the Nth matching point. In lines 357-361.
This problem doesn't seem to occur for m_LowerGradient,
which may provide a hint for the solution of the (potential)
bug...
More coffee needed here....
Luis
-------------------------------------------------------------------------
2009/6/16 Dominique Töpfer <dominique at toepfer-web.de>
> Hello,
>
> I have some difficulties understanding the code of the
> HistogramMatchingImageFilter. In the method BeforeThreadedGenerateData()
> m_UpperGradient is set by the following code:
>
> denominator = m_QuantileTable[0][m_NumberOfMatchPoints+1] -
> m_SourceMaxValue;
> if ( denominator != 0)
> {
> m_UpperGradient = m_QuantileTable[1][m_NumberOfMatchPoints+1] -
> m_ReferenceMaxValue;
> m_UpperGradient /= denominator;
> }
> else
> {
> m_UpperGradient = 0.0;
> }
>
>
> But considering
>
> m_QuantileTable[0][m_NumberOfMatchPoints + 1] = m_SourceMaxValue;
> m_QuantileTable[1][m_NumberOfMatchPoints + 1] = m_ReferenceMaxValue;
>
> (same method) m_UpperGradient is always set to 0.0. So why is this variable
> necessary? Did I overlook something?
> Thanks in advance!
>
> Dominique
>
> _____________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the ITK FAQ at:
> http://www.itk.org/Wiki/ITK_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.itk.org/mailman/listinfo/insight-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-users/attachments/20090617/65acc8c5/attachment.htm>
More information about the Insight-users
mailing list