Skip to content

Commit f431686

Browse files
committed
COMP: Use ImageRegionIteratorWithIndex for SSIM output (legacy-removed)
The output iterator in StructuralSimilarityImageFilter was a plain ImageRegionIterator and the per-pixel loop called outIt.GetIndex() to test interior-region membership for the mean accumulator. The GetIndex() method on the index-less iterator is wrapped in ITK_FUTURE_LEGACY_REMOVE and emits a deprecation warning that CI's Linux legacy-removed build promotes to an error. Switch the output iterator to ImageRegionIteratorWithIndex so the index is tracked natively, eliminating the deprecation entirely.
1 parent 46fabd3 commit f431686

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Modules/Filtering/ImageCompare/include/itkStructuralSimilarityImageFilter.hxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#include "itkDiscreteGaussianImageFilter.h"
2323
#include "itkImage.h"
2424
#include "itkImageRegionConstIterator.h"
25-
#include "itkImageRegionIterator.h"
25+
#include "itkImageRegionIteratorWithIndex.h"
2626
#include "itkMath.h"
2727
#include "itkMultiplyImageFilter.h"
2828
#include "itkProgressReporter.h"
@@ -259,7 +259,11 @@ StructuralSimilarityImageFilter<TInputImage, TOutputImage>::GenerateData()
259259
this->GetMultiThreader()->template ParallelizeImageRegion<ImageDimension>(
260260
outputRegion,
261261
[&](const OutputImageRegionType & subRegion) {
262-
using OutputIteratorType = ImageRegionIterator<OutputImageType>;
262+
// Use ImageRegionIteratorWithIndex for the output so we can call
263+
// GetIndex() inside the inner loop without hitting the
264+
// ITK_LEGACY_REMOVE deprecation on the index-less iterator's
265+
// GetIndex() (#6034 CI fix).
266+
using OutputIteratorType = ImageRegionIteratorWithIndex<OutputImageType>;
263267
using RealConstIteratorType = ImageRegionConstIterator<RealImageType>;
264268

265269
OutputIteratorType outIt(output, subRegion);

0 commit comments

Comments
 (0)