Skip to content

Commit 4c85a55

Browse files
authored
Merge pull request InsightSoftwareConsortium#6008 from N-Dekker/Move-region-iterators-into-for-loops-over-faces
STYLE: Move region iterator declarations into `for` loops over faces
2 parents b94cca5 + 4394f5d commit 4c85a55

12 files changed

Lines changed: 15 additions & 39 deletions

Modules/Filtering/DisplacementField/include/itkDisplacementFieldJacobianDeterminantFilter.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,6 @@ DisplacementFieldJacobianDeterminantFilter<TInputImage, TRealType, TOutputImage>
171171
{
172172
ZeroFluxNeumannBoundaryCondition<RealVectorImageType> nbc;
173173
ConstNeighborhoodIteratorType bit;
174-
ImageRegionIterator<TOutputImage> it;
175174

176175
// Find the data-set boundary "faces"
177176
NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<RealVectorImageType> bC;
@@ -189,7 +188,7 @@ DisplacementFieldJacobianDeterminantFilter<TInputImage, TRealType, TOutputImage>
189188
{
190189
bit = ConstNeighborhoodIteratorType(
191190
m_NeighborhoodRadius, dynamic_cast<const RealVectorImageType *>(m_RealValuedInputImage.GetPointer()), face);
192-
it = ImageRegionIterator(this->GetOutput(), face);
191+
ImageRegionIterator it(this->GetOutput(), face);
193192
bit.OverrideBoundaryCondition(&nbc);
194193
bit.GoToBegin();
195194

Modules/Filtering/ImageFeature/include/itkCannyEdgeDetectionImageFilter.hxx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,6 @@ CannyEdgeDetectionImageFilter<TInputImage, TOutputImage>::ThreadedCompute2ndDeri
9696
{
9797
ZeroFluxNeumannBoundaryCondition<TInputImage> nbc;
9898

99-
ImageRegionIterator<TOutputImage> it;
100-
10199
void * globalData = nullptr;
102100

103101
// Here input is the result from the gaussian filter output is the update
@@ -118,7 +116,7 @@ CannyEdgeDetectionImageFilter<TInputImage, TOutputImage>::ThreadedCompute2ndDeri
118116
{
119117
NeighborhoodType bit(radius, input, face);
120118

121-
it = ImageRegionIterator(this->m_OutputImage, face);
119+
ImageRegionIterator it(this->m_OutputImage, face);
122120
bit.OverrideBoundaryCondition(&nbc);
123121
bit.GoToBegin();
124122

@@ -379,8 +377,6 @@ CannyEdgeDetectionImageFilter<TInputImage, TOutputImage>::ThreadedCompute2ndDeri
379377
ConstNeighborhoodIterator<TInputImage> bit;
380378
ConstNeighborhoodIterator<TInputImage> bit1;
381379

382-
ImageRegionIterator<TOutputImage> it;
383-
384380
// Here input is the result from the gaussian filter
385381
// input1 is the 2nd derivative result
386382
// output is the gradient of 2nd derivative
@@ -416,7 +412,7 @@ CannyEdgeDetectionImageFilter<TInputImage, TOutputImage>::ThreadedCompute2ndDeri
416412
{
417413
bit = ConstNeighborhoodIterator<InputImageType>(radius, input, face);
418414
bit1 = ConstNeighborhoodIterator<InputImageType>(radius, input1, face);
419-
it = ImageRegionIterator(output, face);
415+
ImageRegionIterator it(output, face);
420416
bit.OverrideBoundaryCondition(&nbc);
421417
bit.GoToBegin();
422418
bit1.GoToBegin();

Modules/Filtering/ImageFilterBase/include/itkMaskNeighborhoodOperatorImageFilter.hxx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -123,17 +123,15 @@ MaskNeighborhoodOperatorImageFilter<TInputImage, TMaskImage, TOutputImage, TOper
123123
// Process non-boundary region and each of the boundary faces.
124124
// These are N-d regions which border the edge of the buffer.
125125
ConstNeighborhoodIterator<InputImageType> bit;
126-
ImageRegionIterator<OutputImageType> it;
127-
ImageRegionConstIterator<MaskImageType> mit;
128126

129127
for (const auto & face : faceList)
130128
{
131129
bit = ConstNeighborhoodIterator<InputImageType>(noperator.GetRadius(), input, face);
132130
bit.OverrideBoundaryCondition(this->GetBoundaryCondition());
133131
bit.GoToBegin();
134132

135-
it = ImageRegionIterator(output, face);
136-
mit = ImageRegionConstIterator(mask, face);
133+
ImageRegionIterator it(output, face);
134+
ImageRegionConstIterator mit(mask, face);
137135
while (!bit.IsAtEnd())
138136
{
139137
if (mit.Get())

Modules/Filtering/ImageFilterBase/include/itkNeighborhoodOperatorImageFilter.hxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,6 @@ NeighborhoodOperatorImageFilter<TInputImage, TOutputImage, TOperatorValueType>::
9292
// pixels that correspond to output pixels.
9393
const FaceListType faceList = faceCalculator(input, outputRegionForThread, m_Operator.GetRadius());
9494

95-
ImageRegionIterator<OutputImageType> it;
96-
9795
TotalProgressReporter progress(this, output->GetRequestedRegion().GetNumberOfPixels());
9896

9997
// Process non-boundary region and each of the boundary faces.
@@ -103,7 +101,7 @@ NeighborhoodOperatorImageFilter<TInputImage, TOutputImage, TOperatorValueType>::
103101
{
104102
bit = ConstNeighborhoodIterator<InputImageType>(m_Operator.GetRadius(), input, face);
105103
bit.OverrideBoundaryCondition(m_BoundsCondition);
106-
it = ImageRegionIterator(output, face);
104+
ImageRegionIterator it(output, face);
107105
bit.GoToBegin();
108106
while (!bit.IsAtEnd())
109107
{

Modules/Filtering/ImageFilterBase/include/itkVectorNeighborhoodOperatorImageFilter.hxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,13 @@ VectorNeighborhoodOperatorImageFilter<TInputImage, TOutputImage>::DynamicThreade
9494

9595
TotalProgressReporter progress(this, output->GetRequestedRegion().GetNumberOfPixels());
9696

97-
ImageRegionIterator<OutputImageType> it;
98-
9997
// Process non-boundary region and then each of the boundary faces.
10098
// These are N-d regions which border the edge of the buffer.
10199
ConstNeighborhoodIterator<InputImageType> bit;
102100
for (const auto & face : faceList)
103101
{
104102
bit = ConstNeighborhoodIterator<InputImageType>(m_Operator.GetRadius(), input, face);
105-
it = ImageRegionIterator(output, face);
103+
ImageRegionIterator it(output, face);
106104
bit.GoToBegin();
107105
while (!bit.IsAtEnd())
108106
{

Modules/Filtering/ImageGradient/include/itkGradientMagnitudeImageFilter.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ GradientMagnitudeImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerate
100100

101101
ConstNeighborhoodIterator<TInputImage> nit;
102102
ConstNeighborhoodIterator<TInputImage> bit;
103-
ImageRegionIterator<TOutputImage> it;
104103

105104
const NeighborhoodInnerProduct<TInputImage, RealType> SIP;
106105

@@ -157,7 +156,7 @@ GradientMagnitudeImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerate
157156
for (const auto & face : faceList)
158157
{
159158
bit = ConstNeighborhoodIterator<InputImageType>(radius, input, face);
160-
it = ImageRegionIterator(output, face);
159+
ImageRegionIterator it(output, face);
161160
bit.OverrideBoundaryCondition(&nbc);
162161
bit.GoToBegin();
163162

Modules/Filtering/ImageGradient/include/itkVectorGradientMagnitudeImageFilter.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,6 @@ VectorGradientMagnitudeImageFilter<TInputImage, TRealType, TOutputImage>::Dynami
188188
{
189189
ZeroFluxNeumannBoundaryCondition<RealVectorImageType> nbc;
190190
ConstNeighborhoodIteratorType bit;
191-
ImageRegionIterator<TOutputImage> it;
192191

193192
// Find the data-set boundary "faces"
194193
NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<RealVectorImageType> bC;
@@ -204,7 +203,7 @@ VectorGradientMagnitudeImageFilter<TInputImage, TRealType, TOutputImage>::Dynami
204203
for (const auto & face : faceList)
205204
{
206205
bit = ConstNeighborhoodIteratorType(r1, m_RealValuedInputImage.GetPointer(), face);
207-
it = ImageRegionIterator(this->GetOutput(), face);
206+
ImageRegionIterator it(this->GetOutput(), face);
208207
bit.OverrideBoundaryCondition(&nbc);
209208
bit.GoToBegin();
210209

Modules/Filtering/MathematicalMorphology/include/itkGrayscaleGeodesicDilateImageFilter.hxx

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -272,12 +272,6 @@ GrayscaleGeodesicDilateImageFilter<TInputImage, TOutputImage>::DynamicThreadedGe
272272
// iterator for the marker image
273273
// NeighborhoodIteratorType markerIt;
274274

275-
// iterator for the mask image
276-
ImageRegionConstIterator<TInputImage> maskIt;
277-
278-
// output iterator
279-
ImageRegionIterator<TOutputImage> oIt;
280-
281275
// Find the boundary "faces". Structuring element is elementary
282276
// (face connected neighbors within a radius of 1).
283277
NeighborhoodAlgorithm::ImageBoundaryFacesCalculator<MarkerImageType> fC;
@@ -290,8 +284,8 @@ GrayscaleGeodesicDilateImageFilter<TInputImage, TOutputImage>::DynamicThreadedGe
290284
for (const auto & face : faceList)
291285
{
292286
NeighborhoodIteratorType markerIt(kernelRadius, this->GetMarkerImage(), face);
293-
maskIt = ImageRegionConstIterator(this->GetMaskImage(), face);
294-
oIt = ImageRegionIterator(this->GetOutput(), face);
287+
ImageRegionConstIterator maskIt(this->GetMaskImage(), face);
288+
ImageRegionIterator oIt(this->GetOutput(), face);
295289

296290
markerIt.OverrideBoundaryCondition(&BC);
297291
markerIt.GoToBegin();

Modules/Filtering/MathematicalMorphology/include/itkMorphologyImageFilter.hxx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,6 @@ MorphologyImageFilter<TInputImage, TOutputImage, TKernel>::DynamicThreadedGenera
5050

5151
TotalProgressReporter progress(this, this->GetOutput()->GetRequestedRegion().GetNumberOfPixels());
5252

53-
ImageRegionIterator<TOutputImage> o_iter;
54-
5553
// Process the boundary faces, these are N-d regions which border the
5654
// edge of the buffer
5755

@@ -62,7 +60,7 @@ MorphologyImageFilter<TInputImage, TOutputImage, TKernel>::DynamicThreadedGenera
6260
{
6361
b_iter = NeighborhoodIteratorType(this->GetKernel().GetRadius(), this->GetInput(), face);
6462

65-
o_iter = ImageRegionIterator(this->GetOutput(), face);
63+
ImageRegionIterator o_iter(this->GetOutput(), face);
6664
b_iter.OverrideBoundaryCondition(m_BoundaryCondition);
6765
b_iter.GoToBegin();
6866

Modules/Segmentation/LabelVoting/include/itkBinaryMedianImageFilter.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ BinaryMedianImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData(
9292
ZeroFluxNeumannBoundaryCondition<InputImageType> nbc;
9393

9494
ConstNeighborhoodIterator<InputImageType> bit;
95-
ImageRegionIterator<OutputImageType> it;
9695

9796
// Allocate output
9897
const typename OutputImageType::Pointer output = this->GetOutput();
@@ -110,7 +109,7 @@ BinaryMedianImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateData(
110109
for (const auto & face : faceList)
111110
{
112111
bit = ConstNeighborhoodIterator<InputImageType>(m_Radius, input, face);
113-
it = ImageRegionIterator(output, face);
112+
ImageRegionIterator it(output, face);
114113
bit.OverrideBoundaryCondition(&nbc);
115114
bit.GoToBegin();
116115

0 commit comments

Comments
 (0)