19#ifndef itkConnectedImageNeighborhoodShape_h
20#define itkConnectedImageNeighborhoodShape_h
86template <
unsigned int VImageDimension>
104 const bool includeCenterPixel) noexcept
124 assert(offsets !=
nullptr);
132 const size_t numberOfNonZeroOffsetValues =
143 for (
unsigned int direction = 0; direction <
ImageDimension; ++direction)
145 auto & offsetValue = offset[direction];
149 if (offsetValue <= 1)
174 static constexpr uintmax_t
177 return ((a + b) >= a) && ((a + b) >= b) ? (a + b) : (assert(!
"CalculateSum overflow!"), 0);
183 static constexpr uintmax_t
186 return (n < std::numeric_limits<uintmax_t>::digits) ? (uintmax_t{ 1 } << n)
187 : (assert(!
"CalculatePowerOfTwo overflow!"), 0);
195 static constexpr uintmax_t
198 return (k > n) ? (assert(!
"Out of range!"), 0)
207 static constexpr size_t
222 static constexpr size_t
231 static constexpr size_t
234 return (((maximumCityblockDistance == 0) || (
ImageDimension == 0))
244 static constexpr size_t
252template <
unsigned int VImageDimension,
size_t VMaximumCityblockDistance,
bool VIncludeCenterPixel>
258 shape.FillOffsets(offsets.data());
static constexpr vcl_size_t CalculateNumberOfConnectedNeighbors(const vcl_size_t maximumCityblockDistance) noexcept
static constexpr vcl_size_t CalculateNumberOfOffsets(const vcl_size_t maximumCityblockDistance, const bool includeCenterPixel) noexcept
static constexpr uintmax_t CalculatePowerOfTwo(const vcl_size_t n) noexcept
vcl_size_t m_NumberOfOffsets
constexpr vcl_size_t GetNumberOfOffsets() const noexcept
bool m_IncludeCenterPixel
static constexpr unsigned int ImageDimension
static constexpr vcl_size_t CalculateSumOfNumberOfHypercubesOnBoundaryOfCube(const vcl_size_t i, const vcl_size_t m) noexcept
static constexpr uintmax_t CalculateSum(const uintmax_t a, const uintmax_t b) noexcept
static constexpr vcl_size_t CalculateNumberOfHypercubesOnBoundaryOfCube(const vcl_size_t m, const vcl_size_t n) noexcept
vcl_size_t m_MaximumCityblockDistance
constexpr ConnectedImageNeighborhoodShape(const vcl_size_t maximumCityblockDistance, const bool includeCenterPixel) noexcept
static constexpr uintmax_t CalculateBinomialCoefficient(const uintmax_t n, const uintmax_t k) noexcept
void FillOffsets(Offset< ImageDimension > *const offsets) const noexcept
constexpr TReturnType UnsignedPower(const uintmax_t base, const uintmax_t exponent) noexcept
constexpr TReturnType UnsignedProduct(const uintmax_t a, const uintmax_t b) noexcept
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
auto GenerateConnectedImageNeighborhoodShapeOffsets() noexcept
Represent a n-dimensional offset between two n-dimensional indexes of n-dimensional image.
constexpr iterator begin()