From 6b0d4b83376da7adda33f4d9ff5e422817ec3ad2 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Fri, 10 Mar 2023 13:40:22 +0100 Subject: [PATCH] STYLE: Reduce scope ResampleImageFilter::NonlinearThreadedGenerateData Reduced the scope of local `Point` and `ContinuousIndex` variables within `NonlinearThreadedGenerateData`. Note that these variables are very lightweight, so moving their declarations into a `for` loop won't harm the run-time performance. --- .../ImageGrid/include/itkResampleImageFilter.hxx | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/Modules/Filtering/ImageGrid/include/itkResampleImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkResampleImageFilter.hxx index 7503e3ec92d..0080acf1383 100644 --- a/Modules/Filtering/ImageGrid/include/itkResampleImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkResampleImageFilter.hxx @@ -384,24 +384,21 @@ ResampleImageFilter; - // Define a few indices that will be used to translate from an input pixel - // to an output pixel - OutputPointType outputPoint; // Coordinates of current output pixel - InputPointType inputPoint; // Coordinates of current input pixel - - ContinuousInputIndexType inputIndex; - using OutputType = typename InterpolatorType::OutputType; // Walk the output region for (OutputIterator outIt(outputPtr, outputRegionForThread); !outIt.IsAtEnd(); ++outIt) { // Determine the index of the current output pixel + + OutputPointType outputPoint; // Coordinates of current output pixel outputPtr->TransformIndexToPhysicalPoint(outIt.GetIndex(), outputPoint); // Compute corresponding input pixel position - inputPoint = transformPtr->TransformPoint(outputPoint); - const bool isInsideInput = inputPtr->TransformPhysicalPointToContinuousIndex(inputPoint, inputIndex); + const InputPointType inputPoint = transformPtr->TransformPoint(outputPoint); + + ContinuousInputIndexType inputIndex; + const bool isInsideInput = inputPtr->TransformPhysicalPointToContinuousIndex(inputPoint, inputIndex); OutputType value; // Evaluate input at right position and copy to the output