Skip to content

Commit 80bc26c

Browse files
committed
STYLE: Add constexpr to variables initialized by T::Filled(int-literal)
Found by the regular expression `^( [ ]+)(auto \w+[ ]+= .+::Filled\(\d+\);)` Manually excluded cases that did not compile, in itkLabelMapContourOverlayImageFilter.hxx itkBSplineControlPointImageFilter.hxx itkBSplineScatteredDataPointSetToImageFilter.hxx itkTileImageFilter.hxx itkFFTDiscreteGaussianImageFilter.hxx itkSLICImageFilter.hxx - Follow-up to pull request InsightSoftwareConsortium#4930 commit fd14482 "STYLE: Add constexpr to variables initialized by MakeFilled"
1 parent 4f6bdcb commit 80bc26c

File tree

16 files changed

+19
-19
lines changed

16 files changed

+19
-19
lines changed

Modules/Core/Common/include/itkDerivativeOperator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ namespace itk
3939
using DerivativeOperatorType = itk::DerivativeOperator<float, 2>;
4040
DerivativeOperatorType derivativeOperator;
4141
derivativeOperator.SetDirection(0); // X dimension
42-
auto radius = itk::Size<2>::Filled(1); // A radius of 1 in both dimensions is a 3x3 operator
42+
constexpr auto radius = itk::Size<2>::Filled(1); // A radius of 1 in both dimensions is a 3x3 operator
4343
derivativeOperator.CreateToRadius(radius);
4444
\endcode
4545
* and creates a kernel that looks like:

Modules/Core/Common/include/itkLaplacianOperator.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ LaplacianOperator<TPixel, VDimension, TAllocator>::GenerateCoefficients() -> Coe
7070

7171
// Here we set the radius to 1's, here the
7272
// operator is 3x3 for 2D, 3x3x3 for 3D.
73-
auto r = SizeType::Filled(1);
73+
constexpr auto r = SizeType::Filled(1);
7474
this->SetRadius(r);
7575

7676
// Create a vector of the correct size to hold the coefficients.

Modules/Core/Common/include/itkSobelOperator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ namespace itk
3535
* 1) Set the direction by calling \code SetDirection \endcode
3636
* 2) call
3737
\code
38-
auto radius = itk::Size<2>::Filled(1);
38+
constexpr auto radius = itk::Size<2>::Filled(1);
3939
sobelOperator.CreateToRadius(radius);
4040
\endcode
4141
* 3) You may optionally scale the coefficients of this operator using the

Modules/Core/Transform/include/itkBSplineTransform.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ BSplineTransform<TParametersValueType, VDimension, VSplineOrder>::BSplineTransfo
5252

5353
DirectionType meshDirection;
5454
meshDirection.SetIdentity();
55-
auto meshSize = MeshSizeType::Filled(1);
55+
constexpr auto meshSize = MeshSizeType::Filled(1);
5656

5757
this->m_FixedParameters.SetSize(VDimension * (VDimension + 3));
5858

Modules/Filtering/Denoising/include/itkPatchBasedDenoisingImageFilter.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ typename PatchBasedDenoisingImageFilter<TInputImage, TOutputImage>::ThreadDataSt
678678
using FaceCalculatorType = typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<InputImageType>;
679679
using FaceListType = typename FaceCalculatorType::FaceListType;
680680

681-
auto radius = InputImageType::SizeType::Filled(1);
681+
constexpr auto radius = InputImageType::SizeType::Filled(1);
682682

683683
if (m_NumIndependentComponents != 1)
684684
{

Modules/Filtering/DistanceMap/include/itkContourDirectedMeanDistanceImageFilter.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ ContourDirectedMeanDistanceImageFilter<TInputImage1, TInputImage2>::ThreadedGene
177177
InputImage1ConstPointer input = this->GetInput();
178178

179179
// Find the data-set boundary "faces"
180-
auto radius = SizeType::Filled(1);
180+
constexpr auto radius = SizeType::Filled(1);
181181

182182
using FaceListType = typename NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<InputImage1Type>::FaceListType;
183183

Modules/Filtering/FastMarching/include/itkFastMarchingImageFilterBase.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ FastMarchingImageFilterBase<TInput, TOutput>::FastMarchingImageFilterBase()
5353
m_StartIndex.Fill(0);
5454
m_LastIndex.Fill(0);
5555

56-
auto outputSize = OutputSizeType::Filled(16);
56+
constexpr auto outputSize = OutputSizeType::Filled(16);
5757

5858
NodeType outputIndex{};
5959

Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.hxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ CannyEdgeDetectionImageFilter<TInputImage, TOutputImage>::ThreadedCompute2ndDeri
106106
typename OutputImageType::Pointer input = m_GaussianFilter->GetOutput();
107107

108108
// Set iterator radius
109-
auto radius = Size<ImageDimension>::Filled(1);
109+
constexpr auto radius = Size<ImageDimension>::Filled(1);
110110

111111
// Find the data-set boundary "faces"
112112
NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<TInputImage> bC;
@@ -320,7 +320,7 @@ CannyEdgeDetectionImageFilter<TInputImage, TOutputImage>::FollowEdge(IndexType
320320
ListNodeType * node;
321321

322322
// Assign iterator radius
323-
auto radius = Size<ImageDimension>::Filled(1);
323+
constexpr auto radius = Size<ImageDimension>::Filled(1);
324324

325325
ConstNeighborhoodIterator<TOutputImage> oit(
326326
radius, multiplyImageFilterOutput, multiplyImageFilterOutput->GetRequestedRegion());
@@ -395,7 +395,7 @@ CannyEdgeDetectionImageFilter<TInputImage, TOutputImage>::ThreadedCompute2ndDeri
395395
typename InputImageType::Pointer output = m_UpdateBuffer1;
396396

397397
// Set iterator radius
398-
auto radius = Size<ImageDimension>::Filled(1);
398+
constexpr auto radius = Size<ImageDimension>::Filled(1);
399399

400400
// Find the data-set boundary "faces"
401401
NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<TInputImage> bC;

Modules/Filtering/ImageFeature/include/itkMaskFeaturePointSelectionFilter.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ MaskFeaturePointSelectionFilter<TImage, TMask, TFeatures>::GenerateData()
152152
if (m_ComputeStructureTensors)
153153
{
154154
// tensor calculations access points in 2 X m_BlockRadius + 1 radius
155-
auto onesSize = SizeType::Filled(1);
155+
constexpr auto onesSize = SizeType::Filled(1);
156156
// Define the area in which tensors are going to be computed.
157157
const SizeType blockSize = m_BlockRadius + m_BlockRadius + onesSize;
158158
safeIndex += blockSize;
@@ -230,7 +230,7 @@ MaskFeaturePointSelectionFilter<TImage, TMask, TFeatures>::GenerateData()
230230

231231
Matrix<SpacePrecisionType, ImageDimension, 1> gradI; // vector declared as column matrix
232232

233-
auto radius = SizeType::Filled(1); // iterate over neighbourhood of a voxel
233+
constexpr auto radius = SizeType::Filled(1); // iterate over neighbourhood of a voxel
234234

235235
RegionType center;
236236
center.SetSize(radius);

Modules/Nonunit/Review/include/itkAttributeMorphologyBaseImageFilter.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ AttributeMorphologyBaseImageFilter<TInputImage, TOutputImage, TAttribute, TFunct
8686

8787
SizeValueType buffsize = output->GetRequestedRegion().GetNumberOfPixels();
8888

89-
auto kernelRadius = SizeType::Filled(1);
89+
constexpr auto kernelRadius = SizeType::Filled(1);
9090
using FaceCalculatorType = itk::NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<TInputImage>;
9191
FaceCalculatorType faceCalculator;
9292
typename FaceCalculatorType::FaceListType faceList =

0 commit comments

Comments
 (0)