Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ComputeImageExtremaFilter: Remove UseMask property and let it only compute min and max #1046

Merged
merged 2 commits into from
Feb 19, 2024

Conversation

N-Dekker
Copy link
Member

No longer computed the mean, sigma, variance, sum, or sum of squares. Removed m_ThreadSum, m_SumOfSquares, and m_Count. Removed inheritance from StatisticsImageFilter (which computed the mean, sigma, variance, sum, and sum of squares for images without a mask).

ComputeImageExtremaFilter is only being used in elastix by AdvancedImageToImageMetric and AdvancedMeanSquaresImageToImageMetric, and both of them only need to have the minimum and the maximum from ComputeImageExtremaFilter.

A performance improvement of ~8 percent was observed on a 8192x8192 image with mask. Without a mask, the computation appears even more than six times as fast as before.

Assumed that ComputeImageExtremaFilter should use its mask, if and only if the mask is not null.
No longer the mean, sigma, variance, sum, or sum of squares. Removed m_ThreadSum, m_SumOfSquares, and m_Count. Removed inheritance from StatisticsImageFilter (which computed the mean, sigma, variance, sum, and sum of squares for images without a mask).

ComputeImageExtremaFilter is only being used in elastix by AdvancedImageToImageMetric and AdvancedMeanSquaresImageToImageMetric, and both of them only need to have the minimum and the maximum from ComputeImageExtremaFilter.

A performance improvement of ~8 percent was observed, from more than 0.13 sec. (before this commit) to less than 0.12 sec., on a 8192x8192 image with mask. Without a mask, the computation appears even more than six times as fast as before, from more than 0.25 sec. (before this commit) to less than 0.04 sec. (after this commit), on a 16384x16384 image. Using Visual Studio 2022 (Release).
@N-Dekker
Copy link
Member Author

For the sake of time, I will just merge now, because I think it's OK. And it yields a significant performance improvement 😃

@N-Dekker N-Dekker merged commit 76b082d into main Feb 19, 2024
8 checks passed
@N-Dekker N-Dekker deleted the ComputeImageExtremaFilter-UseMask branch February 19, 2024 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant