<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi,<div><br></div><div>If I'm not wrong the EM has n Models (GaussianMixtureModel). The EM class use the Model to create the pdf according to the Membership function of the model (GaussianMembershipFunction class). Also, the MixtureModel is who update the parameters of the model using the WeightedMean (i.e the mean estimator). Inside the class GaussianMixtureModel, in the method GenerateData the WeightedMean estimator is called (m_MeanEstimator->Update()).</div><div><br></div><div><div><br></div><div><br></div><div><div><div><div><div><div apple-content-edited="true"><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-style: normal; font-weight: normal; font-size: medium; font-family: Helvetica; color: rgb(0, 0, 0); "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; color: rgb(0, 0, 0); font-family: Helvetica; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; font-size: medium; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; font-variant: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; -webkit-border-vertical-spacing: 0px; -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; "><div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; "><div style="color: rgb(0, 0, 0); font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; ">__________________________________<br><font class="Apple-style-span" color="#b7bfc5">|</font> Ariel Hernán Curiale Ph.D Student<br><font class="Apple-style-span" color="#b7bfc5">|</font> ETSI Telecomunicación<br><font class="Apple-style-span" color="#b7bfc5">|</font> Universidad de Valladolid<br><font class="Apple-style-span" color="#b7bfc5">|</font> Campus Miguel Delibes<br><font class="Apple-style-span" color="#b7bfc5">|</font> 47011 Valladolid, Spain<br><font class="Apple-style-span" color="#b7bfc5">|</font> Phone: 983-423000 ext. 5590</div><div><font class="Apple-style-span" color="#b7b7b7" style="font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; ">|</font> Web: <a href="http://www.curiale.com.ar/"><font class="Apple-style-span" color="#084ebe">www.curiale.com.ar</font></a><br><font class="Apple-style-span" color="#b7b7b7" style="font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; ">|</font><span class="Apple-style-span" style="font-family: Helvetica; font-size: medium; font-weight: normal; font-style: normal; color: rgb(0, 0, 0); ">_________________________________</span></div></div></div></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></div></span></span>
</div>
<br><div><div>El 18/07/2013, a las 18:12, <a href="mailto:smrolfe@u.washington.edu">smrolfe@u.washington.edu</a> escribió:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Hello,<br><br>I am trying to resolve the error described below in my implementation of the ExpectationMaximizationMixtureModelEstimator for a 3D data set. I'm trying to find out the relationship between the ExpectationMaximizationMixtureModelEstimator and the WeightedMeanSampleFilter. I read through the source code and it is not explicitly called in the .hxx file. If you have any leads on the use of this filter, please let me know.<br><br>Thanks,<br>Sara<br><br><blockquote type="cite">On Mon, 1 Jul 2013, <a href="mailto:smrolfe@u.washington.edu">smrolfe@u.washington.edu</a> wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Hello,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I am using the ExpectationMaximizationMixtureModelEstimator filter to estimate a mixture model from a set of observations. I am closely following the example<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">ExpectationMaximizationMixtureModelEstimator_2D.cxx<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">When I run the program, I am getting the error:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Description: itk::ERROR: WeightedMeanSampleFilter(00000000038A66C0): Total weight was too close to zero. Value = 0<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">It looks like this filter computes the mean of a set of weighted measurement vectors, but I'm not clear on what might cause the total weight to be zero. I'd appreciate any thoughts.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">An excerpt of my code is below.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Thanks!<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Sara<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">typedef itk::Array< double > ParametersType;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">typedef itk::Statistics::GaussianMixtureModelComponent< SampleType > ComponentType;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">typedef itk::Statistics::ExpectationMaximizationMixtureModelEstimator< SampleType > EstimatorType;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">SampleType::Pointer sample = SampleType::New();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">for (int pointIter = 0; pointIter < pointArray[i].size(); pointIter++){ //put all points in current histogram bin in the sample vector<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> sample->PushBack( pointArray[i][pointIter] ); //pointArray[i] is a vector of measurement vectors<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">int distributionNumber = initialParameters.meanVectors[i].size();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">int paramNumber = (MeasurementVectorLength)+(MeasurementVectorLength*MeasurementVectorLength);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">ParametersType params( paramNumber );<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">std::vector< ParametersType > inputParameters( distributionNumber );<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">itk::Array< double > initialProportions(distributionNumber);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">for(int j = 0; j < distributionNumber; j++){ // for each distribution in initial estimate<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">initialProportions[j] = initialParameters.subHistogram[i][j]; // set initial proportions to the sub-bin size<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">for(int k = 0; k < MeasurementVectorLength; k++){ // assign values in distribution parameter matrix<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">params[k] = initialParameters.meanVectors[i][j][k];<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">int paramCount = MeasurementVectorLength;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">for(int l=0; l < MeasurementVectorLength; l++){<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">for(int m=0; m < MeasurementVectorLength; m++){<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">params[paramCount] = initialParameters.covarianceMats[i][j][l][m];<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">paramCount++;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">inputParameters[j] = params; // push parameters for current distribution into parameter vector<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">std::vector< ComponentType::Pointer > components; // Create the Gausian model components<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">for ( unsigned int k = 0 ; k < distributionNumber ; k++ ){<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">components.push_back( ComponentType::New() );<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">(components[k])->SetSample( sample );<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">(components[k])->SetParameters( inputParameters[k] );<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">EstimatorType::Pointer estimator = EstimatorType::New(); // set up estimator for bin i<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">estimator->SetSample( sample );<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">estimator->SetMaximumIteration( 200 );<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">estimator->SetInitialProportions( initialProportions );<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">for ( unsigned int k = 0 ; k < distributionNumber ; k++){<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">estimator->AddComponent( (ComponentType::Superclass*)(components[k]).GetPointer() );<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">}<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">try{<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">estimator->Update();<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">}catch( itk::ExceptionObject & err ){<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">std::cerr << "ExceptionObject caught !" << std::endl;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">std::cerr << err << std::endl;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">}<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><br>_____________________________________<br>Powered by <a href="http://www.kitware.com">www.kitware.com</a><br><br>Visit other Kitware open-source projects at<br><a href="http://www.kitware.com/opensource/opensource.html">http://www.kitware.com/opensource/opensource.html</a><br><br>Kitware offers ITK Training Courses, for more information visit:<br>http://www.kitware.com/products/protraining.php<br><br>Please keep messages on-topic and check the ITK FAQ at:<br>http://www.itk.org/Wiki/ITK_FAQ<br><br>Follow this link to subscribe/unsubscribe:<br>http://www.itk.org/mailman/listinfo/insight-users<br></div></blockquote></div><br></div></div></div></div></div></div></body></html>