From 5b8e619d63090968877eada527e125eb44a3ed97 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Sun, 27 Oct 2024 15:47:02 +0100 Subject: [PATCH 1/2] STYLE: Replace `Size var; var.Fill` with `auto var = Size::Filled` Using Notepad++, Replace in Files, doing: Find what: ^([ ]+ )(typename )?(.*Size.*[^ ])[ ]+(\w+);[\r\n]+ [ ]+\4\.Fill\( Replace with: $1auto $4 = $3::Filled\( Filters: itk*.h;itk*.hxx;itk*.cxx [v] Match case (*) Regular expression Follow-up to pull request https://github.com/InsightSoftwareConsortium/ITK/pull/4887 commit be250b8fd39927de0d95a3b442c69ea7dd16926a "STYLE: Replace `size.Fill` with `auto size = Size::Filled` in tests" --- Modules/Core/Common/include/itkDerivativeOperator.h | 3 +-- .../Core/Common/include/itkLaplacianOperator.hxx | 4 +--- Modules/Core/Common/include/itkSobelOperator.h | 3 +-- .../include/itkCovarianceImageFunction.hxx | 3 +-- .../include/itkScatterMatrixImageFunction.hxx | 3 +-- .../include/itkVarianceImageFunction.hxx | 3 +-- .../include/itkVectorMeanImageFunction.hxx | 3 +-- .../itkWindowedSincInterpolateImageFunction.h | 3 +-- .../itkWindowedSincInterpolateImageFunction.hxx | 6 ++---- .../include/itkBSplineDeformableTransform.hxx | 3 +-- .../Core/Transform/include/itkBSplineTransform.hxx | 3 +-- .../include/itkBinaryDilateImageFilter.hxx | 9 ++++----- .../include/itkBinaryErodeImageFilter.hxx | 9 ++++----- .../include/itkBinaryMorphologyImageFilter.hxx | 3 +-- .../include/itkPatchBasedDenoisingImageFilter.hxx | 6 ++---- .../itkContourDirectedMeanDistanceImageFilter.hxx | 3 +-- .../include/itkFastMarchingImageFilterBase.hxx | 3 +-- .../include/itkCannyEdgeDetectionImageFilter.hxx | 9 +++------ .../include/itkMaskFeaturePointSelectionFilter.hxx | 6 ++---- .../itkLabelMapContourOverlayImageFilter.hxx | 3 +-- .../include/itkBSplineControlPointImageFilter.hxx | 3 +-- ...itkBSplineScatteredDataPointSetToImageFilter.hxx | 6 ++---- .../ImageGrid/include/itkTileImageFilter.hxx | 6 ++---- .../ImageLabel/include/itkScanlineFilterCommon.h | 3 +-- .../LabelMap/include/itkShapeLabelMapFilter.hxx | 3 +-- .../include/itkReconstructionImageFilter.hxx | 3 +-- .../include/itkValuedRegionalExtremaImageFilter.hxx | 3 +-- .../Filtering/Smoothing/include/itkBoxUtilities.h | 13 +++++-------- .../include/itkFFTDiscreteGaussianImageFilter.hxx | 3 +-- .../itkAttributeMorphologyBaseImageFilter.hxx | 6 ++---- .../itkDiscreteGaussianDerivativeImageFunction.hxx | 3 +-- ...screteGradientMagnitudeGaussianImageFunction.hxx | 3 +-- .../itkDiscreteHessianGaussianImageFunction.hxx | 3 +-- Modules/Numerics/FEM/include/itkFEMSolver.hxx | 3 +-- .../Common/include/itkBlockMatchingImageFilter.hxx | 3 +-- ...ToImageMetricv4GetValueAndDerivativeThreader.hxx | 3 +-- ...gBSplineVelocityFieldImageRegistrationMethod.hxx | 3 +-- ...aryingVelocityFieldImageRegistrationMethodv4.hxx | 3 +-- .../itkConnectedComponentFunctorImageFilter.hxx | 3 +-- .../SuperPixel/include/itkSLICImageFilter.hxx | 12 ++++-------- ...MorphologicalWatershedFromMarkersImageFilter.hxx | 3 +-- 41 files changed, 62 insertions(+), 117 deletions(-) diff --git a/Modules/Core/Common/include/itkDerivativeOperator.h b/Modules/Core/Common/include/itkDerivativeOperator.h index 1971387739a..eb8e3602b3b 100644 --- a/Modules/Core/Common/include/itkDerivativeOperator.h +++ b/Modules/Core/Common/include/itkDerivativeOperator.h @@ -39,8 +39,7 @@ namespace itk using DerivativeOperatorType = itk::DerivativeOperator; DerivativeOperatorType derivativeOperator; derivativeOperator.SetDirection(0); // X dimension - itk::Size<2> radius; - radius.Fill(1); // A radius of 1 in both dimensions is a 3x3 operator + auto radius = itk::Size<2>::Filled(1); // A radius of 1 in both dimensions is a 3x3 operator derivativeOperator.CreateToRadius(radius); \endcode * and creates a kernel that looks like: diff --git a/Modules/Core/Common/include/itkLaplacianOperator.hxx b/Modules/Core/Common/include/itkLaplacianOperator.hxx index 3cf38eb150b..383a0a528a8 100644 --- a/Modules/Core/Common/include/itkLaplacianOperator.hxx +++ b/Modules/Core/Common/include/itkLaplacianOperator.hxx @@ -70,9 +70,7 @@ LaplacianOperator::GenerateCoefficients() -> Coe // Here we set the radius to 1's, here the // operator is 3x3 for 2D, 3x3x3 for 3D. - SizeType r; - - r.Fill(1); + auto r = SizeType::Filled(1); this->SetRadius(r); // Create a vector of the correct size to hold the coefficients. diff --git a/Modules/Core/Common/include/itkSobelOperator.h b/Modules/Core/Common/include/itkSobelOperator.h index cae6bd10794..b2670b635a4 100644 --- a/Modules/Core/Common/include/itkSobelOperator.h +++ b/Modules/Core/Common/include/itkSobelOperator.h @@ -35,8 +35,7 @@ namespace itk * 1) Set the direction by calling \code SetDirection \endcode * 2) call \code - itk::Size<2> radius; - radius.Fill(1); + auto radius = itk::Size<2>::Filled(1); sobelOperator.CreateToRadius(radius); \endcode * 3) You may optionally scale the coefficients of this operator using the diff --git a/Modules/Core/ImageFunction/include/itkCovarianceImageFunction.hxx b/Modules/Core/ImageFunction/include/itkCovarianceImageFunction.hxx index d78d0034845..a26ca1b2ca0 100644 --- a/Modules/Core/ImageFunction/include/itkCovarianceImageFunction.hxx +++ b/Modules/Core/ImageFunction/include/itkCovarianceImageFunction.hxx @@ -61,8 +61,7 @@ CovarianceImageFunction::EvaluateAtIndex(const IndexType mean.fill(PixelComponentRealType{}); // Create an N-d neighborhood kernel, using a zeroflux boundary condition - typename InputImageType::SizeType kernelSize; - kernelSize.Fill(m_NeighborhoodRadius); + auto kernelSize = InputImageType::SizeType::Filled(m_NeighborhoodRadius); ConstNeighborhoodIterator it( kernelSize, this->GetInputImage(), this->GetInputImage()->GetBufferedRegion()); diff --git a/Modules/Core/ImageFunction/include/itkScatterMatrixImageFunction.hxx b/Modules/Core/ImageFunction/include/itkScatterMatrixImageFunction.hxx index 97bfde53667..f5ebc7df9f2 100644 --- a/Modules/Core/ImageFunction/include/itkScatterMatrixImageFunction.hxx +++ b/Modules/Core/ImageFunction/include/itkScatterMatrixImageFunction.hxx @@ -66,8 +66,7 @@ ScatterMatrixImageFunction::EvaluateAtIndex(const IndexT } // Create an N-d neighborhood kernel, using a zeroflux boundary condition - typename InputImageType::SizeType kernelSize; - kernelSize.Fill(m_NeighborhoodRadius); + auto kernelSize = InputImageType::SizeType::Filled(m_NeighborhoodRadius); ConstNeighborhoodIterator it( kernelSize, this->GetInputImage(), this->GetInputImage()->GetBufferedRegion()); diff --git a/Modules/Core/ImageFunction/include/itkVarianceImageFunction.hxx b/Modules/Core/ImageFunction/include/itkVarianceImageFunction.hxx index 1a3ea528f6e..fc365c3c8f0 100644 --- a/Modules/Core/ImageFunction/include/itkVarianceImageFunction.hxx +++ b/Modules/Core/ImageFunction/include/itkVarianceImageFunction.hxx @@ -60,8 +60,7 @@ VarianceImageFunction::EvaluateAtIndex(const IndexType & } // Create an N-d neighborhood kernel, using a zeroflux boundary condition - typename InputImageType::SizeType kernelSize; - kernelSize.Fill(m_NeighborhoodRadius); + auto kernelSize = InputImageType::SizeType::Filled(m_NeighborhoodRadius); ConstNeighborhoodIterator it( kernelSize, this->GetInputImage(), this->GetInputImage()->GetBufferedRegion()); diff --git a/Modules/Core/ImageFunction/include/itkVectorMeanImageFunction.hxx b/Modules/Core/ImageFunction/include/itkVectorMeanImageFunction.hxx index f62b5b96fbd..135b21a2f0a 100644 --- a/Modules/Core/ImageFunction/include/itkVectorMeanImageFunction.hxx +++ b/Modules/Core/ImageFunction/include/itkVectorMeanImageFunction.hxx @@ -54,8 +54,7 @@ VectorMeanImageFunction::EvaluateAtIndex(const IndexType } // Create an N-d neighborhood kernel, using a zeroflux boundary condition - typename InputImageType::SizeType kernelSize; - kernelSize.Fill(m_NeighborhoodRadius); + auto kernelSize = InputImageType::SizeType::Filled(m_NeighborhoodRadius); ConstNeighborhoodIterator it( kernelSize, this->GetInputImage(), this->GetInputImage()->GetBufferedRegion()); diff --git a/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.h b/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.h index a926371be01..dd863f74bb7 100644 --- a/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.h +++ b/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.h @@ -321,8 +321,7 @@ class ITK_TEMPLATE_EXPORT WindowedSincInterpolateImageFunction : public Interpol SizeType GetRadius() const override { - SizeType radius; - radius.Fill(VRadius); + auto radius = SizeType::Filled(VRadius); return radius; } diff --git a/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.hxx b/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.hxx index 349b234df27..cdefbe0a012 100644 --- a/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.hxx +++ b/Modules/Core/ImageFunction/include/itkWindowedSincInterpolateImageFunction.hxx @@ -64,8 +64,7 @@ WindowedSincInterpolateImageFunction radius; - radius.Fill(VRadius); + auto radius = Size::Filled(VRadius); // Initialize the neighborhood IteratorType it(radius, image, image->GetBufferedRegion()); @@ -145,8 +144,7 @@ WindowedSincInterpolateImageFunction radius; - radius.Fill(VRadius); + auto radius = Size::Filled(VRadius); IteratorType nit(radius, this->GetInputImage(), this->GetInputImage()->GetBufferedRegion()); nit.SetLocation(baseIndex); diff --git a/Modules/Core/Transform/include/itkBSplineDeformableTransform.hxx b/Modules/Core/Transform/include/itkBSplineDeformableTransform.hxx index 557c1c7b3fc..9d42fa3f873 100644 --- a/Modules/Core/Transform/include/itkBSplineDeformableTransform.hxx +++ b/Modules/Core/Transform/include/itkBSplineDeformableTransform.hxx @@ -556,8 +556,7 @@ BSplineDeformableTransform::Comp // Zero all components of jacobian jacobian.SetSize(SpaceDimension, this->GetNumberOfParameters()); jacobian.Fill(0.0); - SizeType supportSize; - supportSize.Fill(SplineOrder + 1); + auto supportSize = SizeType::Filled(SplineOrder + 1); ContinuousIndexType index = this->m_CoefficientImages[0] diff --git a/Modules/Core/Transform/include/itkBSplineTransform.hxx b/Modules/Core/Transform/include/itkBSplineTransform.hxx index 58f109def7e..71be98d9482 100644 --- a/Modules/Core/Transform/include/itkBSplineTransform.hxx +++ b/Modules/Core/Transform/include/itkBSplineTransform.hxx @@ -53,8 +53,7 @@ BSplineTransform::BSplineTransfo DirectionType meshDirection; meshDirection.SetIdentity(); - MeshSizeType meshSize; - meshSize.Fill(1); + auto meshSize = MeshSizeType::Filled(1); this->m_FixedParameters.SetSize(VDimension * (VDimension + 3)); diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryDilateImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryDilateImageFilter.hxx index 15e4a7d0b75..5853af82bd9 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryDilateImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryDilateImageFilter.hxx @@ -48,11 +48,10 @@ BinaryDilateImageFilter::GenerateData() typename InputImageType::ConstPointer input = this->GetInput(); // Get values from superclass - InputPixelType foregroundValue = this->GetForegroundValue(); - InputPixelType backgroundValue = this->GetBackgroundValue(); - KernelType kernel = this->GetKernel(); - InputSizeType radius; - radius.Fill(1); + InputPixelType foregroundValue = this->GetForegroundValue(); + InputPixelType backgroundValue = this->GetBackgroundValue(); + KernelType kernel = this->GetKernel(); + auto radius = InputSizeType::Filled(1); typename TOutputImage::RegionType outputRegion = output->GetBufferedRegion(); // compute the size of the temp image. It is needed to create the progress diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryErodeImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryErodeImageFilter.hxx index b2ceeba3c5c..9d1cdd4b84b 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryErodeImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryErodeImageFilter.hxx @@ -48,11 +48,10 @@ BinaryErodeImageFilter::GenerateData() typename InputImageType::ConstPointer input = this->GetInput(); // Get values from superclass - InputPixelType foregroundValue = this->GetForegroundValue(); - InputPixelType backgroundValue = this->GetBackgroundValue(); - KernelType kernel = this->GetKernel(); - InputSizeType radius; - radius.Fill(1); + InputPixelType foregroundValue = this->GetForegroundValue(); + InputPixelType backgroundValue = this->GetBackgroundValue(); + KernelType kernel = this->GetKernel(); + auto radius = InputSizeType::Filled(1); typename TOutputImage::RegionType outputRegion = output->GetBufferedRegion(); // compute the size of the temp image. It is needed to create the progress diff --git a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologyImageFilter.hxx b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologyImageFilter.hxx index 204b2f9a3bb..0f0968f2df5 100644 --- a/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologyImageFilter.hxx +++ b/Modules/Filtering/BinaryMathematicalMorphology/include/itkBinaryMorphologyImageFilter.hxx @@ -139,8 +139,7 @@ BinaryMorphologyImageFilter::AnalyzeKernel() ImageRegionIteratorWithIndex kernelImageItIndex(tmpSEImage, tmpSEImage->GetRequestedRegion()); // Neighborhood iterator on SE element temp image - InputSizeType padBy; - padBy.Fill(1); + auto padBy = InputSizeType::Filled(1); NeighborhoodIterator SEoNeighbIt(padBy, tmpSEImage, tmpSEImage->GetRequestedRegion()); SEoNeighbIt.OverrideBoundaryCondition(&cbc); SizeValueType neighborhoodSize = SEoNeighbIt.Size(); diff --git a/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx b/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx index 4cfff830ff7..355a5b73ca1 100644 --- a/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx +++ b/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx @@ -474,8 +474,7 @@ PatchBasedDenoisingImageFilter::InitializePatchWeight // Allocate the patch weights (mask) as an image. // Done in physical space. - typename WeightsImageType::SizeType physicalSize; - physicalSize.Fill(physicalDiameter); + auto physicalSize = WeightsImageType::SizeType::Filled(physicalDiameter); typename WeightsImageType::RegionType physicalRegion(physicalSize); auto physicalWeightsImage = WeightsImageType::New(); physicalWeightsImage->SetRegions(physicalRegion); @@ -681,8 +680,7 @@ typename PatchBasedDenoisingImageFilter::ThreadDataSt using FaceCalculatorType = typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator; using FaceListType = typename FaceCalculatorType::FaceListType; - typename InputImageType::SizeType radius; - radius.Fill(1); + auto radius = InputImageType::SizeType::Filled(1); if (m_NumIndependentComponents != 1) { diff --git a/Modules/Filtering/DistanceMap/include/itkContourDirectedMeanDistanceImageFilter.hxx b/Modules/Filtering/DistanceMap/include/itkContourDirectedMeanDistanceImageFilter.hxx index 21bb5e197fa..e457be8a284 100644 --- a/Modules/Filtering/DistanceMap/include/itkContourDirectedMeanDistanceImageFilter.hxx +++ b/Modules/Filtering/DistanceMap/include/itkContourDirectedMeanDistanceImageFilter.hxx @@ -177,8 +177,7 @@ ContourDirectedMeanDistanceImageFilter::ThreadedGene InputImage1ConstPointer input = this->GetInput(); // Find the data-set boundary "faces" - SizeType radius; - radius.Fill(1); + auto radius = SizeType::Filled(1); using FaceListType = typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator::FaceListType; diff --git a/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilterBase.hxx b/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilterBase.hxx index 017c535c687..01e62ea20f1 100644 --- a/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilterBase.hxx +++ b/Modules/Filtering/FastMarching/include/itkFastMarchingImageFilterBase.hxx @@ -53,8 +53,7 @@ FastMarchingImageFilterBase::FastMarchingImageFilterBase() m_StartIndex.Fill(0); m_LastIndex.Fill(0); - OutputSizeType outputSize; - outputSize.Fill(16); + auto outputSize = OutputSizeType::Filled(16); NodeType outputIndex{}; diff --git a/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.hxx b/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.hxx index ac2162321d0..40f9a58882e 100644 --- a/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.hxx +++ b/Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.hxx @@ -107,8 +107,7 @@ CannyEdgeDetectionImageFilter::ThreadedCompute2ndDeri typename OutputImageType::Pointer input = m_GaussianFilter->GetOutput(); // Set iterator radius - Size radius; - radius.Fill(1); + auto radius = Size::Filled(1); // Find the data-set boundary "faces" NeighborhoodAlgorithm::ImageBoundaryFacesCalculator bC; @@ -322,8 +321,7 @@ CannyEdgeDetectionImageFilter::FollowEdge(IndexType ListNodeType * node; // Assign iterator radius - Size radius; - radius.Fill(1); + auto radius = Size::Filled(1); ConstNeighborhoodIterator oit( radius, multiplyImageFilterOutput, multiplyImageFilterOutput->GetRequestedRegion()); @@ -398,8 +396,7 @@ CannyEdgeDetectionImageFilter::ThreadedCompute2ndDeri typename InputImageType::Pointer output = m_UpdateBuffer1; // Set iterator radius - Size radius; - radius.Fill(1); + auto radius = Size::Filled(1); // Find the data-set boundary "faces" NeighborhoodAlgorithm::ImageBoundaryFacesCalculator bC; diff --git a/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx b/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx index c2c88049f1a..103883f0f4f 100644 --- a/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx +++ b/Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx @@ -152,8 +152,7 @@ MaskFeaturePointSelectionFilter::GenerateData() if (m_ComputeStructureTensors) { // tensor calculations access points in 2 X m_BlockRadius + 1 radius - SizeType onesSize; - onesSize.Fill(1); + auto onesSize = SizeType::Filled(1); // Define the area in which tensors are going to be computed. const SizeType blockSize = m_BlockRadius + m_BlockRadius + onesSize; safeIndex += blockSize; @@ -231,8 +230,7 @@ MaskFeaturePointSelectionFilter::GenerateData() Matrix gradI; // vector declared as column matrix - SizeType radius; - radius.Fill(1); // iterate over neighbourhood of a voxel + auto radius = SizeType::Filled(1); // iterate over neighbourhood of a voxel RegionType center; center.SetSize(radius); diff --git a/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.hxx b/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.hxx index 77299c437dd..3380c7b4f92 100644 --- a/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.hxx +++ b/Modules/Filtering/ImageFusion/include/itkLabelMapContourOverlayImageFilter.hxx @@ -42,8 +42,7 @@ LabelMapContourOverlayImageFilter::Label m_Opacity = 0.5; m_Type = CONTOUR; m_Priority = HIGH_LABEL_ON_TOP; - SizeType s; - s.Fill(1); + auto s = SizeType::Filled(1); m_ContourThickness = SizeType(s); s.Fill(0); m_DilationRadius = SizeType(s); diff --git a/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx index 467bdcbc150..249a247b9e9 100644 --- a/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkBSplineControlPointImageFilter.hxx @@ -187,8 +187,7 @@ BSplineControlPointImageFilter::DynamicThreadedGenera collapsedPhiLattices[i] = PointDataImageType::New(); collapsedPhiLattices[i]->CopyInformation(inputPtr); - typename PointDataImageType::SizeType size; - size.Fill(1); + auto size = PointDataImageType::SizeType::Filled(1); for (unsigned int j = 0; j < i; ++j) { size[j] = inputPtr->GetLargestPossibleRegion().GetSize()[j]; diff --git a/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx index f5d985df76f..36707477100 100644 --- a/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx @@ -558,8 +558,7 @@ BSplineScatteredDataPointSetToImageFilter::Threade collapsedPhiLattices[i] = PointDataImageType::New(); collapsedPhiLattices[i]->CopyInformation(this->m_PhiLattice); - typename PointDataImageType::SizeType size; - size.Fill(1); + auto size = PointDataImageType::SizeType::Filled(1); for (unsigned int j = 0; j < i; ++j) { size[j] = this->m_PhiLattice->GetLargestPossibleRegion().GetSize()[j]; @@ -886,8 +885,7 @@ BSplineScatteredDataPointSetToImageFilter::Threade collapsedPhiLattices[i]->SetSpacing(this->m_PhiLattice->GetSpacing()); collapsedPhiLattices[i]->SetDirection(this->m_PhiLattice->GetDirection()); - typename PointDataImageType::SizeType size; - size.Fill(1); + auto size = PointDataImageType::SizeType::Filled(1); for (unsigned int j = 0; j < i; ++j) { size[j] = this->m_PhiLattice->GetLargestPossibleRegion().GetSize()[j]; diff --git a/Modules/Filtering/ImageGrid/include/itkTileImageFilter.hxx b/Modules/Filtering/ImageGrid/include/itkTileImageFilter.hxx index 41f3a8cce02..9bab49b2fb7 100644 --- a/Modules/Filtering/ImageGrid/include/itkTileImageFilter.hxx +++ b/Modules/Filtering/ImageGrid/include/itkTileImageFilter.hxx @@ -197,8 +197,7 @@ TileImageFilter::GenerateOutputInformation() // Determine the last dimension for the tile image. This dimension will // be large enough to accommodate left-over images. - OutputSizeType outputSize; - outputSize.Fill(1); + auto outputSize = OutputSizeType::Filled(1); if (m_Layout[OutputImageDimension - 1] == 0) { @@ -216,8 +215,7 @@ TileImageFilter::GenerateOutputInformation() m_Layout[OutputImageDimension - 1] = outputSize[OutputImageDimension - 1]; } - OutputSizeType tileSize; - tileSize.Fill(1); + auto tileSize = OutputSizeType::Filled(1); for (unsigned int i = 0; i < OutputImageDimension; ++i) { diff --git a/Modules/Filtering/ImageLabel/include/itkScanlineFilterCommon.h b/Modules/Filtering/ImageLabel/include/itkScanlineFilterCommon.h index 306300fb406..7f7cd0e583c 100644 --- a/Modules/Filtering/ImageLabel/include/itkScanlineFilterCommon.h +++ b/Modules/Filtering/ImageLabel/include/itkScanlineFilterCommon.h @@ -415,8 +415,7 @@ class ScanlineFilterCommon LineRegion.SetSize(PretendSize); fakeImage->SetRegions(LineRegion); - PretendSizeType kernelRadius; - kernelRadius.Fill(1); + auto kernelRadius = PretendSizeType::Filled(1); LineNeighborhoodType lnit(kernelRadius, fakeImage, LineRegion); if (wholeNeighborhood) diff --git a/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx index 33e31c20231..cf263859865 100644 --- a/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx @@ -432,8 +432,7 @@ ShapeLabelMapFilter::ComputeFeretDiameter(LabelObjectType * IndexListType idxList; using NeighborIteratorType = typename itk::ConstNeighborhoodIterator; - SizeType neighborHoodRadius; - neighborHoodRadius.Fill(1); + auto neighborHoodRadius = SizeType::Filled(1); NeighborIteratorType it(neighborHoodRadius, m_LabelImage, m_LabelImage->GetBufferedRegion()); ConstantBoundaryCondition lcbc; // Use label + 1 to have a label different of the current label on the border diff --git a/Modules/Filtering/MathematicalMorphology/include/itkReconstructionImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkReconstructionImageFilter.hxx index 457c56337e7..47189b6d46e 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkReconstructionImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkReconstructionImageFilter.hxx @@ -141,8 +141,7 @@ ReconstructionImageFilter::GenerateData() NOutputIterator outNIt; InputIteratorType mskIt; CNInputIterator mskNIt; - ISizeType kernelRadius; - kernelRadius.Fill(1); + auto kernelRadius = ISizeType::Filled(1); if (m_UseInternalCopy) { FaceCalculatorType faceCalculator; diff --git a/Modules/Filtering/MathematicalMorphology/include/itkValuedRegionalExtremaImageFilter.hxx b/Modules/Filtering/MathematicalMorphology/include/itkValuedRegionalExtremaImageFilter.hxx index a3643f955b7..53cc1e3071b 100644 --- a/Modules/Filtering/MathematicalMorphology/include/itkValuedRegionalExtremaImageFilter.hxx +++ b/Modules/Filtering/MathematicalMorphology/include/itkValuedRegionalExtremaImageFilter.hxx @@ -106,8 +106,7 @@ ValuedRegionalExtremaImageFilterGetRequestedRegion()); setConnectivity(&outNIt, m_FullyConnected); diff --git a/Modules/Filtering/Smoothing/include/itkBoxUtilities.h b/Modules/Filtering/Smoothing/include/itkBoxUtilities.h index 86ae027af3a..19cc14f5b2d 100644 --- a/Modules/Filtering/Smoothing/include/itkBoxUtilities.h +++ b/Modules/Filtering/Smoothing/include/itkBoxUtilities.h @@ -110,9 +110,8 @@ BoxAccumulateFunction(const TInputImage * inputImage, using InputIterator = ImageRegionConstIterator; using NOutputIterator = ShapedNeighborhoodIterator; - InputIterator inIt(inputImage, inputRegion); - typename TInputImage::SizeType kernelRadius; - kernelRadius.Fill(1); + InputIterator inIt(inputImage, inputRegion); + auto kernelRadius = TInputImage::SizeType::Filled(1); NOutputIterator noutIt(kernelRadius, outputImage, outputRegion); // this iterator is fully connected @@ -165,8 +164,7 @@ std::vector CornerOffsets(const TImage * im) { using NIterator = ShapedNeighborhoodIterator; - typename TImage::SizeType unitradius; - unitradius.Fill(1); + auto unitradius = TImage::SizeType::Filled(1); NIterator n1(unitradius, im, im->GetRequestedRegion()); unsigned int centerIndex = n1.GetCenterNeighborhoodIndex(); typename NIterator::OffsetType offset; @@ -564,9 +562,8 @@ BoxSquareAccumulateFunction(const TInputImage * inputImage, using InputIterator = ImageRegionConstIterator; using NOutputIterator = ShapedNeighborhoodIterator; - InputIterator inIt(inputImage, inputRegion); - typename TInputImage::SizeType kernelRadius; - kernelRadius.Fill(1); + InputIterator inIt(inputImage, inputRegion); + auto kernelRadius = TInputImage::SizeType::Filled(1); NOutputIterator noutIt(kernelRadius, outputImage, outputRegion); // this iterator is fully connected diff --git a/Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.hxx b/Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.hxx index be949741aef..94a82ce7f49 100644 --- a/Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.hxx +++ b/Modules/Filtering/Smoothing/include/itkFFTDiscreteGaussianImageFilter.hxx @@ -132,8 +132,7 @@ FFTDiscreteGaussianImageFilter::GenerateKernelImage() kernelSource->SetOrigin(inputOrigin); kernelSource->SetDirection(this->GetInput()->GetDirection()); - KernelSizeType kernelSize; - kernelSize.Fill(1); + auto kernelSize = KernelSizeType::Filled(1); for (size_t dim = 0; dim < this->GetFilterDimensionality(); ++dim) { kernelSize[dim] = static_cast(this->GetKernelRadius(dim)) * 2 + 1; diff --git a/Modules/Nonunit/Review/include/itkAttributeMorphologyBaseImageFilter.hxx b/Modules/Nonunit/Review/include/itkAttributeMorphologyBaseImageFilter.hxx index 0154ddb7b82..5fec489ccc5 100644 --- a/Modules/Nonunit/Review/include/itkAttributeMorphologyBaseImageFilter.hxx +++ b/Modules/Nonunit/Review/include/itkAttributeMorphologyBaseImageFilter.hxx @@ -86,8 +86,7 @@ AttributeMorphologyBaseImageFilterGetRequestedRegion().GetNumberOfPixels(); - SizeType kernelRadius; - kernelRadius.Fill(1); + auto kernelRadius = SizeType::Filled(1); using FaceCalculatorType = itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator; FaceCalculatorType faceCalculator; typename FaceCalculatorType::FaceListType faceList = @@ -211,8 +210,7 @@ AttributeMorphologyBaseImageFilter; - SizeType KernRad; - KernRad.Fill(1); + auto KernRad = SizeType::Filled(1); NeighType It(KernRad, this->GetOutput(), this->GetOutput()->GetRequestedRegion()); setConnectivity(&It, m_FullyConnected); typename NeighType::IndexListType OffsetList; diff --git a/Modules/Nonunit/Review/include/itkDiscreteGaussianDerivativeImageFunction.hxx b/Modules/Nonunit/Review/include/itkDiscreteGaussianDerivativeImageFunction.hxx index 9321283adcd..5744bc091c3 100644 --- a/Modules/Nonunit/Review/include/itkDiscreteGaussianDerivativeImageFunction.hxx +++ b/Modules/Nonunit/Review/include/itkDiscreteGaussianDerivativeImageFunction.hxx @@ -104,8 +104,7 @@ DiscreteGaussianDerivativeImageFunction::RecomputeGaussian using RegionType = typename KernelImageType::RegionType; RegionType region; - typename RegionType::SizeType size; - size.Fill(4 * m_OperatorArray[0].GetRadius()[0] + 1); + auto size = RegionType::SizeType::Filled(4 * m_OperatorArray[0].GetRadius()[0] + 1); region.SetSize(size); kernelImage->SetRegions(region); diff --git a/Modules/Nonunit/Review/include/itkDiscreteGradientMagnitudeGaussianImageFunction.hxx b/Modules/Nonunit/Review/include/itkDiscreteGradientMagnitudeGaussianImageFunction.hxx index 813006a81bf..844a285c57d 100644 --- a/Modules/Nonunit/Review/include/itkDiscreteGradientMagnitudeGaussianImageFunction.hxx +++ b/Modules/Nonunit/Review/include/itkDiscreteGradientMagnitudeGaussianImageFunction.hxx @@ -117,8 +117,7 @@ DiscreteGradientMagnitudeGaussianImageFunction::RecomputeG using RegionType = typename KernelImageType::RegionType; RegionType region; - typename RegionType::SizeType size; - size.Fill(4 * maxRadius + 1); + auto size = RegionType::SizeType::Filled(4 * maxRadius + 1); region.SetSize(size); kernelImage->SetRegions(region); diff --git a/Modules/Nonunit/Review/include/itkDiscreteHessianGaussianImageFunction.hxx b/Modules/Nonunit/Review/include/itkDiscreteHessianGaussianImageFunction.hxx index a5dc18456af..d28db342c9d 100644 --- a/Modules/Nonunit/Review/include/itkDiscreteHessianGaussianImageFunction.hxx +++ b/Modules/Nonunit/Review/include/itkDiscreteHessianGaussianImageFunction.hxx @@ -110,8 +110,7 @@ DiscreteHessianGaussianImageFunction::RecomputeGaussianKer using RegionType = typename KernelImageType::RegionType; RegionType region; - typename RegionType::SizeType size; - size.Fill(4 * maxRadius + 1); + auto size = RegionType::SizeType::Filled(4 * maxRadius + 1); region.SetSize(size); kernelImage->SetRegions(region); diff --git a/Modules/Numerics/FEM/include/itkFEMSolver.hxx b/Modules/Numerics/FEM/include/itkFEMSolver.hxx index 23fc4b41652..52bd0db3ad4 100644 --- a/Modules/Numerics/FEM/include/itkFEMSolver.hxx +++ b/Modules/Numerics/FEM/include/itkFEMSolver.hxx @@ -724,8 +724,7 @@ Solver::InitializeInterpolationGrid(const InterpolationGridSizeType // Set the interpolation grid (image) size, origin and spacing // from the given vectors, so that physical point of v1 is (0,0,0) and // physical point v2 is (size[0],size[1],size[2]). - InterpolationGridSizeType image_size; - image_size.Fill(1); + auto image_size = InterpolationGridSizeType::Filled(1); for (unsigned int i = 0; i < FEMDimension; ++i) { image_size[i] = size[i]; diff --git a/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx b/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx index e700bd1cec3..8ae601844b4 100644 --- a/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx +++ b/Modules/Registration/Common/include/itkBlockMatchingImageFilter.hxx @@ -287,8 +287,7 @@ BlockMatchingImageFilter; FaceCalculatorType faceCalculator; diff --git a/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.hxx b/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.hxx index 1d3bef3b237..0230d005778 100644 --- a/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.hxx +++ b/Modules/Registration/RegistrationMethodsv4/include/itkTimeVaryingVelocityFieldImageRegistrationMethodv4.hxx @@ -362,8 +362,7 @@ TimeVaryingVelocityFieldImageRegistrationMethodv4; FaceCalculatorType faceCalculator; diff --git a/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx b/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx index 6927b0122ab..86e7045bf38 100644 --- a/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx +++ b/Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx @@ -55,8 +55,7 @@ ConnectedComponentFunctorImageFilter; using OutputNeighborhoodIteratorType = ConstShapedNeighborhoodIterator; - SizeType kernelRadius; - kernelRadius.Fill(1); + auto kernelRadius = SizeType::Filled(1); InputNeighborhoodIteratorType init(kernelRadius, input, output->GetRequestedRegion()); OutputNeighborhoodIteratorType onit(kernelRadius, output, output->GetRequestedRegion()); diff --git a/Modules/Segmentation/SuperPixel/include/itkSLICImageFilter.hxx b/Modules/Segmentation/SuperPixel/include/itkSLICImageFilter.hxx index 53f27550cdd..499eb4b7a83 100644 --- a/Modules/Segmentation/SuperPixel/include/itkSLICImageFilter.hxx +++ b/Modules/Segmentation/SuperPixel/include/itkSLICImageFilter.hxx @@ -330,14 +330,12 @@ SLICImageFilter::ThreadedPerturbClust const unsigned int numberOfClusterComponents = numberOfComponents + ImageDimension; - itk::Size radius; - radius.Fill(1); + auto radius = itk::Size::Filled(1); unsigned long center; unsigned long stride[ImageDimension]; - typename InputImageType::SizeType searchRadius; - searchRadius.Fill(1); + auto searchRadius = InputImageType::SizeType::Filled(1); using NeighborhoodType = ConstNeighborhoodIterator; @@ -439,8 +437,7 @@ SLICImageFilter::ThreadedConnectivity ConstantBoundaryCondition lbc; lbc.SetConstant(NumericTraits::max()); - itk::Size radius; - radius.Fill(1); + auto radius = itk::Size::Filled(1); using NeighborhoodType = ConstNeighborhoodIterator>; @@ -769,8 +766,7 @@ SLICImageFilter::RelabelConnectedRegi ConstantBoundaryCondition lbc; lbc.SetConstant(NumericTraits::max()); - itk::Size radius; - radius.Fill(1); + auto radius = itk::Size::Filled(1); unsigned long center; unsigned long stride[ImageDimension]; diff --git a/Modules/Segmentation/Watersheds/include/itkMorphologicalWatershedFromMarkersImageFilter.hxx b/Modules/Segmentation/Watersheds/include/itkMorphologicalWatershedFromMarkersImageFilter.hxx index 8ae747d703e..322ad2bed77 100644 --- a/Modules/Segmentation/Watersheds/include/itkMorphologicalWatershedFromMarkersImageFilter.hxx +++ b/Modules/Segmentation/Watersheds/include/itkMorphologicalWatershedFromMarkersImageFilter.hxx @@ -118,8 +118,7 @@ MorphologicalWatershedFromMarkersImageFilter::Generate MapType fah; // the radius which will be used for all the shaped iterators - Size radius; - radius.Fill(1); + auto radius = Size::Filled(1); // iterator for the marker image using MarkerIteratorType = ConstShapedNeighborhoodIterator; From 1cda1642bbe1afa5b06b95d1c83addc117c70607 Mon Sep 17 00:00:00 2001 From: Niels Dekker Date: Sun, 27 Oct 2024 22:02:26 +0100 Subject: [PATCH 2/2] STYLE: Replace `Index var; var.Fill` with `auto var = Index::Filled` Using Notepad++, Replace in Files, doing: Find what: ^([ ]+ )(typename )?(.*Index.*[^ ])[ ]+(\w+);[\r\n]+ [ ]+\4\.Fill\( Replace with: $1auto $4 = $3::Filled\( Filters: itk*.h;itk*.hxx;itk*.cxx [v] Match case (*) Regular expression Follow-up to pull request https://github.com/InsightSoftwareConsortium/ITK/pull/4887 commit 504d63b3dc435aae01ed35f352c5a589dac66924 "STYLE: Replace `index.Fill` with `auto index = Index::Filled` in tests" --- .../include/itkPatchBasedDenoisingImageFilter.hxx | 3 +-- .../LabelMap/include/itkAutoCropLabelMapFilter.hxx | 6 ++---- .../LabelMap/include/itkLabelMapMaskImageFilter.hxx | 12 ++++-------- .../LabelMap/include/itkShapeLabelMapFilter.hxx | 12 +++++------- .../itkDiscreteGaussianDerivativeImageFunction.hxx | 8 +++----- ...iscreteGradientMagnitudeGaussianImageFunction.hxx | 6 ++---- .../itkDiscreteHessianGaussianImageFunction.hxx | 6 ++---- 7 files changed, 19 insertions(+), 34 deletions(-) diff --git a/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx b/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx index 355a5b73ca1..f9b0ea23b97 100644 --- a/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx +++ b/Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx @@ -482,8 +482,7 @@ PatchBasedDenoisingImageFilter::InitializePatchWeight physicalWeightsImage->Allocate(); physicalWeightsImage->FillBuffer(1.0); - typename WeightsImageType::IndexType centerIndex; - centerIndex.Fill(patchRadius); + auto centerIndex = WeightsImageType::IndexType::Filled(patchRadius); unsigned int pos = 0; for (ImageRegionIteratorWithIndex pwIt(physicalWeightsImage, physicalRegion); !pwIt.IsAtEnd(); diff --git a/Modules/Filtering/LabelMap/include/itkAutoCropLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkAutoCropLabelMapFilter.hxx index 84b0018c90d..8d2608e1f5b 100644 --- a/Modules/Filtering/LabelMap/include/itkAutoCropLabelMapFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkAutoCropLabelMapFilter.hxx @@ -53,10 +53,8 @@ AutoCropLabelMapFilter::GenerateOutputInformation() } // find the bounding box of the objects - IndexType minIdx; - minIdx.Fill(NumericTraits::max()); - IndexType maxIdx; - maxIdx.Fill(NumericTraits::NonpositiveMin()); + auto minIdx = IndexType::Filled(NumericTraits::max()); + auto maxIdx = IndexType::Filled(NumericTraits::NonpositiveMin()); const InputImageType * inputImage = this->GetInput(); diff --git a/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.hxx b/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.hxx index 9f2b5780da1..6d0b4107459 100644 --- a/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkLabelMapMaskImageFilter.hxx @@ -104,10 +104,8 @@ LabelMapMaskImageFilter::GenerateOutputInformation() else { // Compute the bounding box of all the objects which don't have that label - IndexType mins; - mins.Fill(NumericTraits::max()); - IndexType maxs; - maxs.Fill(NumericTraits::NonpositiveMin()); + auto mins = IndexType::Filled(NumericTraits::max()); + auto maxs = IndexType::Filled(NumericTraits::NonpositiveMin()); for (typename InputImageType::ConstIterator loit(this->GetInput()); !loit.IsAtEnd(); ++loit) { if (loit.GetLabel() != m_Label) @@ -168,10 +166,8 @@ LabelMapMaskImageFilter::GenerateOutputInformation() // Just find the bounding box of the object with that label const LabelObjectType * labelObject = input->GetLabelObject(m_Label); - IndexType mins; - mins.Fill(NumericTraits::max()); - IndexType maxs; - maxs.Fill(NumericTraits::NonpositiveMin()); + auto mins = IndexType::Filled(NumericTraits::max()); + auto maxs = IndexType::Filled(NumericTraits::NonpositiveMin()); // Iterate over all the lines typename LabelObjectType::ConstLineIterator lit(labelObject); while (!lit.IsAtEnd()) diff --git a/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx b/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx index cf263859865..c05bbc22151 100644 --- a/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx +++ b/Modules/Filtering/LabelMap/include/itkShapeLabelMapFilter.hxx @@ -96,13 +96,11 @@ ShapeLabelMapFilter::ThreadedProcessLabelObject(LabelObject // Init the vars SizeValueType nbOfPixels = 0; ContinuousIndex centroid{}; - IndexType mins; - mins.Fill(NumericTraits::max()); - IndexType maxs; - maxs.Fill(NumericTraits::NonpositiveMin()); - SizeValueType nbOfPixelsOnBorder = 0; - double perimeterOnBorder = 0; - MatrixType centralMoments{}; + auto mins = IndexType::Filled(NumericTraits::max()); + auto maxs = IndexType::Filled(NumericTraits::NonpositiveMin()); + SizeValueType nbOfPixelsOnBorder = 0; + double perimeterOnBorder = 0; + MatrixType centralMoments{}; using LengthType = typename LabelObjectType::LengthType; diff --git a/Modules/Nonunit/Review/include/itkDiscreteGaussianDerivativeImageFunction.hxx b/Modules/Nonunit/Review/include/itkDiscreteGaussianDerivativeImageFunction.hxx index 5744bc091c3..92d2d5581cf 100644 --- a/Modules/Nonunit/Review/include/itkDiscreteGaussianDerivativeImageFunction.hxx +++ b/Modules/Nonunit/Review/include/itkDiscreteGaussianDerivativeImageFunction.hxx @@ -111,16 +111,14 @@ DiscreteGaussianDerivativeImageFunction::RecomputeGaussian kernelImage->AllocateInitialized(); // Initially the kernel image will be an impulse at the center - typename KernelImageType::IndexType centerIndex; - centerIndex.Fill(2 * m_OperatorArray[0].GetRadius()[0]); // include also - // boundaries + auto centerIndex = KernelImageType::IndexType::Filled(2 * m_OperatorArray[0].GetRadius()[0]); // include also + // boundaries kernelImage->SetPixel(centerIndex, itk::NumericTraits::OneValue()); // Create an image region to be used later that does not include boundaries RegionType kernelRegion; size.Fill(2 * m_OperatorArray[0].GetRadius()[0] + 1); - typename RegionType::IndexType origin; - origin.Fill(m_OperatorArray[0].GetRadius()[0]); + auto origin = RegionType::IndexType::Filled(m_OperatorArray[0].GetRadius()[0]); kernelRegion.SetSize(size); kernelRegion.SetIndex(origin); diff --git a/Modules/Nonunit/Review/include/itkDiscreteGradientMagnitudeGaussianImageFunction.hxx b/Modules/Nonunit/Review/include/itkDiscreteGradientMagnitudeGaussianImageFunction.hxx index 844a285c57d..9ffaf118760 100644 --- a/Modules/Nonunit/Review/include/itkDiscreteGradientMagnitudeGaussianImageFunction.hxx +++ b/Modules/Nonunit/Review/include/itkDiscreteGradientMagnitudeGaussianImageFunction.hxx @@ -124,14 +124,12 @@ DiscreteGradientMagnitudeGaussianImageFunction::RecomputeG kernelImage->AllocateInitialized(); // Initially the kernel image will be an impulse at the center - typename KernelImageType::IndexType centerIndex; - centerIndex.Fill(2 * maxRadius); // include also boundaries + auto centerIndex = KernelImageType::IndexType::Filled(2 * maxRadius); // include also boundaries // Create an image region to be used later that does not include boundaries RegionType kernelRegion; size.Fill(2 * maxRadius + 1); - typename RegionType::IndexType origin; - origin.Fill(maxRadius); + auto origin = RegionType::IndexType::Filled(maxRadius); kernelRegion.SetSize(size); kernelRegion.SetIndex(origin); diff --git a/Modules/Nonunit/Review/include/itkDiscreteHessianGaussianImageFunction.hxx b/Modules/Nonunit/Review/include/itkDiscreteHessianGaussianImageFunction.hxx index d28db342c9d..9e1bf650bef 100644 --- a/Modules/Nonunit/Review/include/itkDiscreteHessianGaussianImageFunction.hxx +++ b/Modules/Nonunit/Review/include/itkDiscreteHessianGaussianImageFunction.hxx @@ -117,14 +117,12 @@ DiscreteHessianGaussianImageFunction::RecomputeGaussianKer kernelImage->AllocateInitialized(); // Initially the kernel image will be an impulse at the center - typename KernelImageType::IndexType centerIndex; - centerIndex.Fill(2 * maxRadius); // include also boundaries + auto centerIndex = KernelImageType::IndexType::Filled(2 * maxRadius); // include also boundaries // Create an image region to be used later that does not include boundaries RegionType kernelRegion; size.Fill(2 * maxRadius + 1); - typename RegionType::IndexType origin; - origin.Fill(maxRadius); + auto origin = RegionType::IndexType::Filled(maxRadius); kernelRegion.SetSize(size); kernelRegion.SetIndex(origin);