Skip to content

Commit b3a3e4b

Browse files
committed
STYLE: Remove GoToBegin() from Image Iterators in hxx files (manually)
Cases found by the following regular expression: ^([ ]+)(Image\w+Iterator[ ]+)(\w+)(\(.*\);).*?^\1\3\.GoToBegin Manually removed. Follow-up to pull request InsightSoftwareConsortium#4830 commit cf57876 "STYLE: Remove unnecessary iterator `GoToBegin()` calls from Core"
1 parent b1162f4 commit b3a3e4b

16 files changed

+4
-52
lines changed

Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.hxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ MRIBiasEnergyFunction<TImage, TImageMask, TBiasField>::GetValue(const Parameters
8585
typename TBiasField::SimpleForwardIterator bIter(m_BiasField);
8686

8787
bIter.Begin();
88-
iIter.GoToBegin();
8988
total = 0.0;
9089

9190
// Fastest for full sampling

Modules/Filtering/DistanceMap/include/itkSignedMaurerDistanceMapImageFilter.hxx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -253,9 +253,6 @@ SignedMaurerDistanceMapImageFilter<TInputImage, TOutputImage>::ThreadedGenerateD
253253
ImageRegionIterator Ot(outputPtr, outputRegion);
254254
ImageRegionConstIterator It(m_InputCache, outputRegion);
255255

256-
Ot.GoToBegin();
257-
It.GoToBegin();
258-
259256
ProgressReporter progress2(this,
260257
threadId,
261258
outputRegionForThread.GetNumberOfPixels(),

Modules/Filtering/ImageGrid/include/itkBSplineScatteredDataPointSetToImageFilter.hxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -658,8 +658,6 @@ BSplineScatteredDataPointSetToImageFilter<TInputPointSet, TOutputImage>::AfterTh
658658

659659
ItD.GoToBegin();
660660
ItO.GoToBegin();
661-
Itd.GoToBegin();
662-
Ito.GoToBegin();
663661
while (!ItD.IsAtEnd())
664662
{
665663
ItD.Set(ItD.Get() + Itd.Get());

Modules/Filtering/ImageStatistics/include/itkImagePCAShapeModelEstimator.hxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,6 @@ ImagePCAShapeModelEstimator<TInputImage, TOutputImage>::GenerateData()
149149
ImageRegionIterator outIterJ(this->GetOutput(j), region);
150150

151151
unsigned int idx = 0;
152-
outIterJ.GoToBegin();
153152
while (!outIterJ.IsAtEnd())
154153
{
155154
outIterJ.Set(static_cast<typename OutputImageType::PixelType>(m_OneEigenVector[idx]));

Modules/Filtering/LabelMap/include/itkLabelMapToBinaryImageFilter.hxx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,6 @@ LabelMapToBinaryImageFilter<TInputImage, TOutputImage>::DynamicThreadedGenerateD
101101
ImageRegionConstIterator bgIt(this->GetBackgroundImage(), outputRegionForThread);
102102
ImageRegionIterator oIt(output, outputRegionForThread);
103103

104-
bgIt.GoToBegin();
105-
oIt.GoToBegin();
106-
107104
while (!oIt.IsAtEnd())
108105
{
109106
const OutputImagePixelType & bg = bgIt.Get();

Modules/Nonunit/Review/include/itkMultiphaseDenseFiniteDifferenceImageFilter.hxx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ MultiphaseDenseFiniteDifferenceImageFilter<TInputImage, TFeatureImage, TOutputIm
6464
// Fill the output pointer
6565
auto p = static_cast<OutputPixelType>(this->m_Lookup[i]);
6666

67-
in.GoToBegin();
68-
out.GoToBegin();
69-
7067
while (!out.IsAtEnd())
7168
{
7269
if (in.Get() < 0)
@@ -132,7 +129,6 @@ typename MultiphaseDenseFiniteDifferenceImageFilter<TInputImage, TFeatureImage,
132129
ImageRegionIterator nU(m_UpdateBuffers[i], *fIt);
133130

134131
nD.GoToBegin();
135-
nU.GoToBegin();
136132

137133
while (!nD.IsAtEnd())
138134
{
@@ -206,9 +202,6 @@ MultiphaseDenseFiniteDifferenceImageFilter<TInputImage, TFeatureImage, TOutputIm
206202
ImageRegionIterator u(m_UpdateBuffers[i], region);
207203
ImageRegionIterator o(this->m_LevelSet[i], region);
208204

209-
u.GoToBegin();
210-
o.GoToBegin();
211-
212205
while (!u.IsAtEnd())
213206
{
214207
InputPixelType val = static_cast<InputPixelType>(dt) * u.Get();
@@ -240,7 +233,6 @@ MultiphaseDenseFiniteDifferenceImageFilter<TInputImage, TFeatureImage, TOutputIm
240233
rms_change_accumulator = 0;
241234

242235
o.GoToBegin();
243-
it.GoToBegin();
244236

245237
while (!o.IsAtEnd())
246238
{

Modules/Nonunit/Review/include/itkMultiphaseSparseFiniteDifferenceImageFilter.hxx

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,6 @@ MultiphaseSparseFiniteDifferenceImageFilter<TInputImage, TFeatureImage, TOutputI
138138
ImageRegionIterator lIt(input, region);
139139
ImageRegionIterator tIt(tempImage, region);
140140

141-
lIt.GoToBegin();
142-
tIt.GoToBegin();
143-
144141
while (!lIt.IsAtEnd())
145142
{
146143
tIt.Set(lIt.Get());
@@ -160,7 +157,6 @@ MultiphaseSparseFiniteDifferenceImageFilter<TInputImage, TFeatureImage, TOutputI
160157
ImageRegionIterator zIt(zeroCrossingFilter->GetOutput(), region);
161158

162159
lIt.GoToBegin();
163-
zIt.GoToBegin();
164160

165161
while (!lIt.IsAtEnd())
166162
{
@@ -1121,7 +1117,6 @@ MultiphaseSparseFiniteDifferenceImageFilter<TInputImage, TFeatureImage, TOutputI
11211117
ImageRegionConstIterator statusIt(sparsePtr->m_StatusImage, this->m_LevelSet[fId]->GetRequestedRegion());
11221118

11231119
ImageRegionIterator outputIt(this->m_LevelSet[fId], this->m_LevelSet[fId]->GetRequestedRegion());
1124-
statusIt.GoToBegin();
11251120

11261121
while (!outputIt.IsAtEnd())
11271122
{
@@ -1329,9 +1324,6 @@ MultiphaseSparseFiniteDifferenceImageFilter<TInputImage, TFeatureImage, TOutputI
13291324

13301325
auto p = static_cast<OutputPixelType>(this->m_Lookup[fId]);
13311326

1332-
inIt.GoToBegin();
1333-
outIt.GoToBegin();
1334-
13351327
while (!outIt.IsAtEnd())
13361328
{
13371329
if (inIt.Get() < 0)

Modules/Numerics/Statistics/include/itkImageClassifierFilter.hxx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -149,9 +149,6 @@ ImageClassifierFilter<TSample, TInputImage, TOutputImage>::GenerateData()
149149
ImageRegionConstIterator inpItr(inputImage, inputImage->GetBufferedRegion());
150150
ImageRegionIterator outItr(outputImage, outputImage->GetBufferedRegion());
151151

152-
inpItr.GoToBegin();
153-
outItr.GoToBegin();
154-
155152
while (!inpItr.IsAtEnd())
156153
{
157154
MeasurementVectorType measurements;

Modules/Numerics/Statistics/include/itkMaskedImageToHistogramFilter.hxx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,10 +41,8 @@ MaskedImageToHistogramFilter<TImage, TMaskImage>::ThreadedComputeMinimumAndMaxim
4141

4242
const MaskPixelType maskValue = this->GetMaskValue();
4343

44-
ImageRegionConstIterator inputIt(this->GetInput(), inputRegionForThread);
45-
ImageRegionConstIterator maskIt(this->GetMaskImage(), inputRegionForThread);
46-
inputIt.GoToBegin();
47-
maskIt.GoToBegin();
44+
ImageRegionConstIterator inputIt(this->GetInput(), inputRegionForThread);
45+
ImageRegionConstIterator maskIt(this->GetMaskImage(), inputRegionForThread);
4846
HistogramMeasurementVectorType m(nbOfComponents);
4947

5048
min.Fill(NumericTraits<ValueType>::max());
@@ -84,10 +82,8 @@ MaskedImageToHistogramFilter<TImage, TMaskImage>::ThreadedStreamedGenerateData(c
8482
histogram->SetMeasurementVectorSize(nbOfComponents);
8583
histogram->Initialize(outputHistogram->GetSize(), this->m_Minimum, this->m_Maximum);
8684

87-
ImageRegionConstIterator inputIt(this->GetInput(), inputRegionForThread);
88-
ImageRegionConstIterator maskIt(this->GetMaskImage(), inputRegionForThread);
89-
inputIt.GoToBegin();
90-
maskIt.GoToBegin();
85+
ImageRegionConstIterator inputIt(this->GetInput(), inputRegionForThread);
86+
ImageRegionConstIterator maskIt(this->GetMaskImage(), inputRegionForThread);
9187
HistogramMeasurementVectorType m(nbOfComponents);
9288
const MaskPixelType maskValue = this->GetMaskValue();
9389

Modules/Segmentation/Classifiers/include/itkBayesianClassifierInitializationImageFilter.hxx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,9 +137,6 @@ BayesianClassifierInitializationImageFilter<TInputImage, TProbabilityPrecisionTy
137137
const typename InputImageType::RegionType imageRegion = inputImage->GetLargestPossibleRegion();
138138
InputImageIteratorType itrInputImage(inputImage, imageRegion);
139139

140-
itrInputImage.GoToBegin();
141-
itrKMeansImage.GoToBegin();
142-
143140
// find sumsOfSquares, sums, and classCount by indexing using the kmeans
144141
// output labelmap
145142
while (!itrInputImage.IsAtEnd())

0 commit comments

Comments
 (0)