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.4k stars 662 forks source link

STYLE: Declare local `radius`, `center` variables in Filtering constexpr #4509

Closed N-Dekker closed 5 months ago

N-Dekker commented 5 months ago

Added a local variable, neighborhoodSize, to clarify that the size of the neighborhood is in these cases always simply 3^N for an N-dimensional image.

Following Scott Meyers, Effective Modern C++ (2014), "Use constexpr whenever possible" and C++ Core Guidelines, "Use constexpr for values that can be computed at compile time"

N-Dekker commented 5 months ago

FYI, I'm still considering to declare those constant variables "static constexpr", as was recommended by C++ Weekly With Jason Turner, Episode 312, "Stop Using constexpr (And Use This Instead!)"


Update, March 12, 2024: With the force-push that I just did, the pull request does declare those constant variables "static constexpr"!