FYI, I just had a closer look at how the patch I proposed last week, “PERF: Improved speed of copying and resizing NeighborhoodAllocator” http://review.source.kitware.com/#/c/22862/ would affect the performance of ITK’s Hough Transform.
I observed a 10% reduction (approximately) of the duration of filter->Update(), typically going from 50 to 45 seconds, on the following test program, using VS2017, Release, 64-bit:
#include <itkHoughTransform2DCirclesImageFilter.h>
#include <iostream>
#include <ctime>
int main()
{
typedef unsigned char PixelType;
const auto image = itk::Image<PixelType>::New();
enum { sizeX = 4096, sizeY = sizeX };
image->SetRegions({ sizeX, sizeY });
image->Allocate();
image->FillBuffer(1);
const auto filter =
itk::HoughTransform2DCirclesImageFilter<PixelType, unsigned char, double>::New();
filter->SetInput(image);
const auto time1 = std::time(nullptr);
filter->Update();
const auto time2 = std::time(nullptr);
std::cout << "Duration: " << (time2 - time1) << " seconds" << std::endl;
}
HoughTransform2DCirclesImageFilter::GenerateData() indirectly does a lot of Neighborhood allocations, by calling GaussianDerivativeImageFunction::EvaluateAtIndex on each input pixel > Threshold.