Skip to content

COMP: Use ComputeIndex() in InvertDisplacementField GTest (CDash nightly fix) - #7245

Merged
hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:comp-invert-gtest-computeindex
Nov 26, 2026
Merged

hjmjohnson merged 1 commit into
InsightSoftwareConsortium:mainfrom
hjmjohnson:comp-invert-gtest-computeindex

Conversation

@hjmjohnson

Copy link
Copy Markdown
Member

Fix the CDash nightly build errors and warnings from the GTest added in #7212 (bdaf110): replace the deprecated ImageIterator::GetIndex() with ComputeIndex().
Merge danger: two-way door; one line in a test.

What CDash shows (nightly 2026-11-26)

itkInvertDisplacementFieldImageFilterGTest.cxx:77 calls GetIndex() on an ImageRegionConstIterator. That method is deprecated (2b7c077, February 2026) and compiled out under ITK_FUTURE_LEGACY_REMOVE.

Builds Result
7 Mac -dbg builds (RogueResearch), e.g. Mac11.x-AppleClang-dbg 2 errors: no member named 'GetIndex' in 'itk::ImageRegionConstIterator<...>'
4 Ubuntu gcc13.3 builds, e.g. TBB-Debug -Wdeprecated-declarations
5 Windows VS builds, e.g. VS2022-Static-Release C4996

PR CI does not build with ITK_FUTURE_LEGACY_REMOVE, so #7212 was green. Line 46's GetIndex() is on an ImageRegionIteratorWithIndex, where it is not deprecated.

Evidence

Syntax-only compile of the test with -DITK_FUTURE_LEGACY_REMOVE (Homebrew clang):

  • before: itkInvertDisplacementFieldImageFilterGTest.cxx:77:53: error: no member named 'GetIndex' in 'itk::ImageRegionConstIterator<itk::Image<itk::Vector<float>, 3>>'
  • after: no errors, no warnings

Default build: ninja ITKDisplacementFieldGTestDriver, then ctest -R InvertDisplacementField: 5/5 passed. pre-commit run --all-files passes.

AI assistance
  • Tool: Claude Code (claude-opus-5-5)
  • Role: triaged the CDash nightly, traced the error to the commit, and ran the local checks
  • Reviewed by the author

ImageIterator::GetIndex() is deprecated and is absent when
ITK_FUTURE_LEGACY_REMOVE is ON, so the test added in bdaf110 fails
to compile on the CDash Mac debug nightlies (2026-11-26):

  itkInvertDisplacementFieldImageFilterGTest.cxx:77:53: error: no member
  named 'GetIndex' in 'itk::ImageRegionConstIterator<...>'

The same line warns on the Linux (-Wdeprecated-declarations) and
Windows (C4996) nightlies.
@github-actions github-actions Bot added type:Compiler Compiler support or related warnings type:Testing Ensure that the purpose of a class is met/the results on a wide set of test cases are correct area:Filtering Issues affecting the Filtering module labels Nov 26, 2026
@dzenanz
dzenanz marked this pull request as ready for review November 26, 2026 17:22
@greptile-apps

greptile-apps Bot commented Nov 26, 2026 •

Copy link
Copy Markdown
Contributor

Confidence Score: 5/5 · This change appears safe to merge.RetriggerView in GreptileConfidence Score: 5/5

[Low impact] This change appears safe to merge.

Summary

Replaces deprecated GetIndex() with ComputeIndex() in the test’s failure message.

  • The image comparison test gets mismatch coordinates through the supported iterator call.

Reviews (1) · Last reviewed commit: "COMP: Use ComputeIndex() in InvertDispla..." · Reviewed by Greptile

@hjmjohnson
hjmjohnson merged commit 4b165ce into InsightSoftwareConsortium:main Nov 26, 2026
16 of 18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area:Filtering Issues affecting the Filtering module type:Compiler Compiler support or related warnings 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.

2 participants