#include <itkConnectedImageNeighborhoodShape.h>
Connected image-neighborhood shape, based on the topological property of pixel connectivity. Eases creating a sequence of offsets to construct a ShapedImageNeighborhoodRange object. Can also be used to specify the shape of a ShapedNeighborhoodIterator, using its ActivateOffset member function.
This shape class supports generating offsets in colexicographic order. Which means that, for example, a sequence of generated offsets for a 2-dimensional shape will have offset {1, 0} before offset {0, 1}. This order was chosen because it is usually in agreement with the order of the corresponding neighbor pixels, as stored in the internal image buffer.
The following example generates the offsets for a 3-dimensional 18-connected neighborhood shape, including the center pixel, and asserts that the result is as expected:
The following code shows how to create 4-connected, 8-connected, 6-connected, 18-connected, and 26-connected neighborhood shapes:
Definition at line 89 of file itkConnectedImageNeighborhoodShape.h.
Public Member Functions | |
constexpr vcl_size_t | GetNumberOfOffsets () const noexcept |
constexpr | ConnectedImageNeighborhoodShape (const vcl_size_t maximumCityblockDistance, const bool includeCenterPixel) noexcept |
void | FillOffsets (Offset< ImageDimension > *const offsets) const noexcept |
Static Public Attributes | |
static constexpr unsigned int | ImageDimension = VImageDimension |
Static Private Member Functions | |
static constexpr uintmax_t | CalculateBinomialCoefficient (const uintmax_t n, const uintmax_t k) noexcept |
static constexpr vcl_size_t | CalculateNumberOfConnectedNeighbors (const vcl_size_t maximumCityblockDistance) noexcept |
static constexpr vcl_size_t | CalculateNumberOfHypercubesOnBoundaryOfCube (const vcl_size_t m, const vcl_size_t n) noexcept |
static constexpr uintmax_t | CalculatePowerOfTwo (const vcl_size_t n) noexcept |
static constexpr uintmax_t | CalculateSum (const uintmax_t a, const uintmax_t b) noexcept |
static constexpr vcl_size_t | CalculateSumOfNumberOfHypercubesOnBoundaryOfCube (const vcl_size_t i, const vcl_size_t m) noexcept |
static constexpr vcl_size_t | CalculateNumberOfOffsets (const vcl_size_t maximumCityblockDistance, const bool includeCenterPixel) noexcept |
Private Attributes | |
bool | m_IncludeCenterPixel |
vcl_size_t | m_MaximumCityblockDistance |
vcl_size_t | m_NumberOfOffsets |
|
inlineexplicitconstexprnoexcept |
Constructs a connected image-neighborhood shape. Its offsets contain only the offset values -1, 0, and 1. The parameter 'maximumCityblockDistance' specifies the maximum city-block distance (Manhattan distance) between the center pixel and the connected neighbor pixel. This distance measure corresponds to the number of non-zero values of an offset. For example, in a 3-dimensional neighborhood, offset {1,0,0}, {0,1,0}, and {0,0,1} have distance = 1 to the center, while offset {1,1,1} has distance = 3. The parameter 'includeCenterPixel' specifies whether or not the center pixel (offset zero) should be included with the offsets for this shape.
Definition at line 105 of file itkConnectedImageNeighborhoodShape.h.
References m_MaximumCityblockDistance.
|
inlinestaticconstexprprivatenoexcept |
Definition at line 201 of file itkConnectedImageNeighborhoodShape.h.
References CalculateBinomialCoefficient(), and itk::Math::UnsignedProduct().
Referenced by CalculateBinomialCoefficient(), and CalculateNumberOfHypercubesOnBoundaryOfCube().
|
inlinestaticconstexprprivatenoexcept |
Calculates the number of neighbors connected to the center pixel.
Definition at line 237 of file itkConnectedImageNeighborhoodShape.h.
References CalculateSumOfNumberOfHypercubesOnBoundaryOfCube(), ImageDimension, and itk::Math::UnsignedPower().
Referenced by CalculateNumberOfOffsets().
|
inlinestaticconstexprprivatenoexcept |
Definition at line 213 of file itkConnectedImageNeighborhoodShape.h.
References CalculateBinomialCoefficient(), CalculatePowerOfTwo(), and itk::Math::UnsignedProduct().
Referenced by CalculateSumOfNumberOfHypercubesOnBoundaryOfCube().
|
inlinestaticconstexprprivatenoexcept |
Calculates the number of offsets needed for this shape.
Definition at line 250 of file itkConnectedImageNeighborhoodShape.h.
References CalculateNumberOfConnectedNeighbors().
|
inlinestaticconstexprprivatenoexcept |
Definition at line 189 of file itkConnectedImageNeighborhoodShape.h.
Referenced by CalculateNumberOfHypercubesOnBoundaryOfCube().
|
inlinestaticconstexprprivatenoexcept |
Definition at line 180 of file itkConnectedImageNeighborhoodShape.h.
Referenced by CalculateSumOfNumberOfHypercubesOnBoundaryOfCube().
|
inlinestaticconstexprprivatenoexcept |
Definition at line 228 of file itkConnectedImageNeighborhoodShape.h.
References CalculateNumberOfHypercubesOnBoundaryOfCube(), CalculateSum(), CalculateSumOfNumberOfHypercubesOnBoundaryOfCube(), and ImageDimension.
Referenced by CalculateNumberOfConnectedNeighbors(), and CalculateSumOfNumberOfHypercubesOnBoundaryOfCube().
|
inlinenoexcept |
Fills the specified buffer with the offsets for a neighborhood of this shape.
Definition at line 124 of file itkConnectedImageNeighborhoodShape.h.
References itk::Offset< VDimension >::begin(), itk::Offset< VDimension >::end(), ImageDimension, m_IncludeCenterPixel, m_MaximumCityblockDistance, and m_NumberOfOffsets.
|
inlineconstexprnoexcept |
Returns the number of offsets needed for this shape.
Definition at line 116 of file itkConnectedImageNeighborhoodShape.h.
References m_NumberOfOffsets.
Referenced by itk::GenerateConnectedImageNeighborhoodShapeOffsets().
|
staticconstexpr |
Definition at line 92 of file itkConnectedImageNeighborhoodShape.h.
Referenced by CalculateNumberOfConnectedNeighbors(), CalculateSumOfNumberOfHypercubesOnBoundaryOfCube(), and FillOffsets().
|
private |
Definition at line 171 of file itkConnectedImageNeighborhoodShape.h.
Referenced by FillOffsets().
|
private |
Definition at line 167 of file itkConnectedImageNeighborhoodShape.h.
Referenced by ConnectedImageNeighborhoodShape(), and FillOffsets().
|
private |
Definition at line 174 of file itkConnectedImageNeighborhoodShape.h.
Referenced by FillOffsets(), and GetNumberOfOffsets().