<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Hello!</div><div><br></div><div>I have run into a couple small bug in ITK and posted the problems and solution, but I have not seen the fixes make it into the repository. Is there a better way to do post fixes then I have been? Should I post diffs?</div><div><br></div><div>I have discovered a divide by zero error in the CovarianceCalculator classes:</div><div><br></div><div>Something to the effect of:</div><div><div><br></div><div>if (frequency == 0) {</div><div>&nbsp;++iter;<br></div><div>&nbsp;continue;</div><div>}</div><div><br></div><div>needs to be added early on in this loop in the&nbsp;CovarianceCalculator::ComputeCovarianceWithoutGivenMean method.&nbsp;</div><div><br></div><div><br></div><div><div>&nbsp;//</div><div>&nbsp;// fills the lower triangle and the diagonal cells in the covariance matrix</div><div>&nbsp;&nbsp;while (iter != end)</div><div>&nbsp;&nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp;frequency = iter.GetFrequency() ;</div><div>&nbsp;&nbsp; &nbsp;totalFrequency += frequency ;</div><div>&nbsp;&nbsp; &nbsp;measurements = iter.GetMeasurementVector() ;</div><div>&nbsp;&nbsp; &nbsp;for ( i = 0 ; i &lt; measurementVectorSize ; ++i )</div><div>&nbsp;&nbsp; &nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp; &nbsp;diff[i] = measurements[i] - (*m_InternalMean)[i] ;</div><div>&nbsp;&nbsp; &nbsp; &nbsp;}</div><div><br></div><div>&nbsp;&nbsp; &nbsp;// updates the mean vector</div><div>&nbsp;&nbsp; &nbsp;double tempWeight = frequency / totalFrequency ;</div><div>&nbsp;&nbsp; &nbsp;for ( i = 0 ; i &lt; measurementVectorSize ; ++i )</div><div>&nbsp;&nbsp; &nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp; &nbsp;(*m_InternalMean)[i] += tempWeight * diff[i] ;</div><div>&nbsp;&nbsp; &nbsp; &nbsp;}</div><div><br></div><div>&nbsp;&nbsp; &nbsp;// updates the covariance matrix</div><div>&nbsp;&nbsp; &nbsp;tempWeight = tempWeight * ( totalFrequency - frequency ) ;</div><div>&nbsp;&nbsp; &nbsp;for ( row = 0; row &lt; measurementVectorSize ; row++ )</div><div>&nbsp;&nbsp; &nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp; &nbsp;for ( col = 0; col &lt; row + 1 ; col++)</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;{</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;m_Output(row,col) +=&nbsp;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;tempWeight * diff[row] * diff[col] ;</div><div>&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;}</div><div>&nbsp;&nbsp; &nbsp; &nbsp;}</div><div>&nbsp;&nbsp; &nbsp;++iter ;</div><div>&nbsp;&nbsp; &nbsp;}</div></div><div><br></div><div>The&nbsp;itkWeightedCovarianceCalculator class looks like it has this bug as well but in two places in&nbsp;similar&nbsp;loops.</div><div><br></div><div><br></div><div><br></div><div>Secondly,&nbsp;the method CannyEdgeDetectionImageFilter::SetMaximumError &nbsp;has a small mistake in it. It looks like it should be checking to see if the value v is different the the current value before setting it.</div><div><br></div><div>if (m_Variance[i] != v)</div><div><br></div><div>should be:</div><div><br></div><div>if (m_MaximumError[i] != v)<br><br>Thank,<br>Brad</div><div><br></div></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">========================================================</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Bradley Lowekamp<span class="Apple-converted-space">&nbsp;</span><span class="Apple-converted-space">&nbsp;</span></font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font class="Apple-style-span" face="Arial"><span class="Apple-style-span" style="font-family: Arial; "><span class="Apple-style-span" style="font-family: Arial; ">Lockheed Martin&nbsp;</span></span></font><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Contractor for</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">Office of High Performance Computing and Communications</font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica">National Library of Medicine<span class="Apple-converted-space">&nbsp;</span></font></p><p style="margin: 0.0px 0.0px 0.0px 0.0px"><font face="Helvetica" size="3" style="font: 12.0px Helvetica"><a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a></font></p><br class="Apple-interchange-newline"></span></div></span> </div><br></body></html>