Skip to content

Commit 2b7e6d4

Browse files
authored
Merge pull request InsightSoftwareConsortium#5992 from N-Dekker/Remove-GoToBegin-on-ImageIterators
Remove GoToBegin() calls from Image Iterators in hxx files
2 parents aed0427 + b3a3e4b commit 2b7e6d4

File tree

31 files changed

+14
-110
lines changed

31 files changed

+14
-110
lines changed

Modules/Filtering/BiasCorrection/include/itkMRASlabIdentifier.hxx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ MRASlabIdentifier<TInputImage>::GenerateSlabRegions()
7878
region.SetIndex(index);
7979

8080
ImageRegionConstIterator iter(m_Image, region);
81-
iter.GoToBegin();
8281

8382
std::priority_queue<ImagePixelType> mins;
8483
for (unsigned int i = 0; i < m_NumberOfSamples; ++i)

Modules/Filtering/BiasCorrection/include/itkMRIBiasFieldCorrectionFilter.hxx

Lines changed: 0 additions & 3 deletions
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
@@ -102,7 +101,6 @@ MRIBiasEnergyFunction<TImage, TImageMask, TBiasField>::GetValue(const Parameters
102101
else
103102
{
104103
ImageRegionIterator mIter(m_Mask, m_Region);
105-
mIter.GoToBegin();
106104
while (!bIter.IsAtEnd())
107105
{
108106
if (mIter.Get() > 0.0)
@@ -547,7 +545,6 @@ MRIBiasFieldCorrectionFilter<TInputImage, TOutputImage, TMaskImage>::CorrectImag
547545
{
548546
itkDebugMacro("Output mask is being used");
549547
ImageRegionIterator mIter(m_OutputMask, region);
550-
mIter.GoToBegin();
551548
while (!bIter.IsAtEnd())
552549
{
553550
const double inputPixel = iIter.Get();

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/ImageIntensity/include/itkDiscreteGaussianDerivativeImageFunction.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,7 @@ DiscreteGaussianDerivativeImageFunction<TInputImage, TOutput>::RecomputeGaussian
136136

137137
// Copy kernel image to neighborhood. Do not copy boundaries.
138138
ImageRegionConstIterator it(kernelImage, kernelRegion);
139-
it.GoToBegin();
140-
unsigned int idx = 0;
139+
unsigned int idx = 0;
141140

142141
while (!it.IsAtEnd())
143142
{

Modules/Filtering/ImageIntensity/include/itkDiscreteGradientMagnitudeGaussianImageFunction.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ DiscreteGradientMagnitudeGaussianImageFunction<TInputImage, TOutput>::RecomputeG
158158

159159
// Copy kernel image to neighborhood. Do not copy boundaries.
160160
ImageRegionConstIterator it(kernelImage, kernelRegion);
161-
it.GoToBegin();
162-
unsigned int idx = 0;
161+
unsigned int idx = 0;
163162

164163
while (!it.IsAtEnd())
165164
{

Modules/Filtering/ImageIntensity/include/itkDiscreteHessianGaussianImageFunction.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,8 +164,7 @@ DiscreteHessianGaussianImageFunction<TInputImage, TOutput>::RecomputeGaussianKer
164164

165165
// Copy kernel image to neighborhood. Do not copy boundaries.
166166
ImageRegionConstIterator it(kernelImage, kernelRegion);
167-
it.GoToBegin();
168-
unsigned int idx = 0;
167+
unsigned int idx = 0;
169168
while (!it.IsAtEnd())
170169
{
171170
m_KernelArray[kernelidx][idx] = it.Get();

Modules/Filtering/ImageIntensity/include/itkHistogramMatchingImageFilter.hxx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,8 +437,6 @@ HistogramMatchingImageFilter<TInputImage, TOutputImage, THistogramMeasurement>::
437437
{
438438
// put each image pixel into the histogram
439439
ImageRegionConstIterator iter(image, image->GetBufferedRegion());
440-
441-
iter.GoToBegin();
442440
while (!iter.IsAtEnd())
443441
{
444442
const InputPixelType & value = iter.Value();

Modules/Filtering/ImageStatistics/include/itkAccumulateImageFilter.hxx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,7 @@ AccumulateImageFilter<TInputImage, TOutputImage>::GenerateData()
181181
}
182182
const typename TInputImage::RegionType AccumulatedRegion(AccumulatedIndex, AccumulatedSize);
183183
ImageRegionConstIterator inputIter(inputImage, AccumulatedRegion);
184-
inputIter.GoToBegin();
185-
AccumulateType Value{};
184+
AccumulateType Value{};
186185
while (!inputIter.IsAtEnd())
187186
{
188187
Value += static_cast<AccumulateType>(inputIter.Get());

Modules/Filtering/ImageStatistics/include/itkImagePCAShapeModelEstimator.hxx

Lines changed: 0 additions & 3 deletions
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]));
@@ -166,8 +165,6 @@ ImagePCAShapeModelEstimator<TInputImage, TOutputImage>::GenerateData()
166165
{
167166
region = this->GetOutput(j)->GetRequestedRegion();
168167
ImageRegionIterator outIterJ(this->GetOutput(j), region);
169-
170-
outIterJ.GoToBegin();
171168
while (!outIterJ.IsAtEnd())
172169
{
173170
outIterJ.Set(0);

0 commit comments

Comments
 (0)