For your information, we have just achieved a significant performance improvement!
With the latest ITK master branch revision (commit PERF: Make `m_ObjectToWorldTransformInverse->TransformPoint` non-virtual · InsightSoftwareConsortium/ITK@4ae04b3 · GitHub) a SpatialObject.IsInsideInWorldSpace(point)
call will be much faster than before! I observed that it has become approximately twice as fast, compared to the last ITK release (v5.3.0), or even the latest release candidate (v5.4rc02)
The performance improvement was achieved by three pull requests that I did, which were reviewed by @Stephen_Aylward @dzenanz and @hjmjohnson, and merged in the last few days:
- PERF: Let SpatialObject directly access m_ObjectToWorldTransformInverse #4435
- PERF: Add SpatialObject IsInsideInWorldSpace(const PointType &) overload #4440
- PERF: Make
m_ObjectToWorldTransformInverse->TransformPoint
non-virtual #4441
As SpatialObject.IsInsideInWorldSpace(point)
is often called repeatedly over a large range of points (typically inside a for
or a while
loop), I expect a significant performance improvement for various filters, metric calculations, and registration algorithms. Especially when they involve image masks. Specifically, I would expect a performance improvement for:
- SpatialObjectToImageStatisticsCalculator
- DiffusionTensor3DReconstructionImageFilter
- ImageMomentsCalculator
- HistogramImageToImageMetric
- ImageToImageMetric
- KappaStatisticImageToImageMetric
- MatchCardinalityImageToImageMetric
- MattesMutualInformationImageToImageMetric
- MeanReciprocalSquareDifferenceImageToImageMetric
- MutualInformationImageToImageMetric
- NormalizedCorrelationImageToImageMetric
- JointHistogramMutualInformationImageToImageMetricv4
- MattesMutualInformationImageToImageMetricv4
- ImageRegistrationMethodv4
Please have a look and try it out! I’m interested to hear if you see any performance improvement in your use case!