<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
</head>
<body style="word-wrap:break-word; color:rgb(0,0,0); font-size:14px; font-family:Calibri,sans-serif">
<div>
<div>
<div>Brad,</div>
<div><br>
</div>
<div>My opinion is that this has been an issue for many years, and that the cost benefit is not worth trying to squeeze this into this release cycle. &nbsp;The results are (or at least should be) the same both before and after this change.</div>
<div><br>
</div>
<div>The backlog of new features and other performance improvements are beginning to back up on the gerrit dashboard, so I would definitely vote for cutting ITKv4.2 as soon as possible so that all other projects can start moving forward again.</div>
<div><br>
</div>
<div>My guess is that the main culprits of those failing tests are related to following 15 lines of code. &nbsp;</div>
<div>
<div><br>
</div>
<div>==============================</div>
</div>
<div>
<div>johnsonhj@neuron$ git grep &quot;\-&gt;GetInput()\-&gt;GetPixel&quot;</div>
<div>Modules/Filtering/DistanceMap/include/itkSignedMaurerDistanceMapImageFilter.hxx: &nbsp; &nbsp;if ( this-&gt;GetInput()-&gt;GetPixel(idx) != this-&gt;m_BackgroundValue )</div>
<div>Modules/Filtering/ImageGrid/include/itkCyclicShiftImageFilter.hxx: &nbsp; &nbsp;outIt.Set( static_cast&lt; OutputImagePixelType &gt;( this-&gt;GetInput()-&gt;GetPixel( index ) ) );</div>
<div>Modules/Filtering/MathematicalMorphology/include/itkGrayscaleConnectedClosingImageFilter.hxx: &nbsp;seedValue = this-&gt;GetInput()-&gt;GetPixel(m_Seed);</div>
<div>Modules/Filtering/MathematicalMorphology/include/itkGrayscaleConnectedOpeningImageFilter.hxx: &nbsp;seedValue = this-&gt;GetInput()-&gt;GetPixel(m_Seed);</div>
<div>Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.hxx: &nbsp; &nbsp; &nbsp; &nbsp;pixelIntensity = this-&gt;GetInput()-&gt;GetPixel( index );</div>
<div>Modules/Numerics/Statistics/test/itkSubsampleTest.cxx: &nbsp;ArrayPixelImageType::PixelType pixel = filter-&gt;GetInput()-&gt;GetPixel(index);</div>
<div>Modules/Segmentation/Voronoi/include/itkVoronoiPartitioningImageFilter.hxx: &nbsp; &nbsp;getp = (double)( this-&gt;GetInput()-&gt;GetPixel(Plist[i]) );</div>
<div>Modules/Segmentation/Voronoi/include/itkVoronoiSegmentationImageFilter.hxx: &nbsp; &nbsp;getp = (double)( this-&gt;GetInput()-&gt;GetPixel(Plist[i]) );</div>
<div>~/Dashboard/src/ITK (master)</div>
<div><br>
</div>
<div>johnsonhj@neuron$&nbsp;</div>
<div>~/Dashboard/src/ITK (master)</div>
<div>johnsonhj@neuron$ git grep &quot;\-&gt;GetInput()\-&gt;Transform&quot;</div>
<div>Modules/Core/Mesh/include/itkBinaryMask3DMeshSource.hxx: &nbsp; &nbsp; &nbsp;this-&gt;GetInput()-&gt;TransformContinuousIndexToPhysicalPoint(indTemp,new_p);</div>
<div>Modules/Nonunit/Review/include/itkScalarChanAndVeseDenseLevelSetImageFilter.hxx: &nbsp; &nbsp;this-&gt;GetInput()-&gt;TransformPhysicalPointToIndex(origin, start);</div>
<div>Modules/Nonunit/Review/include/itkScalarChanAndVeseSparseLevelSetImageFilter.hxx: &nbsp; &nbsp;this-&gt;GetInput()-&gt;TransformPhysicalPointToIndex(origin, start);</div>
<div>Modules/Nonunit/Review/include/itkStochasticFractalDimensionImageFilter.hxx: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this-&gt;GetInput()-&gt;TransformIndexToPhysicalPoint(It.GetIndex(i), point1);</div>
<div>Modules/Nonunit/Review/include/itkStochasticFractalDimensionImageFilter.hxx: &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;this-&gt;GetInput()-&gt;TransformIndexToPhysicalPoint(It.GetIndex(j), point2);</div>
<div>Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.hxx: &nbsp; &nbsp; &nbsp;this-&gt;GetInput()-&gt;TransformIndexToPhysicalPoint(</div>
<div>Modules/Numerics/Statistics/include/itkScalarImageToRunLengthMatrixFilter.hxx: &nbsp; &nbsp; &nbsp;this-&gt;GetInput()-&gt;TransformIndexToPhysicalPoint( lastGoodIndex, point );</div>
</div>
<div>==============================</div>
<div><br>
</div>
<div>Hans</div>
<div>--&nbsp;</div>
<div>
<div>
<div>
<div>
<div style="font-family:Calibri; font-size:15px"><font face="Arial" size="2"><span style="font-size:10pt">Hans J. Johnson, Ph.D.</span></font></div>
<div style="font-family:Calibri; font-size:15px"><font face="Arial" size="2"><span style="font-size:10pt"><a href="mailto:hans-johnson@uiowa.edu">hans-johnson@uiowa.edu</a></span></font></div>
<div style="font-family:Calibri; font-size:15px"><font face="Arial" size="2"><span style="font-size:10pt">Assistant Professor of Psychiatry</span></font></div>
<div style="font-family:Calibri; font-size:15px"><span class="Apple-style-span" style="font-size:13px; font-family:Arial">University of Iowa Carver College of Medicine</span></div>
<div style="font-family:Calibri; font-size:15px"><font face="Arial" size="2"><span style="font-size:10pt"><span class="Apple-style-span" style="font-family:Calibri; font-size:15px">
<div><span class="Apple-style-span" style="font-size:13px; font-family:Arial">W278 GH, 200 Hawkins Drive</span></div>
</span></span></font></div>
<div style="font-family:Calibri; font-size:15px"><font face="Arial" size="2"><span style="font-size:10pt">Iowa City, Iowa 52242</span></font></div>
<div style="font-family:Calibri; font-size:15px"><font face="Arial" size="2"><span style="font-size:10pt">Phone:&nbsp; 319-353-8587</span></font></div>
</div>
</div>
</div>
</div>
</div>
</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; border-bottom:medium none; border-left:medium none; padding-bottom:0in; padding-left:0in; padding-right:0in; border-top:#b5c4df 1pt solid; border-right:medium none; padding-top:3pt">
<span style="font-weight:bold">From: </span>Bradley Lowekamp &lt;<a href="mailto:blowekamp@mail.nih.gov">blowekamp@mail.nih.gov</a>&gt;<br>
<span style="font-weight:bold">Date: </span>Tuesday, July 3, 2012 9:26 AM<br>
<span style="font-weight:bold">To: </span>ITK &lt;<a href="mailto:insight-developers@itk.org">insight-developers@itk.org</a>&gt;<br>
<span style="font-weight:bold">Cc: </span>&quot;<a href="mailto:Bill@public.kitware.com">Bill@public.kitware.com</a>&quot; &lt;<a href="mailto:Bill@public.kitware.com">Bill@public.kitware.com</a>&gt;, Hans Johnson &lt;<a href="mailto:hans.j.johnson@gmail.com">hans.j.johnson@gmail.com</a>&gt;,
 Luis Ibanez &lt;<a href="mailto:luis.ibanez@kitware.com">luis.ibanez@kitware.com</a>&gt;<br>
<span style="font-weight:bold">Subject: </span>[Insight-developers] Performance Impact of using GetInput<br>
</div>
<div><br>
</div>
<div>
<div style="word-wrap:break-word">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&#43; 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; 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>
</div>
</div>
</span><br>
<br>
<hr>
Notice: This UI Health Care e-mail (including attachments) is covered by the Electronic Communications Privacy Act, 18 U.S.C. 2510-2521, is confidential and may be legally privileged.&nbsp; If you are not the intended recipient, you are hereby notified that any
 retention, dissemination, distribution, or copying of this communication is strictly prohibited.&nbsp; Please reply to the sender that you have received the message in error, then delete it.&nbsp; Thank you.
<hr>
</body>
</html>