Skip to content

Commit 6f3ce70

Browse files
authored
Merge pull request #5830 from N-Dekker/Avoid-same-type-name-twice-in-variable-declaration
STYLE: Replace `T v = T(a, b)` variable declarations with `T v(a, b)`
2 parents f98424e + 45d4afd commit 6f3ce70

11 files changed

Lines changed: 29 additions & 35 deletions

File tree

Modules/Filtering/Convolution/include/itkFFTConvolutionImageFilter.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ FFTConvolutionImageFilter<TInputImage, TKernelImage, TOutputImage, TInternalPrec
218218
regionOfInterestSize[dim] = outputRequestedSize[dim] + 2 * kernelRadius[dim];
219219
regionOfInterestIndex[dim] = outputRequestedIndex[dim] - kernelRadius[dim];
220220
}
221-
const InputRegionType regionOfInterest = InputRegionType(regionOfInterestIndex, regionOfInterestSize);
221+
const InputRegionType regionOfInterest(regionOfInterestIndex, regionOfInterestSize);
222222

223223
const InputImageType * regionOfInterestImage = kernelPaddedInput;
224224
if (outputRequestedRegion != inputLargestRegion)

Modules/Filtering/Convolution/include/itkNormalizedCorrelationImageFilter.hxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,11 @@ NormalizedCorrelationImageFilter<TInputImage, TMaskImage, TOutputImage, TOperato
158158
auto realTemplateSize = static_cast<OutputPixelRealType>(templateSize);
159159
for (const auto & face : faceList)
160160
{
161-
ConstNeighborhoodIterator<InputImageType> bit =
162-
ConstNeighborhoodIterator<InputImageType>(normalizedTemplate.GetRadius(), input, face);
161+
ConstNeighborhoodIterator<InputImageType> bit(normalizedTemplate.GetRadius(), input, face);
163162
bit.OverrideBoundaryCondition(this->GetBoundaryCondition());
164163
bit.GoToBegin();
165164

166-
ImageRegionIterator<OutputImageType> it = ImageRegionIterator<OutputImageType>(output, face);
165+
ImageRegionIterator<OutputImageType> it(output, face);
167166

168167
if (!mask)
169168
{
@@ -201,7 +200,7 @@ NormalizedCorrelationImageFilter<TInputImage, TMaskImage, TOutputImage, TOperato
201200
{
202201
// Mask is defined, use the same calculation as above but only
203202
// perform it under the mask
204-
ImageRegionConstIterator<MaskImageType> mit = ImageRegionConstIterator<MaskImageType>(mask, face);
203+
ImageRegionConstIterator<MaskImageType> mit(mask, face);
205204
while (!bit.IsAtEnd())
206205
{
207206
if (mit.Get())

Modules/Filtering/ImageCompare/include/itkSTAPLEImageFilter.hxx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ STAPLEImageFilter<TInputImage, TOutputImage>::GenerateData()
8888
itkExceptionStringMacro("One or more input images do not contain matching RequestedRegions");
8989
}
9090

91-
IteratorType in = IteratorType(this->GetInput(i), W->GetRequestedRegion());
92-
FuzzyIteratorType out = FuzzyIteratorType(W, W->GetRequestedRegion());
91+
IteratorType in(this->GetInput(i), W->GetRequestedRegion());
92+
FuzzyIteratorType out(W, W->GetRequestedRegion());
9393

9494
while (!in.IsAtEnd())
9595
{
@@ -112,7 +112,7 @@ STAPLEImageFilter<TInputImage, TOutputImage>::GenerateData()
112112
double N = 0.0;
113113
double g_t = 0.0;
114114
{
115-
FuzzyIteratorType out = FuzzyIteratorType(W, W->GetRequestedRegion());
115+
FuzzyIteratorType out(W, W->GetRequestedRegion());
116116
while (!out.IsAtEnd())
117117
{
118118
while (!out.IsAtEndOfLine())
@@ -132,8 +132,8 @@ STAPLEImageFilter<TInputImage, TOutputImage>::GenerateData()
132132
// Now iterate on estimating specificity and sensitivity
133133
for (unsigned int i = 0; i < number_of_input_files; ++i)
134134
{
135-
IteratorType in = IteratorType(this->GetInput(i), W->GetRequestedRegion());
136-
FuzzyIteratorType out = FuzzyIteratorType(W, W->GetRequestedRegion());
135+
IteratorType in(this->GetInput(i), W->GetRequestedRegion());
136+
FuzzyIteratorType out(W, W->GetRequestedRegion());
137137

138138
double p_num{};
139139
double p_denom{};
@@ -175,7 +175,7 @@ STAPLEImageFilter<TInputImage, TOutputImage>::GenerateData()
175175
D_it[i] = IteratorType(this->GetInput(i), W->GetRequestedRegion());
176176
}
177177

178-
FuzzyIteratorType out = FuzzyIteratorType(W, W->GetRequestedRegion());
178+
FuzzyIteratorType out(W, W->GetRequestedRegion());
179179
while (!out.IsAtEnd())
180180
{
181181
while (!out.IsAtEndOfLine())

Modules/Filtering/ImageFeature/include/itkBilateralImageFilter.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -259,9 +259,9 @@ BilateralImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData(
259259
for (const auto & face : faceList)
260260
{
261261
// walk the boundary face and the corresponding section of the output
262-
NeighborhoodIteratorType b_iter = NeighborhoodIteratorType(m_GaussianKernel.GetRadius(), this->GetInput(), face);
262+
NeighborhoodIteratorType b_iter(m_GaussianKernel.GetRadius(), this->GetInput(), face);
263263
b_iter.OverrideBoundaryCondition(&BC);
264-
ImageRegionIterator<OutputImageType> o_iter = ImageRegionIterator<OutputImageType>(this->GetOutput(), face);
264+
ImageRegionIterator<OutputImageType> o_iter(this->GetOutput(), face);
265265

266266
while (!b_iter.IsAtEnd())
267267
{

Modules/Filtering/ImageFeature/include/itkHessian3DToVesselnessMeasureImageFilter.hxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ Hessian3DToVesselnessMeasureImageFilter<TPixel>::GenerateData()
5252

5353
// walk the region of eigen values and get the vesselness measure
5454
EigenValueArrayType eigenValue;
55-
ImageRegionConstIterator<EigenValueOutputImageType> it =
56-
ImageRegionConstIterator<EigenValueOutputImageType>(eigenImage, eigenImage->GetRequestedRegion());
57-
ImageRegionIterator<OutputImageType> oit;
55+
ImageRegionConstIterator<EigenValueOutputImageType> it(eigenImage, eigenImage->GetRequestedRegion());
56+
ImageRegionIterator<OutputImageType> oit;
5857
this->AllocateOutputs();
5958
oit = ImageRegionIterator<OutputImageType>(output, output->GetRequestedRegion());
6059
while (!it.IsAtEnd())

Modules/Filtering/ImageFeature/include/itkSimpleContourExtractorImageFilter.hxx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,9 @@ SimpleContourExtractorImageFilter<TInputImage, TOutputImage>::DynamicThreadedGen
5959
ZeroFluxNeumannBoundaryCondition<InputImageType> nbc;
6060
for (const auto & face : faceList)
6161
{
62-
ConstNeighborhoodIterator<InputImageType> bit =
63-
ConstNeighborhoodIterator<InputImageType>(this->GetRadius(), input, face);
64-
const unsigned int neighborhoodSize = bit.Size();
65-
ImageRegionIterator<OutputImageType> it = ImageRegionIterator<OutputImageType>(output, face);
62+
ConstNeighborhoodIterator<InputImageType> bit(this->GetRadius(), input, face);
63+
const unsigned int neighborhoodSize = bit.Size();
64+
ImageRegionIterator<OutputImageType> it(output, face);
6665

6766
bit.OverrideBoundaryCondition(&nbc);
6867
bit.GoToBegin();

Modules/Filtering/ImageFilterBase/include/itkNoiseImageFilter.hxx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,11 @@ NoiseImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData(
5656
// the edge of the buffer.
5757
for (const auto & face : faceList)
5858
{
59-
ConstNeighborhoodIterator<InputImageType> bit =
60-
ConstNeighborhoodIterator<InputImageType>(this->GetRadius(), input, face);
61-
const unsigned int neighborhoodSize = bit.Size();
62-
auto num = static_cast<InputRealType>(bit.Size());
59+
ConstNeighborhoodIterator<InputImageType> bit(this->GetRadius(), input, face);
60+
const unsigned int neighborhoodSize = bit.Size();
61+
auto num = static_cast<InputRealType>(bit.Size());
6362

64-
ImageRegionIterator<OutputImageType> it = ImageRegionIterator<OutputImageType>(output, face);
63+
ImageRegionIterator<OutputImageType> it(output, face);
6564
bit.OverrideBoundaryCondition(&nbc);
6665
bit.GoToBegin();
6766

Modules/Numerics/FEM/src/itkFEMLinearSystemWrapper.cxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,8 @@ LinearSystemWrapper::CuthillMckeeOrdering(ColumnArray & newNumbering, int starti
238238
/* temp storage for re-mapping
239239
of rows */
240240

241-
newNumbering = ColumnArray(this->m_Order); /* new row numbering */
242-
ColumnArray reverseMapping = ColumnArray(this->m_Order); /* allocate temp storage */
241+
newNumbering = ColumnArray(this->m_Order); /* new row numbering */
242+
ColumnArray reverseMapping(this->m_Order); /* allocate temp storage */
243243

244244
/* find degrees of each row in matrix & initialize newNumbering vector */
245245
ColumnArray currentRow; /* column indices of nonzero in

Modules/Segmentation/ConnectedComponents/include/itkConnectedComponentFunctorImageFilter.hxx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,9 +87,8 @@ ConnectedComponentFunctorImageFilter<TInputImage, TOutputImage, TFunctor, TMaskI
8787

8888
// along with a neighborhood iterator on the output, use a standard
8989
// iterator on the input and output
90-
ImageRegionConstIterator<InputImageType> it =
91-
ImageRegionConstIterator<InputImageType>(input, output->GetRequestedRegion());
92-
ImageRegionIterator<OutputImageType> oit = ImageRegionIterator<OutputImageType>(output, output->GetRequestedRegion());
90+
ImageRegionConstIterator<InputImageType> it(input, output->GetRequestedRegion());
91+
ImageRegionIterator<OutputImageType> oit(output, output->GetRequestedRegion());
9392

9493
// Setup a progress reporter. We have 2 stages to the algorithm so
9594
// pretend we have 2 times the number of pixels

Modules/Segmentation/LevelSets/include/itkReinitializeLevelSetImageFilter.hxx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ ReinitializeLevelSetImageFilter<TLevelSet>::GenerateDataFull()
152152
m_Marcher->SetTrialPoints(m_Locator->GetOutsidePoints());
153153
m_Marcher->Update();
154154

155-
IteratorType tempIt = IteratorType(tempLevelSet, tempLevelSet->GetBufferedRegion());
155+
IteratorType tempIt(tempLevelSet, tempLevelSet->GetBufferedRegion());
156156
while (!inputIt.IsAtEnd())
157157
{
158158
auto value = static_cast<double>(inputIt.Get());

0 commit comments

Comments
 (0)