19 #ifndef itkConnectedImageNeighborhoodShape_h
20 #define itkConnectedImageNeighborhoodShape_h
35 # define ITK_X_ASSERT(CHECK) void(0)
37 # define ITK_X_ASSERT(CHECK) ((CHECK) ? void(0) : [] { assert(!#CHECK); }())
42 namespace Experimental
98 template <
unsigned int VImageDimension>
117 const bool includeCenterPixel) ITK_NOEXCEPT
126 constexpr std::size_t
139 assert(offsets !=
nullptr);
148 const std::size_t numberOfNonZeroOffsetValues =
159 for (
unsigned int direction = 0; direction <
ImageDimension; ++direction)
161 auto & offsetValue = offset[direction];
165 if (offsetValue <= 1)
193 return ((a + b) >= a) && ((a + b) >= b) ? (a + b) : (
ITK_X_ASSERT(!
"CalculateSum overflow!"), 0);
202 return (n < std::numeric_limits<std::uintmax_t>::digits) ? (
std::uintmax_t{ 1 } << n)
222 static constexpr std::size_t
237 static constexpr std::size_t
247 static constexpr std::size_t
250 return (((maximumCityblockDistance == 0) || (
ImageDimension == 0))
260 static constexpr std::size_t
267 template <
unsigned int VImageDimensionOfFriend, std::
size_t VMaximumCityblockDistance,
bool VIncludeCenterPixel>
271 VIncludeCenterPixel)>
277 template <
unsigned int VImageDimension, std::
size_t VMaximumCityblockDistance,
bool VIncludeCenterPixel>
278 std::array<
Offset<VImageDimension>,
280 VIncludeCenterPixel)>
285 shape.FillOffsets(offsets.data());