Skip to content

Commit a19180c

Browse files
committed
STYLE: Simplify initialization of local region iterators in hxx files
Replaced code like `T x = T(a, b)` and `auto x = T(a, b)` with `T x(a, b)`.
1 parent 8a2451b commit a19180c

3 files changed

Lines changed: 9 additions & 11 deletions

File tree

Modules/Filtering/BinaryMathematicalMorphology/include/itkObjectMorphologyImageFilter.hxx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ ObjectMorphologyImageFilter<TInputImage, TOutputImage, TKernel>::BeforeThreadedG
9898

9999
const RegionType requestedRegion = this->GetOutput()->GetRequestedRegion();
100100

101-
auto iRegIter = ImageRegionConstIterator(this->GetInput(), requestedRegion);
102-
auto oRegIter = ImageRegionIterator(this->GetOutput(), requestedRegion);
101+
ImageRegionConstIterator iRegIter(this->GetInput(), requestedRegion);
102+
ImageRegionIterator oRegIter(this->GetOutput(), requestedRegion);
103103
/* Copy the input image to the output image - then only boundary pixels
104104
* need to be changed in the output image */
105105
while (!oRegIter.IsAtEnd())

Modules/Filtering/ImageFeature/include/itkZeroCrossingImageFilter.hxx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,9 +123,9 @@ ZeroCrossingImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData(
123123
bit.OverrideBoundaryCondition(&nbc);
124124
bit.GoToBegin();
125125

126-
static constexpr SizeValueType neighborhoodSize = Math::UnsignedPower(3, ImageDimension);
127-
static constexpr SizeValueType center = neighborhoodSize / 2;
128-
ImageRegionIterator<TOutputImage> it = ImageRegionIterator(output, face);
126+
static constexpr SizeValueType neighborhoodSize = Math::UnsignedPower(3, ImageDimension);
127+
static constexpr SizeValueType center = neighborhoodSize / 2;
128+
ImageRegionIterator it(output, face);
129129
while (!bit.IsAtEnd())
130130
{
131131
const InputImagePixelType this_one = bit.GetPixel(center);

Modules/Segmentation/Watersheds/include/itkWatershedSegmenter.hxx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,7 @@ Segmenter<TInputImage>::CollectBoundaryInformation(flat_region_table_t & flatReg
336336
const ImageRegionType region = face->GetRequestedRegion();
337337

338338
// Grab all the labels of the boundary pixels.
339-
ImageRegionIterator<typename BoundaryType::face_t> faceIt =
340-
ImageRegionIterator<typename BoundaryType::face_t>(face, region);
339+
ImageRegionIterator faceIt(face, region);
341340
ImageRegionIterator labelIt(output, region);
342341
faceIt.GoToBegin();
343342
labelIt.GoToBegin();
@@ -443,10 +442,9 @@ Segmenter<TInputImage>::AnalyzeBoundaryFlow(InputImageTypePointer thresholdImage
443442
const typename BoundaryType::face_t::Pointer face = boundary->GetFace(idx);
444443
const ImageRegionType region = face->GetRequestedRegion();
445444

446-
ConstNeighborhoodIterator<InputImageType> searchIt(rad, thresholdImage, region);
447-
NeighborhoodIterator<OutputImageType> labelIt(rad, output, region);
448-
ImageRegionIterator<typename BoundaryType::face_t> faceIt =
449-
ImageRegionIterator<typename BoundaryType::face_t>(face, region);
445+
ConstNeighborhoodIterator<InputImageType> searchIt(rad, thresholdImage, region);
446+
NeighborhoodIterator<OutputImageType> labelIt(rad, output, region);
447+
ImageRegionIterator faceIt(face, region);
450448

451449
const unsigned int nCenter = searchIt.Size() / 2;
452450
searchIt.GoToBegin();

0 commit comments

Comments
 (0)