[ITK-dev] expectationmaximizationMixtureModelEstimator bug
Wei Liu
weiliu620 at gmail.com
Tue Mar 18 14:03:55 EDT 2014
Dear ITK developers,
I've found that the filter does not work even on the example code [1]. In
this example, there are two Gaussian components defined, but the parameters
of the second component is never updated. The reason is in the
iktExpectationMaximizationMixtureModelEstimator.hxx, the
UpdateComponentParameters function stops early. Here is the code that need
to be changted.
_______________________________
template< typename TSample >
bool
ExpectationMaximizationMixtureModelEstimator< TSample >
::UpdateComponentParameters()
{
bool updated = false;
ComponentType *component;
for ( size_t componentIndex = 0; componentIndex <
m_ComponentVector.size();
++componentIndex )
{
component = m_ComponentVector[componentIndex];
component->Update();
if ( component->AreParametersModified() )
{
// return true;
updated = true;
}
}
return updated;
}
_____________________________________________
We need to change the variable 'updated' instead of 'return true',
otherwise, the remaining components can not get the parameters updated.
After fixed, the example program works.
[1]
http://www.itk.org/Wiki/ITK/Examples/Statistics/ExpectationMaximizationMixtureModelEstimator_2D
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.itk.org/pipermail/insight-developers/attachments/20140318/b940bfb0/attachment.html>
More information about the Insight-developers
mailing list