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

PERF: Add SpatialObject IsInsideInWorldSpace(const PointType &) overload #4440

Conversation

N-Dekker
Copy link
Contributor

@N-Dekker N-Dekker commented Jan 31, 2024

A performance improvement of more than 35% was observed, from more than 0.62 sec. to less than 0.38 sec. when calling IsInsideInWorldSpace(point) 2^25 times, using VS2022 Release.


Of course, this may yield a performance improvement for all classes that call IsInsideInWorldSpace(point), including:

  • SpatialObjectToImageStatisticsCalculator
  • DiffusionTensor3DReconstructionImageFilter
  • ImageMomentsCalculator
  • HistogramImageToImageMetric
  • ImageToImageMetric
  • KappaStatisticImageToImageMetric
  • MatchCardinalityImageToImageMetric
  • MattesMutualInformationImageToImageMetric
  • MeanReciprocalSquareDifferenceImageToImageMetric
  • MutualInformationImageToImageMetric
  • NormalizedCorrelationImageToImageMetric
  • JointHistogramMutualInformationImageToImageMetricv4
  • MattesMutualInformationImageToImageMetricv4
  • ImageRegistrationMethodv4

A performance improvement of more than 35% was observed, from more than 0.62
sec. to less than 0.38 sec. when calling IsInsideInWorldSpace(point) 2^25 times,
using VS2022 Release.
@github-actions github-actions bot added type:Performance Improvement in terms of compilation or execution time type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Core Issues affecting the Core module labels Jan 31, 2024
@N-Dekker N-Dekker requested a review from aylward January 31, 2024 17:14
@N-Dekker N-Dekker marked this pull request as ready for review January 31, 2024 17:14
Copy link
Member

@aylward aylward left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@dzenanz dzenanz merged commit 2ca2351 into InsightSoftwareConsortium:master Feb 1, 2024
12 checks passed
N-Dekker added a commit to SuperElastix/elastix that referenced this pull request Apr 9, 2024
Upgraded ITK on the CI to version 5.4rc03: https://github.com/InsightSoftwareConsortium/ITK/releases/tag/v5.4rc03 (commits from 2023-10-10 to 2024-04-04: InsightSoftwareConsortium/ITK@v5.4rc02...v5.4rc03)

Including major performance improvements of `SpatialObject.IsInsideInWorldSpace(point)`:
 * InsightSoftwareConsortium/ITK#4435 "Let SpatialObject directly access m_ObjectToWorldTransformInverse"
 * InsightSoftwareConsortium/ITK#4440 "Add SpatialObject IsInsideInWorldSpace(const PointType &) overload"
 * InsightSoftwareConsortium/ITK#4441 "Make `m_ObjectToWorldTransformInverse->TransformPoint` non-virtual"
 * InsightSoftwareConsortium/ITK#4450 "Let `ImageSpatialObject` update the image regions of its base class, let `ImageMaskSpatialObject` use these image regions"

Follow-up to pull request #982 commit 5f0940d
N-Dekker added a commit to SuperElastix/elastix that referenced this pull request Apr 9, 2024
Upgraded ITK on the CI to version 5.4rc03: https://github.com/InsightSoftwareConsortium/ITK/releases/tag/v5.4rc03 (commits from 2023-10-10 to 2024-04-04: InsightSoftwareConsortium/ITK@v5.4rc02...v5.4rc03)

Including major performance improvements of `SpatialObject.IsInsideInWorldSpace(point)`:
 * InsightSoftwareConsortium/ITK#4435 "Let SpatialObject directly access m_ObjectToWorldTransformInverse"
 * InsightSoftwareConsortium/ITK#4440 "Add SpatialObject IsInsideInWorldSpace(const PointType &) overload"
 * InsightSoftwareConsortium/ITK#4441 "Make `m_ObjectToWorldTransformInverse->TransformPoint` non-virtual"
 * InsightSoftwareConsortium/ITK#4450 "Let `ImageSpatialObject` update the image regions of its base class, let `ImageMaskSpatialObject` use these image regions"

Follow-up to pull request #982 commit 5f0940d
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Core Issues affecting the Core module type:Performance Improvement in terms of compilation or execution time type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants