From b96bd5749c9a73e58c8e7c5ef345eabf0e3c177e Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Wed, 27 Dec 2023 18:50:50 +0100 Subject: [PATCH 1/3] STYLE: Use ImageRegion `auto [index, size] = region` structured bindings Replaced initializations of the form: SizeType size = region.GetSize(); IndexType index = region.GetIndex(); By using structured binding of the form `auto [index, size] = region`, as was introduced by pull request https://github.com/InsightSoftwareConsortium/ITK/pull/4367 commit 72aa9a602bd92b665acc915d8df4bd00a27c98f0 "ENH: `ImageRegion` support C++17 structured binding" Did so by Notepad++ Replace in Files, using regular expressions: Find what: ^([ ]+)const (.*)\w.+[ ]+(\w+) = (.+)\.GetIndex\(\);\r\n\1const \2\w+[ ]+(\w+) = \4\.GetSize\(\);$ Replace with: $1const auto [$3, $5] = $4; Find what: ^([ ]+)const (.*)\w.+[ ]+(\w+) = (.+)\.GetSize\(\);\r\n\1const \2\w+[ ]+(\w+) = \4\.GetIndex\(\);$ Replace with: $1const auto [$5, $3] = $4; Find what: ^([ ]+)(.*)\w.+[ ]+(\w+) = (.+)\.GetIndex\(\);\r\n\1\2\w+[ ]+(\w+) = \4\.GetSize\(\);$ Replace with: $1auto [$3, $5] = $4; Find what: ^([ ]+)(.*)\w.+[ ]+(\w+) = (.+)\.GetSize\(\);\r\n\1\2\w+[ ]+(\w+) = \4\.GetIndex\(\);$ Replace with: $1auto [$5, $3] = $4; Manually added `const` to bindings in `SetBound(const SizeType &)` member functions, excluded `ImageIORegion`, and removed `Index` and `Size` type aliases that are no longer used after this commit. --- .../Bridge/VTK/include/itkVTKImageExport.hxx | 6 ++--- .../Bridge/VTK/include/itkVTKImageImport.hxx | 3 +-- .../include/itkConstNeighborhoodIterator.hxx | 9 +++---- ...ConstNeighborhoodIteratorWithOnlyIndex.hxx | 11 +++----- .../include/itkNeighborhoodAlgorithm.hxx | 6 ++--- .../include/itkPeriodicBoundaryCondition.hxx | 9 +++---- .../itkZeroFluxNeumannBoundaryCondition.hxx | 9 +++---- .../include/itkGPUImageDataManager.hxx | 3 +-- .../itkGaussianInterpolateImageFunction.hxx | 3 +-- ...atialObjectToImageStatisticsCalculator.hxx | 7 +++-- .../itkMRIBiasFieldCorrectionFilter.hxx | 6 ++--- .../include/itkConvolutionImageFilterBase.hxx | 3 +-- .../include/itkFFTConvolutionImageFilter.hxx | 13 ++++------ ...ssianExponentialDiffeomorphicTransform.hxx | 3 +-- ...hingOnUpdateDisplacementFieldTransform.hxx | 3 +-- ...pdateTimeVaryingVelocityFieldTransform.hxx | 4 +-- .../itkInvertDisplacementFieldImageFilter.hxx | 5 ++-- ...ingVelocityFieldIntegrationImageFilter.hxx | 3 +-- .../itkSignedMaurerDistanceMapImageFilter.hxx | 3 +-- .../itkHalfToFullHermitianImageFilter.hxx | 6 ++--- ...alToHalfHermitianForwardFFTImageFilter.hxx | 3 +-- ...lfHermitianToRealInverseFFTImageFilter.hxx | 6 ++--- .../itkMaskFeaturePointSelectionFilter.hxx | 3 +-- ...TLayoutImageRegionConstIteratorWithIndex.h | 3 +-- .../ImageGrid/include/itkCropImageFilter.hxx | 3 +-- .../include/itkCyclicShiftImageFilter.hxx | 3 +-- .../include/itkMirrorPadImageFilter.hxx | 17 +++++------- .../include/itkSliceBySliceImageFilter.hxx | 3 +-- .../itkZeroFluxNeumannPadImageFilterTest.cxx | 9 +++---- .../include/itkAccumulateImageFilter.hxx | 3 +-- .../include/itkProjectionImageFilter.hxx | 6 ++--- .../include/itkCropLabelMapFilter.hxx | 3 +-- .../LabelMap/include/itkPadLabelMapFilter.hxx | 3 +-- .../include/itkSharedMorphologyUtilities.hxx | 26 +++++++------------ .../include/itkBinomialBlurImageFilter.hxx | 3 +-- .../test/itkGDCMImageReadSeriesWriteTest.cxx | 3 +-- ...eWriterUpdateLargestPossibleRegionTest.cxx | 3 +-- ...ourierReconstructionImageToImageFilter.hxx | 9 +++---- ...screteHessianGaussianImageFunctionTest.cxx | 3 +-- .../test/itkNarrowBandImageFilterBaseTest.cxx | 3 +-- .../include/itkSpatialNeighborSubsampler.hxx | 3 +-- ...UniformRandomSpatialNeighborSubsampler.hxx | 3 +-- ...MultiResolutionImageRegistrationMethod.hxx | 3 +-- .../itkMultiResolutionPyramidImageFilter.hxx | 8 ++---- ...rsiveMultiResolutionPyramidImageFilter.hxx | 5 +--- .../include/itkSyNImageRegistrationMethod.hxx | 3 +-- ...neVelocityFieldImageRegistrationMethod.hxx | 3 +-- ...yingVelocityFieldImageRegistrationTest.cxx | 3 +-- ...ParallelSparseFieldLevelSetImageFilter.hxx | 3 +-- .../include/itkWatershedSegmenter.hxx | 11 +++----- .../Core/include/itkImageToVideoFilter.hxx | 5 ++-- 51 files changed, 97 insertions(+), 183 deletions(-) diff --git a/Modules/Bridge/VTK/include/itkVTKImageExport.hxx b/Modules/Bridge/VTK/include/itkVTKImageExport.hxx index c6fcc23a94f..eb97c368ace 100644 --- a/Modules/Bridge/VTK/include/itkVTKImageExport.hxx +++ b/Modules/Bridge/VTK/include/itkVTKImageExport.hxx @@ -145,8 +145,7 @@ VTKImageExport::WholeExtentCallback() } InputRegionType region = input->GetLargestPossibleRegion(); - InputSizeType size = region.GetSize(); - InputIndexType index = region.GetIndex(); + auto [index, size] = region; unsigned int i = 0; // Fill in the known portion of the extent. @@ -387,8 +386,7 @@ VTKImageExport::DataExtentCallback() } InputRegionType region = input->GetBufferedRegion(); - InputSizeType size = region.GetSize(); - InputIndexType index = region.GetIndex(); + auto [index, size] = region; unsigned int i = 0; for (; i < InputImageDimension; ++i) diff --git a/Modules/Bridge/VTK/include/itkVTKImageImport.hxx b/Modules/Bridge/VTK/include/itkVTKImageImport.hxx index 5e53427ecf3..06847f12ec1 100644 --- a/Modules/Bridge/VTK/include/itkVTKImageImport.hxx +++ b/Modules/Bridge/VTK/include/itkVTKImageImport.hxx @@ -113,8 +113,7 @@ VTKImageImport::PropagateRequestedRegion(DataObject * outputPtr) if (m_PropagateUpdateExtentCallback) { OutputRegionType region = output->GetRequestedRegion(); - OutputSizeType size = region.GetSize(); - OutputIndexType index = region.GetIndex(); + auto [index, size] = region; int updateExtent[6]; unsigned int i = 0; diff --git a/Modules/Core/Common/include/itkConstNeighborhoodIterator.hxx b/Modules/Core/Common/include/itkConstNeighborhoodIterator.hxx index 5dc14d96364..1328706ca88 100644 --- a/Modules/Core/Common/include/itkConstNeighborhoodIterator.hxx +++ b/Modules/Core/Common/include/itkConstNeighborhoodIterator.hxx @@ -392,10 +392,8 @@ ConstNeighborhoodIterator::SetRegion(const RegionTyp m_End = m_ConstImage->GetBufferPointer() + m_ConstImage->ComputeOffset(m_EndIndex); // now determine whether boundary conditions are going to be needed - const IndexType bStart = m_ConstImage->GetBufferedRegion().GetIndex(); - const SizeType bSize = m_ConstImage->GetBufferedRegion().GetSize(); - const IndexType rStart = region.GetIndex(); - const SizeType rSize = region.GetSize(); + const auto [bStart, bSize] = m_ConstImage->GetBufferedRegion(); + const auto [rStart, rSize] = region; m_NeedToUseBoundaryCondition = false; for (DimensionValueType i = 0; i < Dimension; ++i) @@ -627,8 +625,7 @@ ConstNeighborhoodIterator::SetBound(const SizeType & { SizeType radius = this->GetRadius(); const OffsetValueType * offset = m_ConstImage->GetOffsetTable(); - const IndexType imageBRStart = m_ConstImage->GetBufferedRegion().GetIndex(); - SizeType imageBRSize = m_ConstImage->GetBufferedRegion().GetSize(); + const auto [imageBRStart, imageBRSize] = m_ConstImage->GetBufferedRegion(); // Set the bounds and the wrapping offsets. Inner bounds are the loop // indices where the iterator will begin to overlap the edge of the image diff --git a/Modules/Core/Common/include/itkConstNeighborhoodIteratorWithOnlyIndex.hxx b/Modules/Core/Common/include/itkConstNeighborhoodIteratorWithOnlyIndex.hxx index 2d87290e5aa..8b83981df32 100644 --- a/Modules/Core/Common/include/itkConstNeighborhoodIteratorWithOnlyIndex.hxx +++ b/Modules/Core/Common/include/itkConstNeighborhoodIteratorWithOnlyIndex.hxx @@ -205,10 +205,8 @@ ConstNeighborhoodIteratorWithOnlyIndex::Initialize(const SizeType & ra this->SetEndIndex(); // now determine whether boundary conditions are going to be needed - const IndexType bStart = ptr->GetBufferedRegion().GetIndex(); - const SizeType bSize = ptr->GetBufferedRegion().GetSize(); - const IndexType rStart = region.GetIndex(); - const SizeType rSize = region.GetSize(); + const auto [bStart, bSize] = ptr->GetBufferedRegion(); + const auto [rStart, rSize] = region; m_NeedToUseBoundaryCondition = false; for (DimensionValueType i = 0; i < Dimension; ++i) @@ -456,9 +454,8 @@ template void ConstNeighborhoodIteratorWithOnlyIndex::SetBound(const SizeType & size) { - SizeType radius = this->GetRadius(); - const IndexType imageBRStart = m_ConstImage->GetBufferedRegion().GetIndex(); - SizeType imageBRSize = m_ConstImage->GetBufferedRegion().GetSize(); + SizeType radius = this->GetRadius(); + const auto [imageBRStart, imageBRSize] = m_ConstImage->GetBufferedRegion(); // Set the bounds and the wrapping offsets. Inner bounds are the loop // indices where the iterator will begin to overlap the edge of the image diff --git a/Modules/Core/Common/include/itkNeighborhoodAlgorithm.hxx b/Modules/Core/Common/include/itkNeighborhoodAlgorithm.hxx index db0f2d8279c..4925234b689 100644 --- a/Modules/Core/Common/include/itkNeighborhoodAlgorithm.hxx +++ b/Modules/Core/Common/include/itkNeighborhoodAlgorithm.hxx @@ -49,10 +49,8 @@ ImageBoundaryFacesCalculator::Compute(const TImage & img, RegionType reg return result; } - const IndexType bStart = bufferedRegion.GetIndex(); - const SizeType bSize = bufferedRegion.GetSize(); - const IndexType rStart = regionToProcess.GetIndex(); - const SizeType rSize = regionToProcess.GetSize(); + const auto [bStart, bSize] = bufferedRegion; + const auto [rStart, rSize] = regionToProcess; SizeType nbSize = rSize; // Non-boundary region IndexType nbStart = rStart; // data. diff --git a/Modules/Core/Common/include/itkPeriodicBoundaryCondition.hxx b/Modules/Core/Common/include/itkPeriodicBoundaryCondition.hxx index caba00b5658..39eea96f0d3 100644 --- a/Modules/Core/Common/include/itkPeriodicBoundaryCondition.hxx +++ b/Modules/Core/Common/include/itkPeriodicBoundaryCondition.hxx @@ -138,11 +138,9 @@ PeriodicBoundaryCondition::GetInputRequestedRegion( const RegionType & inputLargestPossibleRegion, const RegionType & outputRequestedRegion) const -> RegionType { - IndexType imageIndex = inputLargestPossibleRegion.GetIndex(); - SizeType imageSize = inputLargestPossibleRegion.GetSize(); + auto [imageIndex, imageSize] = inputLargestPossibleRegion; - IndexType outputIndex = outputRequestedRegion.GetIndex(); - SizeType outputSize = outputRequestedRegion.GetSize(); + auto [outputIndex, outputSize] = outputRequestedRegion; IndexType inputRequestedIndex; SizeType inputRequestedSize; @@ -184,8 +182,7 @@ PeriodicBoundaryCondition::GetPixel(const IndexType & -> OutputPixelType { RegionType imageRegion = image->GetLargestPossibleRegion(); - IndexType imageIndex = imageRegion.GetIndex(); - SizeType imageSize = imageRegion.GetSize(); + auto [imageIndex, imageSize] = imageRegion; IndexType lookupIndex; diff --git a/Modules/Core/Common/include/itkZeroFluxNeumannBoundaryCondition.hxx b/Modules/Core/Common/include/itkZeroFluxNeumannBoundaryCondition.hxx index b2f07b1ed1d..f7a1ea29390 100644 --- a/Modules/Core/Common/include/itkZeroFluxNeumannBoundaryCondition.hxx +++ b/Modules/Core/Common/include/itkZeroFluxNeumannBoundaryCondition.hxx @@ -86,11 +86,9 @@ ZeroFluxNeumannBoundaryCondition::GetInputRequestedRe const RegionType & inputLargestPossibleRegion, const RegionType & outputRequestedRegion) const -> RegionType { - IndexType inputIndex = inputLargestPossibleRegion.GetIndex(); - SizeType inputSize = inputLargestPossibleRegion.GetSize(); + auto [inputIndex, inputSize] = inputLargestPossibleRegion; - IndexType outputIndex = outputRequestedRegion.GetIndex(); - SizeType outputSize = outputRequestedRegion.GetSize(); + auto [outputIndex, outputSize] = outputRequestedRegion; IndexType requestIndex; SizeType requestSize; @@ -156,8 +154,7 @@ ZeroFluxNeumannBoundaryCondition::GetPixel(const Inde -> OutputPixelType { RegionType imageRegion = image->GetLargestPossibleRegion(); - IndexType imageIndex = imageRegion.GetIndex(); - SizeType imageSize = imageRegion.GetSize(); + auto [imageIndex, imageSize] = imageRegion; IndexType lookupIndex; diff --git a/Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx b/Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx index 6d7984088e6..48292018cd4 100644 --- a/Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx +++ b/Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx @@ -33,8 +33,7 @@ GPUImageDataManager::SetImagePointer(ImageType * img) using SizeType = typename ImageType::SizeType; RegionType region = m_Image->GetBufferedRegion(); - IndexType index = region.GetIndex(); - SizeType size = region.GetSize(); + auto [index, size] = region; for (unsigned int d = 0; d < ImageDimension; ++d) { diff --git a/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.hxx b/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.hxx index e5fa893c9db..7099fffc353 100644 --- a/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.hxx +++ b/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.hxx @@ -58,8 +58,7 @@ GaussianInterpolateImageFunction::ComputeBoundingBox() typename InputImageType::ConstPointer input = this->GetInputImage(); typename InputImageType::SpacingType spacing = input->GetSpacing(); - typename InputImageType::IndexType index = input->GetLargestPossibleRegion().GetIndex(); - typename InputImageType::SizeType size = input->GetLargestPossibleRegion().GetSize(); + auto [index, size] = input->GetLargestPossibleRegion(); for (unsigned int d = 0; d < ImageDimension; ++d) { diff --git a/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.hxx b/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.hxx index 5ea83e60bd3..9211c61aed5 100644 --- a/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.hxx +++ b/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.hxx @@ -161,10 +161,9 @@ SpatialObjectToImageStatisticsCalculatorTransformPhysicalPointToIndex(ptMin); - auto indMax = m_Image->TransformPhysicalPointToIndex(ptMax); - IndexType imageIndex = m_Image->GetLargestPossibleRegion().GetIndex(); - SizeType imageSize = m_Image->GetLargestPossibleRegion().GetSize(); + auto indMin = m_Image->TransformPhysicalPointToIndex(ptMin); + auto indMax = m_Image->TransformPhysicalPointToIndex(ptMax); + auto [imageIndex, imageSize] = m_Image->GetLargestPossibleRegion(); for (unsigned int i = 0; i < Self::ObjectDimension; ++i) { if (indMin[i] > indMax[i]) diff --git a/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.hxx b/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.hxx index bce52154eb2..434127772f7 100644 --- a/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.hxx +++ b/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.hxx @@ -599,8 +599,7 @@ MRIBiasFieldCorrectionFilter::CorrectInte IndexValueType lastSlice = region.GetIndex()[m_SlicingDirection] + static_cast(region.GetSize()[m_SlicingDirection]); InputImageRegionType sliceRegion; - InputImageIndexType index = region.GetIndex(); - InputImageSizeType size = region.GetSize(); + auto [index, size] = region; sliceRegion.SetSize(size); BiasFieldType bias = this->EstimateBiasField(sliceRegion, 0, m_InterSliceCorrectionMaximumIteration); @@ -882,8 +881,7 @@ MRIBiasFieldCorrectionFilter::AdjustSlabR SlabRegionVectorType & slabs, OutputImageRegionType requestedRegion) { - OutputImageIndexType indexFirst = requestedRegion.GetIndex(); - OutputImageSizeType size = requestedRegion.GetSize(); + auto [indexFirst, size] = requestedRegion; OutputImageIndexType indexLast = indexFirst; for (SizeValueType i = 0; i < ImageDimension; ++i) diff --git a/Modules/Filtering/Convolution/include/itkConvolutionImageFilterBase.hxx b/Modules/Filtering/Convolution/include/itkConvolutionImageFilterBase.hxx index 6f03d1618b2..bf1eab4374b 100644 --- a/Modules/Filtering/Convolution/include/itkConvolutionImageFilterBase.hxx +++ b/Modules/Filtering/Convolution/include/itkConvolutionImageFilterBase.hxx @@ -54,8 +54,7 @@ ConvolutionImageFilterBase::GetValidReg InputRegionType inputLargestPossibleRegion = inputPtr->GetLargestPossibleRegion(); - OutputIndexType validIndex = inputLargestPossibleRegion.GetIndex(); - OutputSizeType validSize = inputLargestPossibleRegion.GetSize(); + auto [validIndex, validSize] = inputLargestPossibleRegion; // Shrink the output largest possible region by the kernel radius. KernelSizeType kernelSize = this->GetKernelImage()->GetLargestPossibleRegion().GetSize(); diff --git a/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx b/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx index 7219745fa8e..4fb4013f5d7 100644 --- a/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx +++ b/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx @@ -149,15 +149,12 @@ FFTConvolutionImageFilterGetLargestPossibleRegion(); - InputSizeType inputLargestSize = inputLargestRegion.GetSize(); - InputIndexType inputLargestIndex = inputLargestRegion.GetIndex(); - InputRegionType inputRequestedRegion = input->GetRequestedRegion(); - InputSizeType inputRequestedSize = inputRequestedRegion.GetSize(); - InputIndexType inputRequestedIndex = inputRequestedRegion.GetIndex(); + InputRegionType inputLargestRegion = input->GetLargestPossibleRegion(); + auto [inputLargestIndex, inputLargestSize] = inputLargestRegion; + InputRegionType inputRequestedRegion = input->GetRequestedRegion(); + auto [inputRequestedIndex, inputRequestedSize] = inputRequestedRegion; OutputRegionType outputRequestedRegion = this->GetOutput()->GetRequestedRegion(); - OutputSizeType outputRequestedSize = outputRequestedRegion.GetSize(); - OutputIndexType outputRequestedIndex = outputRequestedRegion.GetIndex(); + auto [outputRequestedIndex, outputRequestedSize] = outputRequestedRegion; // Pad the input image such that the requested region, expanded by // twice the kernel radius, lies entirely within the buffered region. diff --git a/Modules/Filtering/DisplacementField/include/itkGaussianExponentialDiffeomorphicTransform.hxx b/Modules/Filtering/DisplacementField/include/itkGaussianExponentialDiffeomorphicTransform.hxx index 206d6929d16..4a9b6743688 100644 --- a/Modules/Filtering/DisplacementField/include/itkGaussianExponentialDiffeomorphicTransform.hxx +++ b/Modules/Filtering/DisplacementField/include/itkGaussianExponentialDiffeomorphicTransform.hxx @@ -191,8 +191,7 @@ GaussianExponentialDiffeomorphicTransform::Gau ScalarType weight2 = 1.0 - weight1; const typename ConstantVelocityFieldType::RegionType region = field->GetLargestPossibleRegion(); - const typename ConstantVelocityFieldType::SizeType size = region.GetSize(); - const typename ConstantVelocityFieldType::IndexType startIndex = region.GetIndex(); + const auto [startIndex, size] = region; ImageRegionIteratorWithIndex fieldIt(field, field->GetLargestPossibleRegion()); ImageRegionConstIteratorWithIndex smoothedFieldIt(smoothField, diff --git a/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateDisplacementFieldTransform.hxx b/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateDisplacementFieldTransform.hxx index f10ff333fe8..263f4d08c36 100644 --- a/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateDisplacementFieldTransform.hxx +++ b/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateDisplacementFieldTransform.hxx @@ -184,8 +184,7 @@ GaussianSmoothingOnUpdateDisplacementFieldTransformGetLargestPossibleRegion(); - const typename DisplacementFieldType::SizeType size = region.GetSize(); - const typename DisplacementFieldType::IndexType startIndex = region.GetIndex(); + const auto [startIndex, size] = region; ImageRegionIteratorWithIndex fieldIt(field, field->GetLargestPossibleRegion()); ImageRegionConstIteratorWithIndex smoothedFieldIt(smoothField, diff --git a/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.hxx b/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.hxx index 43ab1747737..3bbd773c57b 100644 --- a/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.hxx +++ b/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.hxx @@ -196,11 +196,9 @@ GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransformGetLargestPossibleRegion().GetSize(); - TimeVaryingVelocityFieldIndexType startIndex = field->GetLargestPossibleRegion().GetIndex(); + auto [startIndex, size] = field->GetLargestPossibleRegion(); ImageRegionIteratorWithIndex fieldIt(field, field->GetLargestPossibleRegion()); ImageRegionConstIteratorWithIndex smoothedFieldIt(smoothField, diff --git a/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx b/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx index 94b1d7bf9b5..f2b59d3fffe 100644 --- a/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx +++ b/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx @@ -169,9 +169,8 @@ void InvertDisplacementFieldImageFilter::DynamicThreadedGenerateData(const RegionType & region) { const typename DisplacementFieldType::RegionType fullRegion = this->m_ComposedField->GetRequestedRegion(); - const typename DisplacementFieldType::SizeType size = fullRegion.GetSize(); - const typename DisplacementFieldType::IndexType startIndex = fullRegion.GetIndex(); - const typename DisplacementFieldType::PixelType zeroVector{}; + const auto [startIndex, size] = fullRegion; + const typename DisplacementFieldType::PixelType zeroVector{}; ImageRegionIterator ItE(this->m_ComposedField, region); ImageRegionIterator ItS(this->m_ScaledNormImage, region); diff --git a/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx b/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx index 4e19482db0b..322bd11ccc1 100644 --- a/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx +++ b/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx @@ -190,8 +190,7 @@ TimeVaryingVelocityFieldIntegrationImageFilterGetLargestPossibleRegion(); - typename RegionType::IndexType lastIndex = region.GetIndex(); - typename RegionType::SizeType size = region.GetSize(); + auto [lastIndex, size] = region; for (unsigned int d = 0; d < InputImageDimension; ++d) { lastIndex[d] += (size[d] - 1); diff --git a/Modules/Filtering/DistanceMap/include/itkSignedMaurerDistanceMapImageFilter.hxx b/Modules/Filtering/DistanceMap/include/itkSignedMaurerDistanceMapImageFilter.hxx index 44f4e7c4ac5..0c8d3d6e509 100644 --- a/Modules/Filtering/DistanceMap/include/itkSignedMaurerDistanceMapImageFilter.hxx +++ b/Modules/Filtering/DistanceMap/include/itkSignedMaurerDistanceMapImageFilter.hxx @@ -53,8 +53,7 @@ SignedMaurerDistanceMapImageFilter::SplitRequestedReg const OutputSizeType & requestedRegionSize = splitRegion.GetSize(); - OutputIndexType splitIndex = splitRegion.GetIndex(); - OutputSizeType splitSize = splitRegion.GetSize(); + auto [splitIndex, splitSize] = splitRegion; // split on the outermost dimension available // and avoid the current dimension diff --git a/Modules/Filtering/FFT/include/itkHalfToFullHermitianImageFilter.hxx b/Modules/Filtering/FFT/include/itkHalfToFullHermitianImageFilter.hxx index 772f359c295..fd80b4d7b94 100644 --- a/Modules/Filtering/FFT/include/itkHalfToFullHermitianImageFilter.hxx +++ b/Modules/Filtering/FFT/include/itkHalfToFullHermitianImageFilter.hxx @@ -119,8 +119,7 @@ HalfToFullHermitianImageFilter::DynamicThreadedGenerateData( // Now copy the redundant complex conjugate region, if there is one // in this thread's output region. - OutputImageIndexType outputRegionIndex = outputRegionForThread.GetIndex(); - OutputImageSizeType outputRegionSize = outputRegionForThread.GetSize(); + auto [outputRegionIndex, outputRegionSize] = outputRegionForThread; OutputImageIndexType outputRegionMaximumIndex = outputRegionIndex + outputRegionSize; if (outputRegionMaximumIndex[0] > inputRegionMaximumIndex[0]) @@ -141,8 +140,7 @@ HalfToFullHermitianImageFilter::DynamicThreadedGenerateData( for (unsigned int i = 0; i < ImageDimension; ++i) { OutputImageRegionType outputLargestPossibleRegion = outputPtr->GetLargestPossibleRegion(); - OutputImageIndexType outputLargestPossibleRegionIndex = outputLargestPossibleRegion.GetIndex(); - OutputImageSizeType outputLargestPossibleRegionSize = outputLargestPossibleRegion.GetSize(); + auto [outputLargestPossibleRegionIndex, outputLargestPossibleRegionSize] = outputLargestPossibleRegion; if (conjugateIndex[i] != outputLargestPossibleRegionIndex[i]) { index[i] = outputLargestPossibleRegionSize[i] - conjugateIndex[i] + 2 * outputLargestPossibleRegionIndex[i]; diff --git a/Modules/Filtering/FFT/include/itkRealToHalfHermitianForwardFFTImageFilter.hxx b/Modules/Filtering/FFT/include/itkRealToHalfHermitianForwardFFTImageFilter.hxx index 857e7a299f2..298799336a0 100644 --- a/Modules/Filtering/FFT/include/itkRealToHalfHermitianForwardFFTImageFilter.hxx +++ b/Modules/Filtering/FFT/include/itkRealToHalfHermitianForwardFFTImageFilter.hxx @@ -43,8 +43,7 @@ RealToHalfHermitianForwardFFTImageFilter::GenerateOut // This is all based on the same function in itk::ShrinkImageFilter // ShrinkImageFilter also modifies the image spacing, but spacing // has no meaning in the result of an FFT. - const InputSizeType inputSize = inputPtr->GetLargestPossibleRegion().GetSize(); - const InputIndexType inputStartIndex = inputPtr->GetLargestPossibleRegion().GetIndex(); + const auto [inputStartIndex, inputSize] = inputPtr->GetLargestPossibleRegion(); OutputSizeType outputSize; OutputIndexType outputStartIndex; diff --git a/Modules/Filtering/FFT/include/itkVnlHalfHermitianToRealInverseFFTImageFilter.hxx b/Modules/Filtering/FFT/include/itkVnlHalfHermitianToRealInverseFFTImageFilter.hxx index 80509d81ac9..82bac3847d4 100644 --- a/Modules/Filtering/FFT/include/itkVnlHalfHermitianToRealInverseFFTImageFilter.hxx +++ b/Modules/Filtering/FFT/include/itkVnlHalfHermitianToRealInverseFFTImageFilter.hxx @@ -41,10 +41,8 @@ VnlHalfHermitianToRealInverseFFTImageFilter::Generate // reports the beginning and the end of the process. ProgressReporter progress(this, 0, 1); - const InputSizeType inputSize = inputPtr->GetLargestPossibleRegion().GetSize(); - const InputIndexType inputIndex = inputPtr->GetLargestPossibleRegion().GetIndex(); - const OutputSizeType outputSize = outputPtr->GetLargestPossibleRegion().GetSize(); - const OutputIndexType outputIndex = outputPtr->GetLargestPossibleRegion().GetIndex(); + const auto [inputIndex, inputSize] = inputPtr->GetLargestPossibleRegion(); + const auto [outputIndex, outputSize] = outputPtr->GetLargestPossibleRegion(); // Allocate output buffer memory outputPtr->SetBufferedRegion(outputPtr->GetRequestedRegion()); diff --git a/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx b/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx index aa358304164..fc9196246b9 100644 --- a/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx +++ b/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx @@ -146,8 +146,7 @@ MaskFeaturePointSelectionFilter::GenerateData() } // set safe region for picking feature points depending on whether tensors are computed - IndexType safeIndex = region.GetIndex(); - SizeType safeSize = region.GetSize(); + auto [safeIndex, safeSize] = region; if (m_ComputeStructureTensors) { diff --git a/Modules/Filtering/ImageFrequency/include/itkFrequencyShiftedFFTLayoutImageRegionConstIteratorWithIndex.h b/Modules/Filtering/ImageFrequency/include/itkFrequencyShiftedFFTLayoutImageRegionConstIteratorWithIndex.h index a0bec95e552..538f5603cd3 100644 --- a/Modules/Filtering/ImageFrequency/include/itkFrequencyShiftedFFTLayoutImageRegionConstIteratorWithIndex.h +++ b/Modules/Filtering/ImageFrequency/include/itkFrequencyShiftedFFTLayoutImageRegionConstIteratorWithIndex.h @@ -249,8 +249,7 @@ class ITK_TEMPLATE_EXPORT FrequencyShiftedFFTLayoutImageRegionConstIteratorWithI void Init() { - IndexType minIndex = this->m_Image->GetLargestPossibleRegion().GetIndex(); - SizeType sizeImage = this->m_Image->GetLargestPossibleRegion().GetSize(); + auto [minIndex, sizeImage] = this->m_Image->GetLargestPossibleRegion(); for (unsigned int dim = 0; dim < ImageType::ImageDimension; ++dim) { this->m_ZeroFrequencyIndex[dim] = diff --git a/Modules/Filtering/ImageGrid/include/itkCropImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkCropImageFilter.hxx index b9dfb9a9141..d070afb669f 100644 --- a/Modules/Filtering/ImageGrid/include/itkCropImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkCropImageFilter.hxx @@ -36,8 +36,7 @@ CropImageFilter::GenerateOutputInformation() SizeType sz; OutputImageIndexType idx; - InputImageSizeType input_sz = inputPtr->GetLargestPossibleRegion().GetSize(); - InputImageIndexType input_idx = inputPtr->GetLargestPossibleRegion().GetIndex(); + auto [input_idx, input_sz] = inputPtr->GetLargestPossibleRegion(); for (unsigned int i = 0; i < InputImageDimension; ++i) { diff --git a/Modules/Filtering/ImageGrid/include/itkCyclicShiftImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkCyclicShiftImageFilter.hxx index c7c42a7e5ff..3d5efeea078 100644 --- a/Modules/Filtering/ImageGrid/include/itkCyclicShiftImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkCyclicShiftImageFilter.hxx @@ -57,8 +57,7 @@ CyclicShiftImageFilter::DynamicThreadedGenerateData( const InputImageType * inputImage = this->GetInput(); // The index and size of the image needed to compute the shift - const IndexType outIdx = this->GetOutput()->GetLargestPossibleRegion().GetIndex(); - const SizeType outSize = this->GetOutput()->GetLargestPossibleRegion().GetSize(); + const auto [outIdx, outSize] = this->GetOutput()->GetLargestPossibleRegion(); TotalProgressReporter progress(this, this->GetOutput()->GetRequestedRegion().GetNumberOfPixels()); diff --git a/Modules/Filtering/ImageGrid/include/itkMirrorPadImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkMirrorPadImageFilter.hxx index 5a6748f4f8d..2f9e5f7bd06 100644 --- a/Modules/Filtering/ImageGrid/include/itkMirrorPadImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkMirrorPadImageFilter.hxx @@ -39,10 +39,9 @@ MirrorPadImageFilter::GenerateNextOutputRegion(long * std::vector * sizes, OutputImageRegionType & outputRegion) { - unsigned int ctr; - int done = 0; - OutputImageIndexType nextIndex = outputRegion.GetIndex(); - OutputImageSizeType nextSize = outputRegion.GetSize(); + unsigned int ctr; + int done = 0; + auto [nextIndex, nextSize] = outputRegion; // // Starting at the first dimension, increment the counter and set a new @@ -96,10 +95,9 @@ MirrorPadImageFilter::GenerateNextInputRegion(long * std::vector * sizes, InputImageRegionType & inputRegion) { - unsigned int ctr; - int done = 0; - InputImageIndexType nextIndex = inputRegion.GetIndex(); - InputImageSizeType nextSize = inputRegion.GetSize(); + unsigned int ctr; + int done = 0; + auto [nextIndex, nextSize] = inputRegion; // // Starting at the first dimension, increment the counter and set a new @@ -187,8 +185,7 @@ MirrorPadImageFilter::ConvertOutputIndexToInputIndex( long a, b, c; // Output region goes from a to a+b-1 // Input region goes from c to c+b-1 OutputImageIndexType outputRegionStart = outputRegion.GetIndex(); - InputImageIndexType inputRegionStart = inputRegion.GetIndex(); - InputImageSizeType inputSizes = inputRegion.GetSize(); + auto [inputRegionStart, inputSizes] = inputRegion; for (dimCtr = 0; dimCtr < ImageDimension; ++dimCtr) { diff --git a/Modules/Filtering/ImageGrid/include/itkSliceBySliceImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkSliceBySliceImageFilter.hxx index 28807410136..ff2ced950f3 100644 --- a/Modules/Filtering/ImageGrid/include/itkSliceBySliceImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkSliceBySliceImageFilter.hxx @@ -226,8 +226,7 @@ SliceBySliceImageFilterAllocateOutputs(); const RegionType requestedRegion = this->GetOutput(0)->GetRequestedRegion(); - const IndexType requestedIndex = requestedRegion.GetIndex(); - const SizeType requestedSize = requestedRegion.GetSize(); + const auto [requestedIndex, requestedSize] = requestedRegion; InternalRegionType internalOutputRegion; InternalRegionType internalInputRegion; diff --git a/Modules/Filtering/ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx b/Modules/Filtering/ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx index 580bb555b20..ba813fc81b2 100644 --- a/Modules/Filtering/ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx +++ b/Modules/Filtering/ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx @@ -33,8 +33,7 @@ static bool VerifyFilterOutput(const ShortImage * inputImage, const FloatImage * outputImage) { ShortImage::RegionType inputRegion = inputImage->GetLargestPossibleRegion(); - ShortImage::IndexType inputIndex = inputRegion.GetIndex(); - ShortImage::SizeType inputSize = inputRegion.GetSize(); + auto [inputIndex, inputSize] = inputRegion; ShortImage::RegionType outputRegion = outputImage->GetLargestPossibleRegion(); itk::ImageRegionConstIteratorWithIndex outputIterator(outputImage, outputRegion); @@ -106,12 +105,10 @@ VerifyFilter(const ShortImage * inputImage, } ShortImage::RegionType outputRegion = padFilter->GetOutput()->GetLargestPossibleRegion(); - ShortImage::IndexType outputIndex = outputRegion.GetIndex(); - ShortImage::SizeType outputSize = outputRegion.GetSize(); + auto [outputIndex, outputSize] = outputRegion; ShortImage::RegionType inputRegion = inputImage->GetLargestPossibleRegion(); - ShortImage::IndexType inputIndex = inputRegion.GetIndex(); - ShortImage::SizeType inputSize = inputRegion.GetSize(); + auto [inputIndex, inputSize] = inputRegion; ShortImage::IndexType expectedIndex; ShortImage::SizeType expectedSize; diff --git a/Modules/Filtering/ImageStatistics/include/itkAccumulateImageFilter.hxx b/Modules/Filtering/ImageStatistics/include/itkAccumulateImageFilter.hxx index b0767ce61f3..0a3a392557f 100644 --- a/Modules/Filtering/ImageStatistics/include/itkAccumulateImageFilter.hxx +++ b/Modules/Filtering/ImageStatistics/include/itkAccumulateImageFilter.hxx @@ -157,8 +157,7 @@ AccumulateImageFilter::GenerateData() outputIterType outputIter(outputImage, outputImage->GetBufferedRegion()); using inputIterType = ImageRegionConstIterator; - typename TInputImage::SizeType AccumulatedSize = inputImage->GetLargestPossibleRegion().GetSize(); - typename TInputImage::IndexType AccumulatedIndex = inputImage->GetLargestPossibleRegion().GetIndex(); + auto [AccumulatedIndex, AccumulatedSize] = inputImage->GetLargestPossibleRegion(); typename TInputImage::SizeValueType SizeAccumulateDimension = AccumulatedSize[m_AccumulateDimension]; const auto sizeAccumulateDimensionDouble = static_cast(SizeAccumulateDimension); diff --git a/Modules/Filtering/ImageStatistics/include/itkProjectionImageFilter.hxx b/Modules/Filtering/ImageStatistics/include/itkProjectionImageFilter.hxx index 506f4ca7fdc..934dc4fd6b1 100644 --- a/Modules/Filtering/ImageStatistics/include/itkProjectionImageFilter.hxx +++ b/Modules/Filtering/ImageStatistics/include/itkProjectionImageFilter.hxx @@ -217,13 +217,11 @@ ProjectionImageFilter::DynamicThreadedG typename TInputImage::RegionType inputRegion = inputImage->GetLargestPossibleRegion(); - typename TInputImage::SizeType inputSize = inputRegion.GetSize(); - typename TInputImage::IndexType inputIndex = inputRegion.GetIndex(); + auto [inputIndex, inputSize] = inputRegion; typename TOutputImage::Pointer outputImage = this->GetOutput(); - typename TOutputImage::SizeType outputSizeForThread = outputRegionForThread.GetSize(); - typename TOutputImage::IndexType outputIndexForThread = outputRegionForThread.GetIndex(); + auto [outputIndexForThread, outputSizeForThread] = outputRegionForThread; // compute the input region for this thread typename TInputImage::RegionType inputRegionForThread = inputRegion; diff --git a/Modules/Filtering/LabelMap/include/itkCropLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkCropLabelMapFilter.hxx index c0d521ab002..9be1e89d136 100644 --- a/Modules/Filtering/LabelMap/include/itkCropLabelMapFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkCropLabelMapFilter.hxx @@ -46,8 +46,7 @@ CropLabelMapFilter::GenerateOutputInformation() SizeType size; IndexType index; - SizeType inputSize = inputPtr->GetLargestPossibleRegion().GetSize(); - IndexType inputIndex = inputPtr->GetLargestPossibleRegion().GetIndex(); + auto [inputIndex, inputSize] = inputPtr->GetLargestPossibleRegion(); SizeType originalCropSize = m_UpperBoundaryCropSize + m_LowerBoundaryCropSize; diff --git a/Modules/Filtering/LabelMap/include/itkPadLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkPadLabelMapFilter.hxx index 6c7673f1682..a29e7e5e56f 100644 --- a/Modules/Filtering/LabelMap/include/itkPadLabelMapFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkPadLabelMapFilter.hxx @@ -45,8 +45,7 @@ PadLabelMapFilter::GenerateOutputInformation() SizeType size; IndexType index; - SizeType inputSize = inputPtr->GetLargestPossibleRegion().GetSize(); - IndexType inputIndex = inputPtr->GetLargestPossibleRegion().GetIndex(); + auto [inputIndex, inputSize] = inputPtr->GetLargestPossibleRegion(); SizeType originalPadSize = m_UpperBoundaryPadSize + m_LowerBoundaryPadSize; diff --git a/Modules/Filtering/MathematicalMorphology/include/itkSharedMorphologyUtilities.hxx b/Modules/Filtering/MathematicalMorphology/include/itkSharedMorphologyUtilities.hxx index 5b26410bbea..709c8c10bd6 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkSharedMorphologyUtilities.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkSharedMorphologyUtilities.hxx @@ -45,8 +45,7 @@ NeedToDoFace(const TRegion AllImage, const TRegion face, const TLine line) // find the small dimension of the face - should only be one typename TRegion::IndexType ISt = AllImage.GetIndex(); - typename TRegion::SizeType FSz = face.GetSize(); - typename TRegion::IndexType FSt = face.GetIndex(); + auto [FSt, FSz] = face; unsigned int smallDim = 0; for (unsigned int i = 0; i < AllImage.GetImageDimension(); ++i) @@ -90,13 +89,12 @@ ComputeStartEnd(const typename TImage::IndexType StartIndex, unsigned int & end) { // compute intersection between ray and box - typename TImage::IndexType ImStart = AllImage.GetIndex(); - typename TImage::SizeType ImSize = AllImage.GetSize(); - float Tfar = NumericTraits::max(); - float Tnear = NumericTraits::NonpositiveMin(); - float domdir = NumericTraits::NonpositiveMin(); - int sPos, ePos; - unsigned int perpdir = 0; + auto [ImStart, ImSize] = AllImage; + float Tfar = NumericTraits::max(); + float Tnear = NumericTraits::NonpositiveMin(); + float domdir = NumericTraits::NonpositiveMin(); + int sPos, ePos; + unsigned int perpdir = 0; for (unsigned int i = 0; i < TImage::RegionType::ImageDimension; ++i) { const auto abs_line_elmt_tmp = itk::Math::abs(line[i]); @@ -298,16 +296,13 @@ MakeEnlargedFace(const typename TInputImage::ConstPointer itkNotUsed(input), // because it doesn't return faces of the sub-blocks if they don't // fall along the edge of the image using RegionType = typename TInputImage::RegionType; - using SizeType = typename TInputImage::SizeType; - using IndexType = typename TInputImage::IndexType; using FaceListType = std::list; FaceListType faceList; for (unsigned int i = 0; i < TInputImage::ImageDimension; ++i) { RegionType R1, R2; - SizeType S1 = AllImage.GetSize(); - IndexType I2 = AllImage.GetIndex(); + auto [I2, S1] = AllImage; S1[i] = 1; R1 = AllImage; @@ -386,9 +381,8 @@ MakeEnlargedFace(const typename TInputImage::ConstPointer itkNotUsed(input), } // figure out how much extra each other dimension needs to be extended - typename TInputImage::SizeType NewSize = RelevantRegion.GetSize(); - typename TInputImage::IndexType NewStart = RelevantRegion.GetIndex(); - unsigned int NonFaceLen = AllImage.GetSize()[NonFaceDim]; + auto [NewStart, NewSize] = RelevantRegion; + unsigned int NonFaceLen = AllImage.GetSize()[NonFaceDim]; for (unsigned int i = 0; i < TInputImage::RegionType::ImageDimension; ++i) { if (i != NonFaceDim) diff --git a/Modules/Filtering/Smoothing/include/itkBinomialBlurImageFilter.hxx b/Modules/Filtering/Smoothing/include/itkBinomialBlurImageFilter.hxx index aa27f2f586b..0bfb6a1486e 100644 --- a/Modules/Filtering/Smoothing/include/itkBinomialBlurImageFilter.hxx +++ b/Modules/Filtering/Smoothing/include/itkBinomialBlurImageFilter.hxx @@ -118,8 +118,7 @@ BinomialBlurImageFilter::GenerateData() tempPtr->Allocate(); // How big is the input image? - typename TInputImage::SizeType size = inputPtr->GetRequestedRegion().GetSize(); - typename TInputImage::IndexType startIndex = inputPtr->GetRequestedRegion().GetIndex(); + auto [startIndex, size] = inputPtr->GetRequestedRegion(); // Iterator Typedefs for this routine using TempIterator = ImageRegionIterator; diff --git a/Modules/IO/GDCM/test/itkGDCMImageReadSeriesWriteTest.cxx b/Modules/IO/GDCM/test/itkGDCMImageReadSeriesWriteTest.cxx index b0b4e6269e5..17863b624a7 100644 --- a/Modules/IO/GDCM/test/itkGDCMImageReadSeriesWriteTest.cxx +++ b/Modules/IO/GDCM/test/itkGDCMImageReadSeriesWriteTest.cxx @@ -84,8 +84,7 @@ itkGDCMImageReadSeriesWriteTest(int argc, char * argv[]) ITK_TEST_SET_GET_VALUE(gdcmIO, seriesWriter->GetImageIO()); ImageType::RegionType region = reader->GetOutput()->GetLargestPossibleRegion(); - ImageType::IndexType start = region.GetIndex(); - ImageType::SizeType size = region.GetSize(); + auto [start, size] = region; std::string format = outputDirectory; diff --git a/Modules/IO/ImageBase/test/itkImageFileWriterUpdateLargestPossibleRegionTest.cxx b/Modules/IO/ImageBase/test/itkImageFileWriterUpdateLargestPossibleRegionTest.cxx index e100274a298..75ca0b073bb 100644 --- a/Modules/IO/ImageBase/test/itkImageFileWriterUpdateLargestPossibleRegionTest.cxx +++ b/Modules/IO/ImageBase/test/itkImageFileWriterUpdateLargestPossibleRegionTest.cxx @@ -46,8 +46,7 @@ itkImageFileWriterUpdateLargestPossibleRegionTest(int argc, char * argv[]) writer->SetFileName(argv[2]); ImageType::RegionType region = reader->GetOutput()->GetLargestPossibleRegion(); - ImageType::IndexType index = region.GetIndex(); - ImageType::SizeType size = region.GetSize(); + auto [index, size] = region; itk::ImageIORegion ioregion(2); ioregion.SetIndex(0, index[0]); diff --git a/Modules/Nonunit/Review/include/itkDirectFourierReconstructionImageToImageFilter.hxx b/Modules/Nonunit/Review/include/itkDirectFourierReconstructionImageToImageFilter.hxx index 13eed8cdc3a..970eedc05ab 100644 --- a/Modules/Nonunit/Review/include/itkDirectFourierReconstructionImageToImageFilter.hxx +++ b/Modules/Nonunit/Review/include/itkDirectFourierReconstructionImageToImageFilter.hxx @@ -79,8 +79,7 @@ DirectFourierReconstructionImageToImageFilter::Genera } RegionType inputRegion = inputImage->GetLargestPossibleRegion(); - IndexType inputStart = inputRegion.GetIndex(); - SizeType inputSize = inputRegion.GetSize(); + auto [inputStart, inputSize] = inputRegion; IndexType outputStart; SizeType outputSize; @@ -131,8 +130,7 @@ DirectFourierReconstructionImageToImageFilter::Genera // request maximum angular and radial information / to be optimized - SizeType inputSize = inputImage->GetLargestPossibleRegion().GetSize(); - IndexType inputStart = inputImage->GetLargestPossibleRegion().GetIndex(); + auto [inputStart, inputSize] = inputImage->GetLargestPossibleRegion(); // crop to requested z-axis inputSize[m_ZDirection] = outputImage->GetRequestedRegion().GetSize()[2]; @@ -162,8 +160,7 @@ DirectFourierReconstructionImageToImageFilter::Genera // Crop angular input image size to 180 degrees typename InputImageType::RegionType inputROI = m_InputRequestedRegion; - typename InputImageType::SizeType inputROISize = inputROI.GetSize(); - typename InputImageType::IndexType inputROIStart = inputROI.GetIndex(); + auto [inputROIStart, inputROISize] = inputROI; // the number of projections needed to cover 180 degrees const auto alpha_size = Math::Floor((180 * (inputROISize[m_AlphaDirection])) / m_AlphaRange); diff --git a/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx b/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx index 0eec0cc4c91..83c83a53a56 100644 --- a/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx +++ b/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx @@ -230,8 +230,7 @@ itkDiscreteHessianGaussianImageFunctionTestND(int argc, char * argv[]) function->SetInterpolationMode(HessianGaussianImageFunctionType::InterpolationModeEnum::LinearInterpolation); const ImageType * inputImage = reader->GetOutput(); typename ImageType::RegionType region = inputImage->GetBufferedRegion(); - typename ImageType::SizeType size = region.GetSize(); - typename ImageType::IndexType index = region.GetIndex(); + auto [index, size] = region; // Aim for the pixel at the center of the image for (unsigned int i = 0; i < Dimension; ++i) { diff --git a/Modules/Numerics/NarrowBand/test/itkNarrowBandImageFilterBaseTest.cxx b/Modules/Numerics/NarrowBand/test/itkNarrowBandImageFilterBaseTest.cxx index 2eaefa6f41b..b2c2ab40a9d 100644 --- a/Modules/Numerics/NarrowBand/test/itkNarrowBandImageFilterBaseTest.cxx +++ b/Modules/Numerics/NarrowBand/test/itkNarrowBandImageFilterBaseTest.cxx @@ -73,8 +73,7 @@ class NbTestClass : public NarrowBandImageFilterBaseGetInput()->GetRequestedRegion().GetSize(); - typename ImageType::IndexType tl = this->GetInput()->GetRequestedRegion().GetIndex(); + auto [tl, sz] = this->GetInput()->GetRequestedRegion(); typename Superclass::IndexType in; for (in [0] = 32 + tl[0]; in[0] < tl[0] + static_cast(sz[0]); in[0]++) diff --git a/Modules/Numerics/Statistics/include/itkSpatialNeighborSubsampler.hxx b/Modules/Numerics/Statistics/include/itkSpatialNeighborSubsampler.hxx index 540226da5d7..467f01d2872 100644 --- a/Modules/Numerics/Statistics/include/itkSpatialNeighborSubsampler.hxx +++ b/Modules/Numerics/Statistics/include/itkSpatialNeighborSubsampler.hxx @@ -101,8 +101,7 @@ SpatialNeighborSubsampler::Search(const InstanceIdentifier & q SizeType searchSize; IndexType endIndex; - IndexType constraintIndex = this->m_RegionConstraint.GetIndex(); - SizeType constraintSize = this->m_RegionConstraint.GetSize(); + auto [constraintIndex, constraintSize] = this->m_RegionConstraint; IndexType queryIndex; typename RegionType::OffsetTableType offsetTable; diff --git a/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx b/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx index b76f73b74a0..218b06c7a77 100644 --- a/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx +++ b/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx @@ -75,8 +75,7 @@ UniformRandomSpatialNeighborSubsampler::Search(const InstanceI IndexType searchStartIndex; IndexType searchEndIndex; - IndexType constraintIndex = this->m_RegionConstraint.GetIndex(); - SizeType constraintSize = this->m_RegionConstraint.GetSize(); + auto [constraintIndex, constraintSize] = this->m_RegionConstraint; IndexType queryIndex; typename RegionType::OffsetTableType offsetTable; diff --git a/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.hxx b/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.hxx index 4530d4ad220..657edff4383 100644 --- a/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.hxx +++ b/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.hxx @@ -227,8 +227,7 @@ MultiResolutionImageRegistrationMethod::PreparePyrami ScheduleType movingschedule = m_MovingImagePyramid->GetSchedule(); itkDebugMacro("MovingImage schedule: " << movingschedule); - SizeType inputSize = m_FixedImageRegion.GetSize(); - IndexType inputStart = m_FixedImageRegion.GetIndex(); + auto [inputStart, inputSize] = m_FixedImageRegion; const SizeValueType numberOfLevels = m_FixedImagePyramid->GetNumberOfLevels(); diff --git a/Modules/Registration/Common/include/itkMultiResolutionPyramidImageFilter.hxx b/Modules/Registration/Common/include/itkMultiResolutionPyramidImageFilter.hxx index f7e82c812ea..23e6ac2bec9 100644 --- a/Modules/Registration/Common/include/itkMultiResolutionPyramidImageFilter.hxx +++ b/Modules/Registration/Common/include/itkMultiResolutionPyramidImageFilter.hxx @@ -422,8 +422,7 @@ MultiResolutionPyramidImageFilter::GenerateOutputRequ IndexType outputIndex; SizeType outputSize; RegionType outputRegion; - IndexType baseIndex = ptr->GetRequestedRegion().GetIndex(); - SizeType baseSize = ptr->GetRequestedRegion().GetSize(); + auto [baseIndex, baseSize] = ptr->GetRequestedRegion(); for (idim = 0; idim < TOutputImage::ImageDimension; ++idim) { @@ -482,13 +481,10 @@ MultiResolutionPyramidImageFilter::GenerateInputReque } // compute baseIndex and baseSize - using SizeType = typename OutputImageType::SizeType; - using IndexType = typename OutputImageType::IndexType; using RegionType = typename OutputImageType::RegionType; unsigned int refLevel = m_NumberOfLevels - 1; - SizeType baseSize = this->GetOutput(refLevel)->GetRequestedRegion().GetSize(); - IndexType baseIndex = this->GetOutput(refLevel)->GetRequestedRegion().GetIndex(); + auto [baseIndex, baseSize] = this->GetOutput(refLevel)->GetRequestedRegion(); unsigned int idim; for (idim = 0; idim < ImageDimension; ++idim) diff --git a/Modules/Registration/Common/include/itkRecursiveMultiResolutionPyramidImageFilter.hxx b/Modules/Registration/Common/include/itkRecursiveMultiResolutionPyramidImageFilter.hxx index da780a8ca59..070af3ed801 100644 --- a/Modules/Registration/Common/include/itkRecursiveMultiResolutionPyramidImageFilter.hxx +++ b/Modules/Registration/Common/include/itkRecursiveMultiResolutionPyramidImageFilter.hxx @@ -348,13 +348,10 @@ RecursiveMultiResolutionPyramidImageFilter::GenerateI } // compute baseIndex and baseSize - using SizeType = typename OutputImageType::SizeType; - using IndexType = typename OutputImageType::IndexType; using RegionType = typename OutputImageType::RegionType; unsigned int refLevel = this->GetNumberOfLevels() - 1; - SizeType baseSize = this->GetOutput(refLevel)->GetRequestedRegion().GetSize(); - IndexType baseIndex = this->GetOutput(refLevel)->GetRequestedRegion().GetIndex(); + auto [baseIndex, baseSize] = this->GetOutput(refLevel)->GetRequestedRegion(); unsigned int idim; for (idim = 0; idim < ImageDimension; ++idim) diff --git a/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx b/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx index 3d0d8c039c3..974fa07c93d 100644 --- a/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx +++ b/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx @@ -792,8 +792,7 @@ typename SyNImageRegistrationMethodGetLargestPossibleRegion(); - const typename DisplacementFieldType::SizeType size = region.GetSize(); - const typename DisplacementFieldType::IndexType startIndex = region.GetIndex(); + const auto [startIndex, size] = region; ImageRegionConstIteratorWithIndex ItF(field, field->GetLargestPossibleRegion()); ImageRegionIteratorWithIndex ItS(smoothField, smoothField->GetLargestPossibleRegion()); diff --git a/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx b/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx index 460185a1e97..88215382ece 100644 --- a/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx +++ b/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx @@ -776,8 +776,7 @@ TimeVaryingBSplineVelocityFieldImageRegistrationMethod< gradientField->SetRegions(virtualDomainImage->GetRequestedRegion()); gradientField->Allocate(); - typename DisplacementFieldType::IndexType gradientFieldIndex = gradientField->GetRequestedRegion().GetIndex(); - typename DisplacementFieldType::SizeType gradientFieldSize = gradientField->GetRequestedRegion().GetSize(); + auto [gradientFieldIndex, gradientFieldSize] = gradientField->GetRequestedRegion(); SizeValueType localCount = 0; for (ImageRegionConstIteratorWithOnlyIndex ItG(gradientField, diff --git a/Modules/Registration/RegistrationMethodsv4/test/itkTimeVaryingVelocityFieldImageRegistrationTest.cxx b/Modules/Registration/RegistrationMethodsv4/test/itkTimeVaryingVelocityFieldImageRegistrationTest.cxx index 39d6d4015cc..defd92a6e06 100644 --- a/Modules/Registration/RegistrationMethodsv4/test/itkTimeVaryingVelocityFieldImageRegistrationTest.cxx +++ b/Modules/Registration/RegistrationMethodsv4/test/itkTimeVaryingVelocityFieldImageRegistrationTest.cxx @@ -206,8 +206,7 @@ PerformTimeVaryingVelocityFieldImageRegistration(int argc, char * argv[]) velocityFieldSpacing.Fill(1.0); velocityFieldDirection.SetIdentity(); - typename FixedImageType::IndexType fixedImageIndex = fixedImage->GetBufferedRegion().GetIndex(); - typename FixedImageType::SizeType fixedImageSize = fixedImage->GetBufferedRegion().GetSize(); + auto [fixedImageIndex, fixedImageSize] = fixedImage->GetBufferedRegion(); typename FixedImageType::PointType fixedImageOrigin = fixedImage->GetOrigin(); typename FixedImageType::SpacingType fixedImageSpacing = fixedImage->GetSpacing(); typename FixedImageType::DirectionType fixedImageDirection = fixedImage->GetDirection(); diff --git a/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx b/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx index 8557a57870b..cc3a3ed22c3 100644 --- a/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx +++ b/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx @@ -350,8 +350,7 @@ ParallelSparseFieldLevelSetImageFilter::ConstructActi ValueType value; StatusType layer_number; - typename OutputImageType::SizeType regionSize = m_OutputImage->GetRequestedRegion().GetSize(); - typename OutputImageType::IndexType startIndex = m_OutputImage->GetRequestedRegion().GetIndex(); + auto [startIndex, regionSize] = m_OutputImage->GetRequestedRegion(); using StartIndexValueType = IndexValueType; for (NeighborhoodIterator outputIt( diff --git a/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.hxx b/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.hxx index fd9e28eeb79..e0ef2c717d1 100644 --- a/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.hxx +++ b/Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.hxx @@ -94,15 +94,12 @@ Segmenter::GenerateData() ImageRegionType thresholdLargestPossibleRegion = this->GetLargestPossibleRegion(); // First we have to find the boundaries and adjust the threshold image size - typename ImageRegionType::IndexType tidx = thresholdImageRegion.GetIndex(); - typename ImageRegionType::SizeType tsz = thresholdImageRegion.GetSize(); - typename ImageRegionType::IndexType tlidx = thresholdLargestPossibleRegion.GetIndex(); - typename ImageRegionType::SizeType tlsz = thresholdLargestPossibleRegion.GetSize(); + auto [tidx, tsz] = thresholdImageRegion; + auto [tlidx, tlsz] = thresholdLargestPossibleRegion; for (i = 0; i < ImageDimension; ++i) { - ImageRegionType reg; - typename ImageRegionType::IndexType idx = regionToProcess.GetIndex(); - typename ImageRegionType::SizeType sz = regionToProcess.GetSize(); + ImageRegionType reg; + auto [idx, sz] = regionToProcess; // Set LOW face idx[i] = regionToProcess.GetIndex()[i]; diff --git a/Modules/Video/Core/include/itkImageToVideoFilter.hxx b/Modules/Video/Core/include/itkImageToVideoFilter.hxx index 5dee3ed595a..0c4ce14b94f 100644 --- a/Modules/Video/Core/include/itkImageToVideoFilter.hxx +++ b/Modules/Video/Core/include/itkImageToVideoFilter.hxx @@ -98,9 +98,8 @@ ImageToVideoFilter::GenerateOutputInformation() const InputImageType * input = this->GetInput(); // Get first input frame's largest possible spatial region - InputImageRegionType inputRegion = input->GetLargestPossibleRegion(); - typename InputImageType::SizeType inputSize = inputRegion.GetSize(); - typename InputImageType::IndexType inputIndex = inputRegion.GetIndex(); + InputImageRegionType inputRegion = input->GetLargestPossibleRegion(); + auto [inputIndex, inputSize] = inputRegion; typename InputImageType::SpacingType inputSpacing = input->GetSpacing(); typename InputImageType::PointType inputOrigin = input->GetOrigin(); From b4efee3ff3a334ae79bc786b73a95e00c26a4252 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Thu, 28 Dec 2023 01:30:03 +0100 Subject: [PATCH 2/3] STYLE: Add `const` to `auto [index, size] = region` structured bindings Added `const`, whenever the values of the bindings were not modified, after the declaration. --- Modules/Bridge/VTK/include/itkVTKImageExport.hxx | 4 ++-- Modules/Bridge/VTK/include/itkVTKImageImport.hxx | 2 +- .../Core/Common/include/itkPeriodicBoundaryCondition.hxx | 6 +++--- .../Common/include/itkZeroFluxNeumannBoundaryCondition.hxx | 6 +++--- Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx | 2 +- .../include/itkGaussianInterpolateImageFunction.hxx | 2 +- .../include/itkSpatialObjectToImageStatisticsCalculator.hxx | 2 +- .../include/itkMRIBiasFieldCorrectionFilter.hxx | 2 +- .../Convolution/include/itkFFTConvolutionImageFilter.hxx | 6 +++--- ...anSmoothingOnUpdateTimeVaryingVelocityFieldTransform.hxx | 2 +- .../FFT/include/itkHalfToFullHermitianImageFilter.hxx | 4 ++-- ...uencyShiftedFFTLayoutImageRegionConstIteratorWithIndex.h | 2 +- Modules/Filtering/ImageGrid/include/itkCropImageFilter.hxx | 2 +- .../Filtering/ImageGrid/include/itkMirrorPadImageFilter.hxx | 2 +- .../ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx | 6 +++--- .../ImageStatistics/include/itkProjectionImageFilter.hxx | 4 ++-- .../Filtering/LabelMap/include/itkCropLabelMapFilter.hxx | 2 +- Modules/Filtering/LabelMap/include/itkPadLabelMapFilter.hxx | 2 +- .../include/itkSharedMorphologyUtilities.hxx | 4 ++-- .../Smoothing/include/itkBinomialBlurImageFilter.hxx | 2 +- Modules/IO/GDCM/test/itkGDCMImageReadSeriesWriteTest.cxx | 2 +- .../itkImageFileWriterUpdateLargestPossibleRegionTest.cxx | 2 +- .../NarrowBand/test/itkNarrowBandImageFilterBaseTest.cxx | 2 +- .../Statistics/include/itkSpatialNeighborSubsampler.hxx | 2 +- .../include/itkUniformRandomSpatialNeighborSubsampler.hxx | 2 +- .../include/itkMultiResolutionImageRegistrationMethod.hxx | 2 +- ...meVaryingBSplineVelocityFieldImageRegistrationMethod.hxx | 2 +- .../include/itkParallelSparseFieldLevelSetImageFilter.hxx | 2 +- Modules/Video/Core/include/itkImageToVideoFilter.hxx | 2 +- 29 files changed, 41 insertions(+), 41 deletions(-) diff --git a/Modules/Bridge/VTK/include/itkVTKImageExport.hxx b/Modules/Bridge/VTK/include/itkVTKImageExport.hxx index eb97c368ace..72a97d00bf2 100644 --- a/Modules/Bridge/VTK/include/itkVTKImageExport.hxx +++ b/Modules/Bridge/VTK/include/itkVTKImageExport.hxx @@ -145,7 +145,7 @@ VTKImageExport::WholeExtentCallback() } InputRegionType region = input->GetLargestPossibleRegion(); - auto [index, size] = region; + const auto [index, size] = region; unsigned int i = 0; // Fill in the known portion of the extent. @@ -386,7 +386,7 @@ VTKImageExport::DataExtentCallback() } InputRegionType region = input->GetBufferedRegion(); - auto [index, size] = region; + const auto [index, size] = region; unsigned int i = 0; for (; i < InputImageDimension; ++i) diff --git a/Modules/Bridge/VTK/include/itkVTKImageImport.hxx b/Modules/Bridge/VTK/include/itkVTKImageImport.hxx index 06847f12ec1..d8611e6fa85 100644 --- a/Modules/Bridge/VTK/include/itkVTKImageImport.hxx +++ b/Modules/Bridge/VTK/include/itkVTKImageImport.hxx @@ -113,7 +113,7 @@ VTKImageImport::PropagateRequestedRegion(DataObject * outputPtr) if (m_PropagateUpdateExtentCallback) { OutputRegionType region = output->GetRequestedRegion(); - auto [index, size] = region; + const auto [index, size] = region; int updateExtent[6]; unsigned int i = 0; diff --git a/Modules/Core/Common/include/itkPeriodicBoundaryCondition.hxx b/Modules/Core/Common/include/itkPeriodicBoundaryCondition.hxx index 39eea96f0d3..5b682670a59 100644 --- a/Modules/Core/Common/include/itkPeriodicBoundaryCondition.hxx +++ b/Modules/Core/Common/include/itkPeriodicBoundaryCondition.hxx @@ -138,9 +138,9 @@ PeriodicBoundaryCondition::GetInputRequestedRegion( const RegionType & inputLargestPossibleRegion, const RegionType & outputRequestedRegion) const -> RegionType { - auto [imageIndex, imageSize] = inputLargestPossibleRegion; + const auto [imageIndex, imageSize] = inputLargestPossibleRegion; - auto [outputIndex, outputSize] = outputRequestedRegion; + const auto [outputIndex, outputSize] = outputRequestedRegion; IndexType inputRequestedIndex; SizeType inputRequestedSize; @@ -182,7 +182,7 @@ PeriodicBoundaryCondition::GetPixel(const IndexType & -> OutputPixelType { RegionType imageRegion = image->GetLargestPossibleRegion(); - auto [imageIndex, imageSize] = imageRegion; + const auto [imageIndex, imageSize] = imageRegion; IndexType lookupIndex; diff --git a/Modules/Core/Common/include/itkZeroFluxNeumannBoundaryCondition.hxx b/Modules/Core/Common/include/itkZeroFluxNeumannBoundaryCondition.hxx index f7a1ea29390..0d4fb4e401c 100644 --- a/Modules/Core/Common/include/itkZeroFluxNeumannBoundaryCondition.hxx +++ b/Modules/Core/Common/include/itkZeroFluxNeumannBoundaryCondition.hxx @@ -86,9 +86,9 @@ ZeroFluxNeumannBoundaryCondition::GetInputRequestedRe const RegionType & inputLargestPossibleRegion, const RegionType & outputRequestedRegion) const -> RegionType { - auto [inputIndex, inputSize] = inputLargestPossibleRegion; + const auto [inputIndex, inputSize] = inputLargestPossibleRegion; - auto [outputIndex, outputSize] = outputRequestedRegion; + const auto [outputIndex, outputSize] = outputRequestedRegion; IndexType requestIndex; SizeType requestSize; @@ -154,7 +154,7 @@ ZeroFluxNeumannBoundaryCondition::GetPixel(const Inde -> OutputPixelType { RegionType imageRegion = image->GetLargestPossibleRegion(); - auto [imageIndex, imageSize] = imageRegion; + const auto [imageIndex, imageSize] = imageRegion; IndexType lookupIndex; diff --git a/Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx b/Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx index 48292018cd4..d400b37b993 100644 --- a/Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx +++ b/Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx @@ -33,7 +33,7 @@ GPUImageDataManager::SetImagePointer(ImageType * img) using SizeType = typename ImageType::SizeType; RegionType region = m_Image->GetBufferedRegion(); - auto [index, size] = region; + const auto [index, size] = region; for (unsigned int d = 0; d < ImageDimension; ++d) { diff --git a/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.hxx b/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.hxx index 7099fffc353..fd59347656d 100644 --- a/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.hxx +++ b/Modules/Core/ImageFunction/include/itkGaussianInterpolateImageFunction.hxx @@ -58,7 +58,7 @@ GaussianInterpolateImageFunction::ComputeBoundingBox() typename InputImageType::ConstPointer input = this->GetInputImage(); typename InputImageType::SpacingType spacing = input->GetSpacing(); - auto [index, size] = input->GetLargestPossibleRegion(); + const auto [index, size] = input->GetLargestPossibleRegion(); for (unsigned int d = 0; d < ImageDimension; ++d) { diff --git a/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.hxx b/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.hxx index 9211c61aed5..3877173f56c 100644 --- a/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.hxx +++ b/Modules/Core/SpatialObjects/include/itkSpatialObjectToImageStatisticsCalculator.hxx @@ -163,7 +163,7 @@ SpatialObjectToImageStatisticsCalculatorTransformPhysicalPointToIndex(ptMin); auto indMax = m_Image->TransformPhysicalPointToIndex(ptMax); - auto [imageIndex, imageSize] = m_Image->GetLargestPossibleRegion(); + const auto [imageIndex, imageSize] = m_Image->GetLargestPossibleRegion(); for (unsigned int i = 0; i < Self::ObjectDimension; ++i) { if (indMin[i] > indMax[i]) diff --git a/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.hxx b/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.hxx index 434127772f7..18d1b217ace 100644 --- a/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.hxx +++ b/Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.hxx @@ -881,7 +881,7 @@ MRIBiasFieldCorrectionFilter::AdjustSlabR SlabRegionVectorType & slabs, OutputImageRegionType requestedRegion) { - auto [indexFirst, size] = requestedRegion; + const auto [indexFirst, size] = requestedRegion; OutputImageIndexType indexLast = indexFirst; for (SizeValueType i = 0; i < ImageDimension; ++i) diff --git a/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx b/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx index 4fb4013f5d7..1182227332f 100644 --- a/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx +++ b/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx @@ -150,11 +150,11 @@ FFTConvolutionImageFilterGetLargestPossibleRegion(); - auto [inputLargestIndex, inputLargestSize] = inputLargestRegion; + const auto [inputLargestIndex, inputLargestSize] = inputLargestRegion; InputRegionType inputRequestedRegion = input->GetRequestedRegion(); - auto [inputRequestedIndex, inputRequestedSize] = inputRequestedRegion; + const auto [inputRequestedIndex, inputRequestedSize] = inputRequestedRegion; OutputRegionType outputRequestedRegion = this->GetOutput()->GetRequestedRegion(); - auto [outputRequestedIndex, outputRequestedSize] = outputRequestedRegion; + const auto [outputRequestedIndex, outputRequestedSize] = outputRequestedRegion; // Pad the input image such that the requested region, expanded by // twice the kernel radius, lies entirely within the buffered region. diff --git a/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.hxx b/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.hxx index 3bbd773c57b..20cb3fe585c 100644 --- a/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.hxx +++ b/Modules/Filtering/DisplacementField/include/itkGaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransform.hxx @@ -198,7 +198,7 @@ GaussianSmoothingOnUpdateTimeVaryingVelocityFieldTransformGetLargestPossibleRegion(); + const auto [startIndex, size] = field->GetLargestPossibleRegion(); ImageRegionIteratorWithIndex fieldIt(field, field->GetLargestPossibleRegion()); ImageRegionConstIteratorWithIndex smoothedFieldIt(smoothField, diff --git a/Modules/Filtering/FFT/include/itkHalfToFullHermitianImageFilter.hxx b/Modules/Filtering/FFT/include/itkHalfToFullHermitianImageFilter.hxx index fd80b4d7b94..8a7ba98dddb 100644 --- a/Modules/Filtering/FFT/include/itkHalfToFullHermitianImageFilter.hxx +++ b/Modules/Filtering/FFT/include/itkHalfToFullHermitianImageFilter.hxx @@ -119,7 +119,7 @@ HalfToFullHermitianImageFilter::DynamicThreadedGenerateData( // Now copy the redundant complex conjugate region, if there is one // in this thread's output region. - auto [outputRegionIndex, outputRegionSize] = outputRegionForThread; + const auto [outputRegionIndex, outputRegionSize] = outputRegionForThread; OutputImageIndexType outputRegionMaximumIndex = outputRegionIndex + outputRegionSize; if (outputRegionMaximumIndex[0] > inputRegionMaximumIndex[0]) @@ -140,7 +140,7 @@ HalfToFullHermitianImageFilter::DynamicThreadedGenerateData( for (unsigned int i = 0; i < ImageDimension; ++i) { OutputImageRegionType outputLargestPossibleRegion = outputPtr->GetLargestPossibleRegion(); - auto [outputLargestPossibleRegionIndex, outputLargestPossibleRegionSize] = outputLargestPossibleRegion; + const auto [outputLargestPossibleRegionIndex, outputLargestPossibleRegionSize] = outputLargestPossibleRegion; if (conjugateIndex[i] != outputLargestPossibleRegionIndex[i]) { index[i] = outputLargestPossibleRegionSize[i] - conjugateIndex[i] + 2 * outputLargestPossibleRegionIndex[i]; diff --git a/Modules/Filtering/ImageFrequency/include/itkFrequencyShiftedFFTLayoutImageRegionConstIteratorWithIndex.h b/Modules/Filtering/ImageFrequency/include/itkFrequencyShiftedFFTLayoutImageRegionConstIteratorWithIndex.h index 538f5603cd3..30c228fd55c 100644 --- a/Modules/Filtering/ImageFrequency/include/itkFrequencyShiftedFFTLayoutImageRegionConstIteratorWithIndex.h +++ b/Modules/Filtering/ImageFrequency/include/itkFrequencyShiftedFFTLayoutImageRegionConstIteratorWithIndex.h @@ -249,7 +249,7 @@ class ITK_TEMPLATE_EXPORT FrequencyShiftedFFTLayoutImageRegionConstIteratorWithI void Init() { - auto [minIndex, sizeImage] = this->m_Image->GetLargestPossibleRegion(); + const auto [minIndex, sizeImage] = this->m_Image->GetLargestPossibleRegion(); for (unsigned int dim = 0; dim < ImageType::ImageDimension; ++dim) { this->m_ZeroFrequencyIndex[dim] = diff --git a/Modules/Filtering/ImageGrid/include/itkCropImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkCropImageFilter.hxx index d070afb669f..fd8abc1af7b 100644 --- a/Modules/Filtering/ImageGrid/include/itkCropImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkCropImageFilter.hxx @@ -36,7 +36,7 @@ CropImageFilter::GenerateOutputInformation() SizeType sz; OutputImageIndexType idx; - auto [input_idx, input_sz] = inputPtr->GetLargestPossibleRegion(); + const auto [input_idx, input_sz] = inputPtr->GetLargestPossibleRegion(); for (unsigned int i = 0; i < InputImageDimension; ++i) { diff --git a/Modules/Filtering/ImageGrid/include/itkMirrorPadImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkMirrorPadImageFilter.hxx index 2f9e5f7bd06..921d0f456b3 100644 --- a/Modules/Filtering/ImageGrid/include/itkMirrorPadImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkMirrorPadImageFilter.hxx @@ -185,7 +185,7 @@ MirrorPadImageFilter::ConvertOutputIndexToInputIndex( long a, b, c; // Output region goes from a to a+b-1 // Input region goes from c to c+b-1 OutputImageIndexType outputRegionStart = outputRegion.GetIndex(); - auto [inputRegionStart, inputSizes] = inputRegion; + const auto [inputRegionStart, inputSizes] = inputRegion; for (dimCtr = 0; dimCtr < ImageDimension; ++dimCtr) { diff --git a/Modules/Filtering/ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx b/Modules/Filtering/ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx index ba813fc81b2..2f3649bb726 100644 --- a/Modules/Filtering/ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx +++ b/Modules/Filtering/ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx @@ -33,7 +33,7 @@ static bool VerifyFilterOutput(const ShortImage * inputImage, const FloatImage * outputImage) { ShortImage::RegionType inputRegion = inputImage->GetLargestPossibleRegion(); - auto [inputIndex, inputSize] = inputRegion; + const auto [inputIndex, inputSize] = inputRegion; ShortImage::RegionType outputRegion = outputImage->GetLargestPossibleRegion(); itk::ImageRegionConstIteratorWithIndex outputIterator(outputImage, outputRegion); @@ -105,10 +105,10 @@ VerifyFilter(const ShortImage * inputImage, } ShortImage::RegionType outputRegion = padFilter->GetOutput()->GetLargestPossibleRegion(); - auto [outputIndex, outputSize] = outputRegion; + const auto [outputIndex, outputSize] = outputRegion; ShortImage::RegionType inputRegion = inputImage->GetLargestPossibleRegion(); - auto [inputIndex, inputSize] = inputRegion; + const auto [inputIndex, inputSize] = inputRegion; ShortImage::IndexType expectedIndex; ShortImage::SizeType expectedSize; diff --git a/Modules/Filtering/ImageStatistics/include/itkProjectionImageFilter.hxx b/Modules/Filtering/ImageStatistics/include/itkProjectionImageFilter.hxx index 934dc4fd6b1..e6e690314b8 100644 --- a/Modules/Filtering/ImageStatistics/include/itkProjectionImageFilter.hxx +++ b/Modules/Filtering/ImageStatistics/include/itkProjectionImageFilter.hxx @@ -217,11 +217,11 @@ ProjectionImageFilter::DynamicThreadedG typename TInputImage::RegionType inputRegion = inputImage->GetLargestPossibleRegion(); - auto [inputIndex, inputSize] = inputRegion; + const auto [inputIndex, inputSize] = inputRegion; typename TOutputImage::Pointer outputImage = this->GetOutput(); - auto [outputIndexForThread, outputSizeForThread] = outputRegionForThread; + const auto [outputIndexForThread, outputSizeForThread] = outputRegionForThread; // compute the input region for this thread typename TInputImage::RegionType inputRegionForThread = inputRegion; diff --git a/Modules/Filtering/LabelMap/include/itkCropLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkCropLabelMapFilter.hxx index 9be1e89d136..e1ea3953900 100644 --- a/Modules/Filtering/LabelMap/include/itkCropLabelMapFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkCropLabelMapFilter.hxx @@ -46,7 +46,7 @@ CropLabelMapFilter::GenerateOutputInformation() SizeType size; IndexType index; - auto [inputIndex, inputSize] = inputPtr->GetLargestPossibleRegion(); + const auto [inputIndex, inputSize] = inputPtr->GetLargestPossibleRegion(); SizeType originalCropSize = m_UpperBoundaryCropSize + m_LowerBoundaryCropSize; diff --git a/Modules/Filtering/LabelMap/include/itkPadLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkPadLabelMapFilter.hxx index a29e7e5e56f..fee53ddf8d0 100644 --- a/Modules/Filtering/LabelMap/include/itkPadLabelMapFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkPadLabelMapFilter.hxx @@ -45,7 +45,7 @@ PadLabelMapFilter::GenerateOutputInformation() SizeType size; IndexType index; - auto [inputIndex, inputSize] = inputPtr->GetLargestPossibleRegion(); + const auto [inputIndex, inputSize] = inputPtr->GetLargestPossibleRegion(); SizeType originalPadSize = m_UpperBoundaryPadSize + m_LowerBoundaryPadSize; diff --git a/Modules/Filtering/MathematicalMorphology/include/itkSharedMorphologyUtilities.hxx b/Modules/Filtering/MathematicalMorphology/include/itkSharedMorphologyUtilities.hxx index 709c8c10bd6..013ed801292 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkSharedMorphologyUtilities.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkSharedMorphologyUtilities.hxx @@ -45,7 +45,7 @@ NeedToDoFace(const TRegion AllImage, const TRegion face, const TLine line) // find the small dimension of the face - should only be one typename TRegion::IndexType ISt = AllImage.GetIndex(); - auto [FSt, FSz] = face; + const auto [FSt, FSz] = face; unsigned int smallDim = 0; for (unsigned int i = 0; i < AllImage.GetImageDimension(); ++i) @@ -89,7 +89,7 @@ ComputeStartEnd(const typename TImage::IndexType StartIndex, unsigned int & end) { // compute intersection between ray and box - auto [ImStart, ImSize] = AllImage; + const auto [ImStart, ImSize] = AllImage; float Tfar = NumericTraits::max(); float Tnear = NumericTraits::NonpositiveMin(); float domdir = NumericTraits::NonpositiveMin(); diff --git a/Modules/Filtering/Smoothing/include/itkBinomialBlurImageFilter.hxx b/Modules/Filtering/Smoothing/include/itkBinomialBlurImageFilter.hxx index 0bfb6a1486e..a332e376fbb 100644 --- a/Modules/Filtering/Smoothing/include/itkBinomialBlurImageFilter.hxx +++ b/Modules/Filtering/Smoothing/include/itkBinomialBlurImageFilter.hxx @@ -118,7 +118,7 @@ BinomialBlurImageFilter::GenerateData() tempPtr->Allocate(); // How big is the input image? - auto [startIndex, size] = inputPtr->GetRequestedRegion(); + const auto [startIndex, size] = inputPtr->GetRequestedRegion(); // Iterator Typedefs for this routine using TempIterator = ImageRegionIterator; diff --git a/Modules/IO/GDCM/test/itkGDCMImageReadSeriesWriteTest.cxx b/Modules/IO/GDCM/test/itkGDCMImageReadSeriesWriteTest.cxx index 17863b624a7..35a5c44fbd6 100644 --- a/Modules/IO/GDCM/test/itkGDCMImageReadSeriesWriteTest.cxx +++ b/Modules/IO/GDCM/test/itkGDCMImageReadSeriesWriteTest.cxx @@ -84,7 +84,7 @@ itkGDCMImageReadSeriesWriteTest(int argc, char * argv[]) ITK_TEST_SET_GET_VALUE(gdcmIO, seriesWriter->GetImageIO()); ImageType::RegionType region = reader->GetOutput()->GetLargestPossibleRegion(); - auto [start, size] = region; + const auto [start, size] = region; std::string format = outputDirectory; diff --git a/Modules/IO/ImageBase/test/itkImageFileWriterUpdateLargestPossibleRegionTest.cxx b/Modules/IO/ImageBase/test/itkImageFileWriterUpdateLargestPossibleRegionTest.cxx index 75ca0b073bb..a05bb3a1b71 100644 --- a/Modules/IO/ImageBase/test/itkImageFileWriterUpdateLargestPossibleRegionTest.cxx +++ b/Modules/IO/ImageBase/test/itkImageFileWriterUpdateLargestPossibleRegionTest.cxx @@ -46,7 +46,7 @@ itkImageFileWriterUpdateLargestPossibleRegionTest(int argc, char * argv[]) writer->SetFileName(argv[2]); ImageType::RegionType region = reader->GetOutput()->GetLargestPossibleRegion(); - auto [index, size] = region; + const auto [index, size] = region; itk::ImageIORegion ioregion(2); ioregion.SetIndex(0, index[0]); diff --git a/Modules/Numerics/NarrowBand/test/itkNarrowBandImageFilterBaseTest.cxx b/Modules/Numerics/NarrowBand/test/itkNarrowBandImageFilterBaseTest.cxx index b2c2ab40a9d..2d9aecfa21d 100644 --- a/Modules/Numerics/NarrowBand/test/itkNarrowBandImageFilterBaseTest.cxx +++ b/Modules/Numerics/NarrowBand/test/itkNarrowBandImageFilterBaseTest.cxx @@ -73,7 +73,7 @@ class NbTestClass : public NarrowBandImageFilterBaseGetInput()->GetRequestedRegion(); + const auto [tl, sz] = this->GetInput()->GetRequestedRegion(); typename Superclass::IndexType in; for (in [0] = 32 + tl[0]; in[0] < tl[0] + static_cast(sz[0]); in[0]++) diff --git a/Modules/Numerics/Statistics/include/itkSpatialNeighborSubsampler.hxx b/Modules/Numerics/Statistics/include/itkSpatialNeighborSubsampler.hxx index 467f01d2872..67f3855c61f 100644 --- a/Modules/Numerics/Statistics/include/itkSpatialNeighborSubsampler.hxx +++ b/Modules/Numerics/Statistics/include/itkSpatialNeighborSubsampler.hxx @@ -101,7 +101,7 @@ SpatialNeighborSubsampler::Search(const InstanceIdentifier & q SizeType searchSize; IndexType endIndex; - auto [constraintIndex, constraintSize] = this->m_RegionConstraint; + const auto [constraintIndex, constraintSize] = this->m_RegionConstraint; IndexType queryIndex; typename RegionType::OffsetTableType offsetTable; diff --git a/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx b/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx index 218b06c7a77..c33224f8f6c 100644 --- a/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx +++ b/Modules/Numerics/Statistics/include/itkUniformRandomSpatialNeighborSubsampler.hxx @@ -75,7 +75,7 @@ UniformRandomSpatialNeighborSubsampler::Search(const InstanceI IndexType searchStartIndex; IndexType searchEndIndex; - auto [constraintIndex, constraintSize] = this->m_RegionConstraint; + const auto [constraintIndex, constraintSize] = this->m_RegionConstraint; IndexType queryIndex; typename RegionType::OffsetTableType offsetTable; diff --git a/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.hxx b/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.hxx index 657edff4383..0c000ba1a18 100644 --- a/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.hxx +++ b/Modules/Registration/Common/include/itkMultiResolutionImageRegistrationMethod.hxx @@ -227,7 +227,7 @@ MultiResolutionImageRegistrationMethod::PreparePyrami ScheduleType movingschedule = m_MovingImagePyramid->GetSchedule(); itkDebugMacro("MovingImage schedule: " << movingschedule); - auto [inputStart, inputSize] = m_FixedImageRegion; + const auto [inputStart, inputSize] = m_FixedImageRegion; const SizeValueType numberOfLevels = m_FixedImagePyramid->GetNumberOfLevels(); diff --git a/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx b/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx index 88215382ece..467f65373c3 100644 --- a/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx +++ b/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingBSplineVelocityFieldImageRegistrationMethod.hxx @@ -776,7 +776,7 @@ TimeVaryingBSplineVelocityFieldImageRegistrationMethod< gradientField->SetRegions(virtualDomainImage->GetRequestedRegion()); gradientField->Allocate(); - auto [gradientFieldIndex, gradientFieldSize] = gradientField->GetRequestedRegion(); + const auto [gradientFieldIndex, gradientFieldSize] = gradientField->GetRequestedRegion(); SizeValueType localCount = 0; for (ImageRegionConstIteratorWithOnlyIndex ItG(gradientField, diff --git a/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx b/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx index cc3a3ed22c3..ebbf1a4661d 100644 --- a/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx +++ b/Modules/Segmentation/LevelSets/include/itkParallelSparseFieldLevelSetImageFilter.hxx @@ -350,7 +350,7 @@ ParallelSparseFieldLevelSetImageFilter::ConstructActi ValueType value; StatusType layer_number; - auto [startIndex, regionSize] = m_OutputImage->GetRequestedRegion(); + const auto [startIndex, regionSize] = m_OutputImage->GetRequestedRegion(); using StartIndexValueType = IndexValueType; for (NeighborhoodIterator outputIt( diff --git a/Modules/Video/Core/include/itkImageToVideoFilter.hxx b/Modules/Video/Core/include/itkImageToVideoFilter.hxx index 0c4ce14b94f..e691fd7e7df 100644 --- a/Modules/Video/Core/include/itkImageToVideoFilter.hxx +++ b/Modules/Video/Core/include/itkImageToVideoFilter.hxx @@ -99,7 +99,7 @@ ImageToVideoFilter::GenerateOutputInformation() // Get first input frame's largest possible spatial region InputImageRegionType inputRegion = input->GetLargestPossibleRegion(); - auto [inputIndex, inputSize] = inputRegion; + const auto [inputIndex, inputSize] = inputRegion; typename InputImageType::SpacingType inputSpacing = input->GetSpacing(); typename InputImageType::PointType inputOrigin = input->GetOrigin(); From b2e62ee3a5625d021b28316272bfd1161748d74b Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Sun, 14 Jan 2024 18:31:17 +0100 Subject: [PATCH 3/3] STYLE: Remove local "region" variables used only for structured bindings Removed those local "region" variables, as they appear that appear no longer useful. --- Modules/Bridge/VTK/include/itkVTKImageExport.hxx | 6 ++---- Modules/Bridge/VTK/include/itkVTKImageImport.hxx | 3 +-- .../Core/Common/include/itkPeriodicBoundaryCondition.hxx | 3 +-- Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx | 3 +-- .../Convolution/include/itkConvolutionImageFilterBase.hxx | 4 +--- .../Convolution/include/itkFFTConvolutionImageFilter.hxx | 3 +-- .../itkGaussianExponentialDiffeomorphicTransform.hxx | 3 +-- .../include/itkInvertDisplacementFieldImageFilter.hxx | 3 +-- .../itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx | 5 +---- .../FFT/include/itkHalfToFullHermitianImageFilter.hxx | 4 ++-- .../ImageGrid/include/itkSliceBySliceImageFilter.hxx | 3 +-- .../ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx | 6 ++---- Modules/IO/GDCM/test/itkGDCMImageReadSeriesWriteTest.cxx | 4 +--- .../itkImageFileWriterUpdateLargestPossibleRegionTest.cxx | 3 +-- .../itkDirectFourierReconstructionImageToImageFilter.hxx | 3 +-- .../test/itkDiscreteHessianGaussianImageFunctionTest.cxx | 5 ++--- .../include/itkSyNImageRegistrationMethod.hxx | 3 +-- Modules/Video/Core/include/itkImageToVideoFilter.hxx | 3 +-- 18 files changed, 22 insertions(+), 45 deletions(-) diff --git a/Modules/Bridge/VTK/include/itkVTKImageExport.hxx b/Modules/Bridge/VTK/include/itkVTKImageExport.hxx index 72a97d00bf2..9231b4bef26 100644 --- a/Modules/Bridge/VTK/include/itkVTKImageExport.hxx +++ b/Modules/Bridge/VTK/include/itkVTKImageExport.hxx @@ -144,8 +144,7 @@ VTKImageExport::WholeExtentCallback() itkExceptionMacro("Need to set an input"); } - InputRegionType region = input->GetLargestPossibleRegion(); - const auto [index, size] = region; + const auto [index, size] = input->GetLargestPossibleRegion(); unsigned int i = 0; // Fill in the known portion of the extent. @@ -385,8 +384,7 @@ VTKImageExport::DataExtentCallback() itkExceptionMacro("Need to set an input"); } - InputRegionType region = input->GetBufferedRegion(); - const auto [index, size] = region; + const auto [index, size] = input->GetBufferedRegion(); unsigned int i = 0; for (; i < InputImageDimension; ++i) diff --git a/Modules/Bridge/VTK/include/itkVTKImageImport.hxx b/Modules/Bridge/VTK/include/itkVTKImageImport.hxx index d8611e6fa85..4ddf56ff0e8 100644 --- a/Modules/Bridge/VTK/include/itkVTKImageImport.hxx +++ b/Modules/Bridge/VTK/include/itkVTKImageImport.hxx @@ -112,8 +112,7 @@ VTKImageImport::PropagateRequestedRegion(DataObject * outputPtr) Superclass::PropagateRequestedRegion(output); if (m_PropagateUpdateExtentCallback) { - OutputRegionType region = output->GetRequestedRegion(); - const auto [index, size] = region; + const auto [index, size] = output->GetRequestedRegion(); int updateExtent[6]; unsigned int i = 0; diff --git a/Modules/Core/Common/include/itkPeriodicBoundaryCondition.hxx b/Modules/Core/Common/include/itkPeriodicBoundaryCondition.hxx index 5b682670a59..bdf4569f8db 100644 --- a/Modules/Core/Common/include/itkPeriodicBoundaryCondition.hxx +++ b/Modules/Core/Common/include/itkPeriodicBoundaryCondition.hxx @@ -181,8 +181,7 @@ auto PeriodicBoundaryCondition::GetPixel(const IndexType & index, const TInputImage * image) const -> OutputPixelType { - RegionType imageRegion = image->GetLargestPossibleRegion(); - const auto [imageIndex, imageSize] = imageRegion; + const auto [imageIndex, imageSize] = image->GetLargestPossibleRegion(); IndexType lookupIndex; diff --git a/Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx b/Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx index d400b37b993..a0ae3ceaef8 100644 --- a/Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx +++ b/Modules/Core/GPUCommon/include/itkGPUImageDataManager.hxx @@ -32,8 +32,7 @@ GPUImageDataManager::SetImagePointer(ImageType * img) using IndexType = typename ImageType::IndexType; using SizeType = typename ImageType::SizeType; - RegionType region = m_Image->GetBufferedRegion(); - const auto [index, size] = region; + const auto [index, size] = m_Image->GetBufferedRegion(); for (unsigned int d = 0; d < ImageDimension; ++d) { diff --git a/Modules/Filtering/Convolution/include/itkConvolutionImageFilterBase.hxx b/Modules/Filtering/Convolution/include/itkConvolutionImageFilterBase.hxx index bf1eab4374b..cc912cf4b74 100644 --- a/Modules/Filtering/Convolution/include/itkConvolutionImageFilterBase.hxx +++ b/Modules/Filtering/Convolution/include/itkConvolutionImageFilterBase.hxx @@ -52,9 +52,7 @@ ConvolutionImageFilterBase::GetValidReg { typename InputImageType::ConstPointer inputPtr = this->GetInput(); - InputRegionType inputLargestPossibleRegion = inputPtr->GetLargestPossibleRegion(); - - auto [validIndex, validSize] = inputLargestPossibleRegion; + auto [validIndex, validSize] = inputPtr->GetLargestPossibleRegion(); // Shrink the output largest possible region by the kernel radius. KernelSizeType kernelSize = this->GetKernelImage()->GetLargestPossibleRegion().GetSize(); diff --git a/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx b/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx index 1182227332f..a800c9dec1d 100644 --- a/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx +++ b/Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx @@ -151,8 +151,7 @@ FFTConvolutionImageFilterGetLargestPossibleRegion(); const auto [inputLargestIndex, inputLargestSize] = inputLargestRegion; - InputRegionType inputRequestedRegion = input->GetRequestedRegion(); - const auto [inputRequestedIndex, inputRequestedSize] = inputRequestedRegion; + const auto [inputRequestedIndex, inputRequestedSize] = input->GetRequestedRegion(); OutputRegionType outputRequestedRegion = this->GetOutput()->GetRequestedRegion(); const auto [outputRequestedIndex, outputRequestedSize] = outputRequestedRegion; diff --git a/Modules/Filtering/DisplacementField/include/itkGaussianExponentialDiffeomorphicTransform.hxx b/Modules/Filtering/DisplacementField/include/itkGaussianExponentialDiffeomorphicTransform.hxx index 4a9b6743688..3acef350edc 100644 --- a/Modules/Filtering/DisplacementField/include/itkGaussianExponentialDiffeomorphicTransform.hxx +++ b/Modules/Filtering/DisplacementField/include/itkGaussianExponentialDiffeomorphicTransform.hxx @@ -190,8 +190,7 @@ GaussianExponentialDiffeomorphicTransform::Gau } ScalarType weight2 = 1.0 - weight1; - const typename ConstantVelocityFieldType::RegionType region = field->GetLargestPossibleRegion(); - const auto [startIndex, size] = region; + const auto [startIndex, size] = field->GetLargestPossibleRegion(); ImageRegionIteratorWithIndex fieldIt(field, field->GetLargestPossibleRegion()); ImageRegionConstIteratorWithIndex smoothedFieldIt(smoothField, diff --git a/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx b/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx index f2b59d3fffe..db6a9ad87af 100644 --- a/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx +++ b/Modules/Filtering/DisplacementField/include/itkInvertDisplacementFieldImageFilter.hxx @@ -168,8 +168,7 @@ template void InvertDisplacementFieldImageFilter::DynamicThreadedGenerateData(const RegionType & region) { - const typename DisplacementFieldType::RegionType fullRegion = this->m_ComposedField->GetRequestedRegion(); - const auto [startIndex, size] = fullRegion; + const auto [startIndex, size] = this->m_ComposedField->GetRequestedRegion(); const typename DisplacementFieldType::PixelType zeroVector{}; ImageRegionIterator ItE(this->m_ComposedField, region); diff --git a/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx b/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx index 322bd11ccc1..ae4b5b8acdc 100644 --- a/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx +++ b/Modules/Filtering/DisplacementField/include/itkTimeVaryingVelocityFieldIntegrationImageFilter.hxx @@ -187,10 +187,7 @@ TimeVaryingVelocityFieldIntegrationImageFilterGetOrigin(); - using RegionType = typename TimeVaryingVelocityFieldType::RegionType; - RegionType region = inputField->GetLargestPossibleRegion(); - - auto [lastIndex, size] = region; + auto [lastIndex, size] = inputField->GetLargestPossibleRegion(); for (unsigned int d = 0; d < InputImageDimension; ++d) { lastIndex[d] += (size[d] - 1); diff --git a/Modules/Filtering/FFT/include/itkHalfToFullHermitianImageFilter.hxx b/Modules/Filtering/FFT/include/itkHalfToFullHermitianImageFilter.hxx index 8a7ba98dddb..0bdec4bbbbc 100644 --- a/Modules/Filtering/FFT/include/itkHalfToFullHermitianImageFilter.hxx +++ b/Modules/Filtering/FFT/include/itkHalfToFullHermitianImageFilter.hxx @@ -139,8 +139,8 @@ HalfToFullHermitianImageFilter::DynamicThreadedGenerateData( OutputImageIndexType index(conjugateIndex); for (unsigned int i = 0; i < ImageDimension; ++i) { - OutputImageRegionType outputLargestPossibleRegion = outputPtr->GetLargestPossibleRegion(); - const auto [outputLargestPossibleRegionIndex, outputLargestPossibleRegionSize] = outputLargestPossibleRegion; + const auto [outputLargestPossibleRegionIndex, outputLargestPossibleRegionSize] = + outputPtr->GetLargestPossibleRegion(); if (conjugateIndex[i] != outputLargestPossibleRegionIndex[i]) { index[i] = outputLargestPossibleRegionSize[i] - conjugateIndex[i] + 2 * outputLargestPossibleRegionIndex[i]; diff --git a/Modules/Filtering/ImageGrid/include/itkSliceBySliceImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkSliceBySliceImageFilter.hxx index ff2ced950f3..4abe13449d5 100644 --- a/Modules/Filtering/ImageGrid/include/itkSliceBySliceImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkSliceBySliceImageFilter.hxx @@ -225,8 +225,7 @@ SliceBySliceImageFilterAllocateOutputs(); - const RegionType requestedRegion = this->GetOutput(0)->GetRequestedRegion(); - const auto [requestedIndex, requestedSize] = requestedRegion; + const auto [requestedIndex, requestedSize] = this->GetOutput(0)->GetRequestedRegion(); InternalRegionType internalOutputRegion; InternalRegionType internalInputRegion; diff --git a/Modules/Filtering/ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx b/Modules/Filtering/ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx index 2f3649bb726..715f49df117 100644 --- a/Modules/Filtering/ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx +++ b/Modules/Filtering/ImageGrid/test/itkZeroFluxNeumannPadImageFilterTest.cxx @@ -104,11 +104,9 @@ VerifyFilter(const ShortImage * inputImage, return false; } - ShortImage::RegionType outputRegion = padFilter->GetOutput()->GetLargestPossibleRegion(); - const auto [outputIndex, outputSize] = outputRegion; + const auto [outputIndex, outputSize] = padFilter->GetOutput()->GetLargestPossibleRegion(); - ShortImage::RegionType inputRegion = inputImage->GetLargestPossibleRegion(); - const auto [inputIndex, inputSize] = inputRegion; + const auto [inputIndex, inputSize] = inputImage->GetLargestPossibleRegion(); ShortImage::IndexType expectedIndex; ShortImage::SizeType expectedSize; diff --git a/Modules/IO/GDCM/test/itkGDCMImageReadSeriesWriteTest.cxx b/Modules/IO/GDCM/test/itkGDCMImageReadSeriesWriteTest.cxx index 35a5c44fbd6..5ea655d0d5a 100644 --- a/Modules/IO/GDCM/test/itkGDCMImageReadSeriesWriteTest.cxx +++ b/Modules/IO/GDCM/test/itkGDCMImageReadSeriesWriteTest.cxx @@ -83,9 +83,7 @@ itkGDCMImageReadSeriesWriteTest(int argc, char * argv[]) seriesWriter->SetImageIO(gdcmIO); ITK_TEST_SET_GET_VALUE(gdcmIO, seriesWriter->GetImageIO()); - ImageType::RegionType region = reader->GetOutput()->GetLargestPossibleRegion(); - const auto [start, size] = region; - + const auto [start, size] = reader->GetOutput()->GetLargestPossibleRegion(); std::string format = outputDirectory; format += "/image%03d.dcm"; diff --git a/Modules/IO/ImageBase/test/itkImageFileWriterUpdateLargestPossibleRegionTest.cxx b/Modules/IO/ImageBase/test/itkImageFileWriterUpdateLargestPossibleRegionTest.cxx index a05bb3a1b71..dfe3d4bc2b1 100644 --- a/Modules/IO/ImageBase/test/itkImageFileWriterUpdateLargestPossibleRegionTest.cxx +++ b/Modules/IO/ImageBase/test/itkImageFileWriterUpdateLargestPossibleRegionTest.cxx @@ -45,8 +45,7 @@ itkImageFileWriterUpdateLargestPossibleRegionTest(int argc, char * argv[]) writer->SetInput(reader->GetOutput()); writer->SetFileName(argv[2]); - ImageType::RegionType region = reader->GetOutput()->GetLargestPossibleRegion(); - const auto [index, size] = region; + const auto [index, size] = reader->GetOutput()->GetLargestPossibleRegion(); itk::ImageIORegion ioregion(2); ioregion.SetIndex(0, index[0]); diff --git a/Modules/Nonunit/Review/include/itkDirectFourierReconstructionImageToImageFilter.hxx b/Modules/Nonunit/Review/include/itkDirectFourierReconstructionImageToImageFilter.hxx index 970eedc05ab..8ef50d19a65 100644 --- a/Modules/Nonunit/Review/include/itkDirectFourierReconstructionImageToImageFilter.hxx +++ b/Modules/Nonunit/Review/include/itkDirectFourierReconstructionImageToImageFilter.hxx @@ -78,8 +78,7 @@ DirectFourierReconstructionImageToImageFilter::Genera return; } - RegionType inputRegion = inputImage->GetLargestPossibleRegion(); - auto [inputStart, inputSize] = inputRegion; + auto [inputStart, inputSize] = inputImage->GetLargestPossibleRegion(); IndexType outputStart; SizeType outputSize; diff --git a/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx b/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx index 83c83a53a56..9bc098cb6b4 100644 --- a/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx +++ b/Modules/Nonunit/Review/test/itkDiscreteHessianGaussianImageFunctionTest.cxx @@ -228,9 +228,8 @@ itkDiscreteHessianGaussianImageFunctionTestND(int argc, char * argv[]) // Exercise another interpolation mode: LinearInterpolation { function->SetInterpolationMode(HessianGaussianImageFunctionType::InterpolationModeEnum::LinearInterpolation); - const ImageType * inputImage = reader->GetOutput(); - typename ImageType::RegionType region = inputImage->GetBufferedRegion(); - auto [index, size] = region; + const ImageType * inputImage = reader->GetOutput(); + auto [index, size] = inputImage->GetBufferedRegion(); // Aim for the pixel at the center of the image for (unsigned int i = 0; i < Dimension; ++i) { diff --git a/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx b/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx index 974fa07c93d..8e13fdd9cf8 100644 --- a/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx +++ b/Modules/Registration/RegistrationMethodsv4/include/itkSyNImageRegistrationMethod.hxx @@ -791,8 +791,7 @@ typename SyNImageRegistrationMethodGetLargestPossibleRegion(); - const auto [startIndex, size] = region; + const auto [startIndex, size] = field->GetLargestPossibleRegion(); ImageRegionConstIteratorWithIndex ItF(field, field->GetLargestPossibleRegion()); ImageRegionIteratorWithIndex ItS(smoothField, smoothField->GetLargestPossibleRegion()); diff --git a/Modules/Video/Core/include/itkImageToVideoFilter.hxx b/Modules/Video/Core/include/itkImageToVideoFilter.hxx index e691fd7e7df..ec4aa0ca4b2 100644 --- a/Modules/Video/Core/include/itkImageToVideoFilter.hxx +++ b/Modules/Video/Core/include/itkImageToVideoFilter.hxx @@ -98,8 +98,7 @@ ImageToVideoFilter::GenerateOutputInformation() const InputImageType * input = this->GetInput(); // Get first input frame's largest possible spatial region - InputImageRegionType inputRegion = input->GetLargestPossibleRegion(); - const auto [inputIndex, inputSize] = inputRegion; + const auto [inputIndex, inputSize] = input->GetLargestPossibleRegion(); typename InputImageType::SpacingType inputSpacing = input->GetSpacing(); typename InputImageType::PointType inputOrigin = input->GetOrigin();