InsightSoftwareConsortium / ITK

Insight Toolkit (ITK) -- Official Repository. ITK builds on a proven, spatially-oriented architecture for processing, segmentation, and registration of scientific images in two, three, or more dimensions.
https://itk.org
Apache License 2.0
1.37k stars 660 forks source link

STYLE: Replace SetSize/Index calls in tests with `region{ index, size }` #4628

Closed N-Dekker closed 2 months ago

N-Dekker commented 2 months ago

Replaced code like:

RegionType region;
region.SetSize(size);
region.SetIndex(index);

With the shorter equivalent, RegionType region{ index, size };

Using Notepad++, Replace in Files:

Find what: ^( [ ]+)(\w.*Region[^ ]*)([ ]+)(\w+);\r\n\1\4\.SetSize\((\w+)\);\r\n\1\4\.SetIndex\((\w+)\);
Replace with: $1$2$3$4{ $6, $5 };
Find what: ^( [ ]+)(\w.*Region[^ ]*)([ ]+)(\w+);\r\n\1\4\.SetIndex\((\w+)\);\r\n\1\4\.SetSize\((\w+)\);
Replace with: $1$2$3$4{ $5, $6 };
Filters: itk*Test*.cxx
[v] Match case
(*) Regular expression
N-Dekker commented 2 months ago

@thewtex This pull request is only a style improvement of the unit tests. So I think it won't harm to have it merged with ITK 5.4. I like this PR very much, but it's not very urgent, of course. What do you think? 🤷