STYLE: Remove GoToBegin() from just constructed iterators "WithIndex"#6096
Conversation
Using Notepad++, Replace in Files, doing:
Find what: ^([ ]+)(Image\w+IteratorWithIndex[ ]+)(\w+)(.+)[\r\n]+\1\3\.GoToBegin\(\).
Replace with: $1$2$3$4
Search Mode: Regular expression
Follow-up to pull request InsightSoftwareConsortium#4830
commit cf57876
"STYLE: Remove unnecessary iterator `GoToBegin()` calls from Core"
|
| Filename | Overview |
|---|---|
| Modules/Filtering/DiffusionTensorImage/include/itkDiffusionTensor3DReconstructionImageFilter.hxx | Removes redundant git.GoToBegin() immediately after ImageRegionConstIteratorWithIndex git(...) construction; clean and correct. |
| Modules/Filtering/Smoothing/include/itkBinomialBlurImageFilter.hxx | Removes redundant tempItDir.GoToBegin() immediately after ImageRegionIteratorWithIndex tempItDir(...) construction; clean and correct. |
| Modules/Nonunit/Review/include/itkRegionBasedLevelSetFunction.hxx | Removes It.GoToBegin() from a comma-expression; constIt.GoToBegin() is retained (acknowledged as a follow-up item per existing thread discussion). |
| Modules/Registration/Common/include/itkImageToImageMetric.hxx | Removes redundant regionIter.GoToBegin() immediately after ImageRegionConstIteratorWithIndex regionIter(...) construction; clean and correct. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["ImageRegionIteratorWithIndex it(image, region)"]
B["it.GoToBegin() — REMOVED (redundant)"]
C["while (!it.IsAtEnd()) { ... }"]
A -->|"Constructor already positions\niterator at begin"| C
A -. "was" .-> B
B -. "was" .-> C
Reviews (2): Last reviewed commit: "STYLE: Remove GoToBegin() from just cons..." | Re-trigger Greptile
Using Notepad++, Replace in Files, doing:
GoToBegin()calls from Core #4830