19 #ifndef itkConnectedImageNeighborhoodShape_h
20 #define itkConnectedImageNeighborhoodShape_h
34 # define ITK_X_ASSERT(CHECK) void(0)
36 # define ITK_X_ASSERT(CHECK) \
37 ( (CHECK) ? void(0) : []{assert(!#CHECK);}() )
42 namespace Experimental
98 template <
unsigned int VImageDimension>
117 const std::size_t maximumCityblockDistance,
118 const bool includeCenterPixel) ITK_NOEXCEPT
141 assert(offsets !=
nullptr);
151 static_cast<std::size_t
>(std::count(offset.
begin(), offset.
end(), 0));
161 for (
unsigned int direction = 0; direction <
ImageDimension; ++direction)
163 auto& offsetValue = offset[direction];
167 if (offsetValue <= 1)
196 return ((a + b) >= a) && ((a + b) >= b) ? (a + b) :
207 return (((a * b) / a) == b) && (((a * b) / b) == a) ? (a * b) :
215 const std::size_t n) ITK_NOEXCEPT
217 return (n < std::numeric_limits<std::uintmax_t>::digits) ?
225 const std::size_t n) ITK_NOEXCEPT
227 return (n == 0) ? 1 :
252 const std::size_t n) ITK_NOEXCEPT
269 const std::size_t m) ITK_NOEXCEPT
279 const std::size_t maximumCityblockDistance) ITK_NOEXCEPT
281 return (((maximumCityblockDistance == 0) || (
ImageDimension == 0)) ? 0 :
289 const std::size_t maximumCityblockDistance,
290 const bool includeCenterPixel) ITK_NOEXCEPT
292 return (includeCenterPixel ? 1 : 0) +
297 template <
unsigned int VImageDimensionOfFriend, std::
size_t VMaximumCityblockDistance,
bool VIncludeCenterPixel>
307 template <
unsigned int VImageDimension, std::
size_t VMaximumCityblockDistance,
bool VIncludeCenterPixel>
315 shape.FillOffsets(offsets.data());
#define ITK_X_ASSERT(CHECK)
static constexpr std::vcl_size_t CalculateSumOfNumberOfHypercubesOnBoundaryOfCube(const std::vcl_size_t i, const std::vcl_size_t m) noexcept
constexpr std::vcl_size_t GetNumberOfOffsets() const noexcept
static constexpr std::uintmax_t CalculateBinomialCoefficient(const std::uintmax_t n, const std::uintmax_t k) noexcept
static constexpr std::uintmax_t CalculateSum(const std::uintmax_t a, const std::uintmax_t b) noexcept
static constexpr unsigned int ImageDimension
static constexpr std::vcl_size_t CalculateNumberOfHypercubesOnBoundaryOfCube(const std::vcl_size_t m, const std::vcl_size_t n) noexcept
static constexpr std::uintmax_t CalculatePowerOfThree(const std::vcl_size_t n) noexcept
static constexpr std::vcl_size_t CalculateNumberOfOffsets(const std::vcl_size_t maximumCityblockDistance, const bool includeCenterPixel) noexcept
static constexpr std::uintmax_t CalculatePowerOfTwo(const std::vcl_size_t n) noexcept
static constexpr std::vcl_size_t CalculateNumberOfConnectedNeighbors(const std::vcl_size_t maximumCityblockDistance) noexcept
std::vcl_size_t m_NumberOfOffsets
void FillOffsets(Offset< ImageDimension > *const offsets) const noexcept
friend std::array< Offset< VImageDimensionOfFriend >, ConnectedImageNeighborhoodShape< VImageDimensionOfFriend >::CalculateNumberOfOffsets(VMaximumCityblockDistance, VIncludeCenterPixel)> GenerateConnectedImageNeighborhoodShapeOffsets() noexcept
constexpr ConnectedImageNeighborhoodShape(const std::vcl_size_t maximumCityblockDistance, const bool includeCenterPixel) noexcept
static constexpr std::uintmax_t CalculateProduct(const std::uintmax_t a, const std::uintmax_t b) noexcept
bool m_IncludeCenterPixel
std::vcl_size_t m_MaximumCityblockDistance