Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

STYLE: Remove p->Initialize() calls directly after p = T::New() #4972

Conversation

N-Dekker
Copy link
Contributor

For any ITK type T, T::New() does already initialize the object it returns.

Using Notepad++, Replace in Files, doing:

Find what:  (\w+)([ ]+= .+::New\(\);)\r\n[\r\n]* [ ]+\1->Initialize\(\);
Replace with:  $1$2
Filters: itk*.* !+\test
Directory: D:\src\ITK\Modules
[v] Match case
(*) Regular expression

Manually removed an obsolete comment saying Clear elements.

For any ITK type `T`, `T::New()` does already initialize the object it returns.

Using Notepad++, Replace in Files, doing:

    Find what:  (\w+)([ ]+= .+::New\(\);)\r\n[\r\n]* [ ]+\1->Initialize\(\);
    Replace with:  $1$2
    Filters: itk*.* !+\test
    Directory: D:\src\ITK\Modules
    [v] Match case
    (*) Regular expression

Manually removed an obsolete comment saying `Clear elements`.
@github-actions github-actions bot added area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:Registration Issues affecting the Registration module area:Segmentation Issues affecting the Segmentation module type:Style Style changes: no logic impact (indentation, comments, naming) area:Numerics Issues affecting the Numerics module labels Nov 21, 2024
@N-Dekker N-Dekker marked this pull request as ready for review November 21, 2024 14:05
@hjmjohnson hjmjohnson merged commit 674b3d2 into InsightSoftwareConsortium:master Nov 21, 2024
17 checks passed
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Nov 21, 2024
- Follow-up to pull request InsightSoftwareConsortium#4972
commit 674b3d2
"STYLE: Remove `p->Initialize()` calls directly after `p = T::New()`"
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Nov 21, 2024
- Follow-up to pull request InsightSoftwareConsortium#4972
commit 674b3d2
"STYLE: Remove `p->Initialize()` calls directly after `p = T::New()`"
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Nov 21, 2024
- Follow-up to pull request InsightSoftwareConsortium#4972
commit 674b3d2
"STYLE: Remove `p->Initialize()` calls directly after `p = T::New()`"
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Nov 21, 2024
For most ITK types, `p->Initialize()` has no effect, directly after
`p = T::New()`, so the `Initialize()` call might as well be removed.

Excluded a `randomNumberGenerator->Initialize()` call from this commit, as that
call appears to actually have an effect (randomizing the seed).

- Follow-up to pull request InsightSoftwareConsortium#4972
commit 674b3d2
"STYLE: Remove `p->Initialize()` calls directly after `p = T::New()`"
N-Dekker added a commit to N-Dekker/ITK that referenced this pull request Nov 21, 2024
- Follow-up to pull request InsightSoftwareConsortium#4972
commit 674b3d2
"STYLE: Remove `p->Initialize()` calls directly after `p = T::New()`"
hjmjohnson pushed a commit that referenced this pull request Nov 22, 2024
For most ITK types, `p->Initialize()` has no effect, directly after
`p = T::New()`, so the `Initialize()` call might as well be removed.

Excluded a `randomNumberGenerator->Initialize()` call from this commit, as that
call appears to actually have an effect (randomizing the seed).

- Follow-up to pull request #4972
commit 674b3d2
"STYLE: Remove `p->Initialize()` calls directly after `p = T::New()`"
hjmjohnson pushed a commit that referenced this pull request Nov 22, 2024
- Follow-up to pull request #4972
commit 674b3d2
"STYLE: Remove `p->Initialize()` calls directly after `p = T::New()`"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:Core Issues affecting the Core module area:Filtering Issues affecting the Filtering module area:Numerics Issues affecting the Numerics module area:Registration Issues affecting the Registration module area:Segmentation Issues affecting the Segmentation module type:Style Style changes: no logic impact (indentation, comments, naming)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants