elastix icon indicating copy to clipboard operation
elastix copied to clipboard

AdvancedImageToImageMetric, AdvancedMeanSquaresImageToImageMetric estimating min and max twice, redundantly

Open N-Dekker opened this issue 1 year ago • 0 comments

Both AdvancedImageToImageMetric::Initialize() and AdvancedImageToImageMetric::InitializeLimiters() use ComputeImageExtremaFilter to estimate the minimum and the maximum pixel value of the fixed and the moving image. Now the first member function also calls the second one, indirectly, causing the expensive ComputeImageExtremaFilter to be executed more than necessary.

Looking back at commit 592608ce7279551ff0e3fc35cc60bfdc4eacfe11 (January 15, 2018), it looks like it it that way already for a while:

https://github.com/SuperElastix/elastix/blob/592608ce7279551ff0e3fc35cc60bfdc4eacfe11/Common/CostFunctions/itkAdvancedImageToImageMetric.hxx#L276-L277

https://github.com/SuperElastix/elastix/blob/592608ce7279551ff0e3fc35cc60bfdc4eacfe11/Components/Metrics/AdvancedMeanSquares/itkAdvancedMeanSquaresImageToImageMetric.hxx#L94-L95

While AdvancedMeanSquaresImageToImageMetric::Initialize() also calling AdvancedImageToImageMetric::Initialize():

https://github.com/SuperElastix/elastix/blob/592608ce7279551ff0e3fc35cc60bfdc4eacfe11/Components/Metrics/AdvancedMeanSquares/itkAdvancedMeanSquaresImageToImageMetric.hxx#L68

N-Dekker avatar Feb 16 '24 16:02 N-Dekker