19#ifndef itkConnectedImageNeighborhoodShape_h
20#define itkConnectedImageNeighborhoodShape_h
86template <
unsigned int VImageDimension>
105 const bool includeCenterPixel) noexcept
127 assert(offsets !=
nullptr);
136 const size_t numberOfNonZeroOffsetValues =
147 for (
unsigned int direction = 0; direction <
ImageDimension; ++direction)
149 auto & offsetValue = offset[direction];
153 if (offsetValue <= 1)
178 static constexpr uintmax_t
181 return ((a + b) >= a) && ((a + b) >= b) ? (a + b) : (assert(!
"CalculateSum overflow!"), 0);
187 static constexpr uintmax_t
190 return (n < std::numeric_limits<uintmax_t>::digits) ? (uintmax_t{ 1 } << n)
191 : (assert(!
"CalculatePowerOfTwo overflow!"), 0);
199 static constexpr uintmax_t
202 return (k > n) ? (assert(!
"Out of range!"), 0)
210 static constexpr size_t
225 static constexpr size_t
234 static constexpr size_t
237 return (((maximumCityblockDistance == 0) || (
ImageDimension == 0))
247 static constexpr size_t
257template <
unsigned int VImageDimension,
size_t VMaximumCityblockDistance,
bool VIncludeCenterPixel>
263 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
constexpr iterator begin()