<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hello,<div><br></div><div>A user yesterday, was reporting that going from ITK 3.20 to ITK 4.1, the SignedMaurerDistanceMapImageFilter was running more that 2x-3x the time. With a little bit of poking around and sampling the run time, I was able to develop the following patch:</div><div><br></div><div><a href="http://review.source.kitware.com/#/c/6367/">http://review.source.kitware.com/#/c/6367/</a></div><div><br></div><div>I find that difference to be quite significant difference, and is on the level of a bug.</div><div><br></div><div>The lead me to wonder how wide spread is this incorrect usage. So I added an atomic counter to the GetInput, and GetOutput methods, and when they exceed a threshold, an exception is throw. This is to detect when these methods may be used in an inner loop.</div><div><br></div><div><a href="http://review.source.kitware.com/#/c/6369/">http://review.source.kitware.com/#/c/6369/</a></div><div><br></div><div><br></div><div>I get the following test failure (where previously there was none):</div><div><br></div><div><div><br></div><div>97% tests passed, 71 tests failed out of 2382</div></div><div><br></div><div><div>The following tests FAILED:</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>160 - itkN4BiasFieldCorrectionImageFilterTest1 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>161 - itkN4BiasFieldCorrectionImageFilterTest2 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>311 - itkMultiThreaderEnvTest88 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>313 - itkMultiThreaderEnvTest123 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>398 - itkFFTConvolutionImageFilterTest4x4Mean (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>399 - itkFFTConvolutionImageFilterTest4x5Mean (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>400 - itkFFTConvolutionImageFilterTest5x5Mean (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>401 - itkFFTConvolutionImageFilterTest4x4MeanValidRegion (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>402 - itkFFTConvolutionImageFilterTest4x5MeanValidRegion (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>403 - itkFFTConvolutionImageFilterTest5x5MeanValidRegion (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>420 - itkRichardsonLucyDeconvolutionImageFilterGaussianKernelTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>421 - itkRichardsonLucyDeconvolutionImageFilterIrregularKernelTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>422 - itkLandweberDeconvolutionImageFilterGaussianKernelTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>423 - itkLandweberDeconvolutionImageFilterIrregularKernelTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>425 - itkProjectedLandweberDeconvolutionImageFilterGaussianKernelTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>426 - itkProjectedLandweberDeconvolutionImageFilterIrregularKernelTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>427 - itkInverseDeconvolutionImageFilterGaussianKernelTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>428 - itkInverseDeconvolutionImageFilterIrregularKernelTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>429 - itkTikhonovDeconvolutionImageFilterGaussianKernelTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>430 - itkTikhonovDeconvolutionImageFilterIrregularKernelTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>431 - itkWienerDeconvolutionImageFilterGaussianKernelTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>432 - itkWienerDeconvolutionImageFilterIrregularKernelTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>433 - itkParametricBlindLeastSquaresDeconvolutionImageFilterTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>436 - itkDeformableSimplexMesh3DBalloonForceFilterTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>440 - itkPatchBasedDenoisingImageFilterTest0 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>441 - itkPatchBasedDenoisingImageFilterTestGaussian (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>442 - itkPatchBasedDenoisingImageFilterTestRician (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>443 - itkPatchBasedDenoisingImageFilterTestPoisson (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>521 - itkDisplacementFieldToBSplineImageFilterTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>524 - itkContourMeanDistanceImageFilterTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>525 - itkContourDirectedMeanDistanceImageFilterTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>530 - itkHausdorffDistanceImageFilterTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>532 - itkSignedMaurerDistanceMapImageFilterTest1 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>533 - itkSignedMaurerDistanceMapImageFilterTest2 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>656 - itkFastMarchingImageFilterTest_torus_multipleSeeds_NoTopo (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>657 - itkFastMarchingImageFilterTest_torus_multipleSeeds_StrictTopo (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>658 - itkFastMarchingImageFilterTest_torus_multipleSeeds_NoHandlesTopo (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>659 - itkFastMarchingImageFilterTest_wm_multipleSeeds_NoTopo (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>660 - itkFastMarchingImageFilterTest_wm_multipleSeeds_StrictTopo (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>661 - itkFastMarchingImageFilterTest_wm_multipleSeeds_NoHandlesTopo (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1072 - itkBSplineControlPointImageFilterTest2 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1079 - itkCyclicShiftImageFilterTest0 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1080 - itkCyclicShiftImageFilterTest1 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1081 - itkCyclicShiftImageFilterTest2 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1082 - itkCyclicShiftImageFilterTest3 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1083 - itkCyclicShiftImageFilterTest4 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1084 - itkCyclicShiftImageFilterTest5 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1085 - itkCyclicShiftImageFilterTest6 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1195 - itkModulusImageFilterTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1377 - itkExtensionVelocitiesImageFilterTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1378 - itkCannySegmentationLevelSetImageFilterTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1412 - itkTwoLevelSetsv4DenseImage2DTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1471 - itkSimplexMeshVolumeCalculatorTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1659 - itkBinaryMask3DQuadEdgeMeshSourceTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1747 - itkPointSetToPointSetRegistrationTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1774 - itkDiffeomorphicDemonsRegistrationFilterTest01 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1775 - itkDiffeomorphicDemonsRegistrationFilterTest02 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1776 - itkDiffeomorphicDemonsRegistrationFilterTest03 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1777 - itkDiffeomorphicDemonsRegistrationFilterTest04 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1778 - itkDiffeomorphicDemonsRegistrationFilterTest05 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1779 - itkDiffeomorphicDemonsRegistrationFilterTest06 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1780 - itkDiffeomorphicDemonsRegistrationFilterTest07 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1781 - itkDiffeomorphicDemonsRegistrationFilterTest08 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1782 - itkDiffeomorphicDemonsRegistrationFilterTest09 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1783 - itkDiffeomorphicDemonsRegistrationFilterTest10 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1784 - itkDiffeomorphicDemonsRegistrationFilterTest11 (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>1802 - itkFastSymmetricForcesDemonsRegistrationFilterTest (Failed)</div><div><span class="Apple-tab-span" style="white-space:pre">        </span>2166 - itkVoronoiSegmentationImageFilterTest (Failed)</div></div><div><br></div><div><br></div><div>How big of a deal if most of the filters here are running 2x+ slower then what they should be? Is it big enough to delay the Release and do another RC with the fixes?</div><div><br></div><div>I have also been looking at the methods used in GetInput, specifically the methods used to create the std::string... It seems to be if we change the return value to a const std::string &amp;, then we could keep a static internal table of the common value and return reference to the static table to even, references to what is in the std::map, the would reduce the need for mallocs for std::string.</div><div><br></div><div>Thoughts on what to do?</div><div><br></div><div>Brad</div><div><br><div>
<div style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; font-size: 12px; "><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">========================================================</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Bradley Lowekamp<span class="Apple-converted-space">&nbsp;</span><span class="Apple-converted-space">&nbsp;</span></font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Medical Science and Computing for</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">Office of High Performance Computing and Communications</font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; ">National Library of Medicine<span class="Apple-converted-space">&nbsp;</span></font></p><p style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><font face="Helvetica" size="3" style="font: normal normal normal 12px/normal Helvetica; "><a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a></font></p><br class="Apple-interchange-newline"></div><br class="Apple-interchange-newline">
</div>
<br></div></body></html>