ITK  5.2.0
Insight Toolkit
Static Public Attributes | List of all members
itk::ConnectedImageNeighborhoodShape< VImageDimension > Class Template Reference

#include <itkConnectedImageNeighborhoodShape.h>

Static Public Attributes

static constexpr unsigned int ImageDimension = VImageDimension
 
std::vcl_size_t m_MaximumCityblockDistance
 
bool m_IncludeCenterPixel
 
std::vcl_size_t m_NumberOfOffsets
 
constexpr ConnectedImageNeighborhoodShape (const std::vcl_size_t maximumCityblockDistance, const bool includeCenterPixel) noexcept
 
constexpr std::vcl_size_t GetNumberOfOffsets () const noexcept
 
void FillOffsets (Offset< ImageDimension > *const offsets) const noexcept
 
static constexpr std::uintmax_t CalculateSum (const std::uintmax_t a, const std::uintmax_t b) noexcept
 
static constexpr std::uintmax_t CalculatePowerOfTwo (const std::vcl_size_t n) noexcept
 
static constexpr std::uintmax_t CalculateBinomialCoefficient (const std::uintmax_t n, const std::uintmax_t k) noexcept
 
static constexpr std::vcl_size_t CalculateNumberOfHypercubesOnBoundaryOfCube (const std::vcl_size_t m, const std::vcl_size_t n) noexcept
 
static constexpr std::vcl_size_t CalculateSumOfNumberOfHypercubesOnBoundaryOfCube (const std::vcl_size_t i, const std::vcl_size_t m) noexcept
 
static constexpr std::vcl_size_t CalculateNumberOfConnectedNeighbors (const std::vcl_size_t maximumCityblockDistance) noexcept
 
static constexpr std::vcl_size_t CalculateNumberOfOffsets (const std::vcl_size_t maximumCityblockDistance, const bool includeCenterPixel) noexcept
 
template<unsigned int VImageDimensionOfFriend, std::vcl_size_t VMaximumCityblockDistance, bool VIncludeCenterPixel>
std::array< Offset< VImageDimensionOfFriend >, ConnectedImageNeighborhoodShape< VImageDimensionOfFriend >::CalculateNumberOfOffsets(VMaximumCityblockDistance, VIncludeCenterPixel)> GenerateConnectedImageNeighborhoodShapeOffsets () noexcept
 

Detailed Description

template<unsigned int VImageDimension>
class itk::ConnectedImageNeighborhoodShape< VImageDimension >

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:

std::size_t maximumCityblockDistance = 2;
bool includeCenterPixel = true;
ConnectedImageNeighborhoodShape<3> shape{ maximumCityblockDistance, includeCenterPixel };
std::vector<Offset<3>> offsets = GenerateImageNeighborhoodOffsets(shape);
assert(offsets.size() == 19);
assert(offsets == std::vector<Offset<3>>(
{
{{0, -1, -1}}, {{-1, 0, -1}}, {{0, 0, -1}},
{{1, 0, -1}}, {{0, 1, -1}}, {{-1, -1, 0}},
{{0, -1, 0}}, {{1, -1, 0}}, {{-1, 0, 0}},
{{0, 0, 0}},
{{1, 0, 0}}, {{-1, 1, 0}}, {{0, 1, 0}},
{{1, 1, 0}}, {{0, -1, 1}}, {{-1, 0, 1}},
{{0, 0, 1}}, {{1, 0, 1}}, {{0, 1, 1}}
}));

The following code shows how to create 4-connected, 8-connected, 6-connected, 18-connected, and 26-connected neighborhood shapes:

// 2-dimensional:
ConnectedImageNeighborhoodShape<2> _4_connectedShape{ 1, includeCenterPixel };
ConnectedImageNeighborhoodShape<2> _8_connectedShape{ 2, includeCenterPixel };
// 3-dimensional:
ConnectedImageNeighborhoodShape<3> _6_connectedShape{ 1, includeCenterPixel };
ConnectedImageNeighborhoodShape<3> _18_connectedShape{ 2, includeCenterPixel };
ConnectedImageNeighborhoodShape<3> _26_connectedShape{ 3, includeCenterPixel };
Author
Niels Dekker, LKEB, Leiden University Medical Center
See also
ShapedImageNeighborhoodRange
ShapedNeighborhoodIterator

Definition at line 97 of file itkConnectedImageNeighborhoodShape.h.

Constructor & Destructor Documentation

◆ ConnectedImageNeighborhoodShape()

template<unsigned int VImageDimension>
constexpr itk::ConnectedImageNeighborhoodShape< VImageDimension >::ConnectedImageNeighborhoodShape ( const std::vcl_size_t  maximumCityblockDistance,
const bool  includeCenterPixel 
)
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 114 of file itkConnectedImageNeighborhoodShape.h.

Member Function Documentation

◆ CalculateBinomialCoefficient()

template<unsigned int VImageDimension>
static constexpr std::uintmax_t itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateBinomialCoefficient ( const std::uintmax_t  n,
const std::uintmax_t  k 
)
inlinestaticconstexprprivatenoexcept

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 210 of file itkConnectedImageNeighborhoodShape.h.

References ITK_X_ASSERT, and itk::Math::UnsignedProduct().

Referenced by itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateNumberOfHypercubesOnBoundaryOfCube().

◆ CalculateNumberOfConnectedNeighbors()

template<unsigned int VImageDimension>
static constexpr std::vcl_size_t itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateNumberOfConnectedNeighbors ( const std::vcl_size_t  maximumCityblockDistance)
inlinestaticconstexprprivatenoexcept

◆ CalculateNumberOfHypercubesOnBoundaryOfCube()

template<unsigned int VImageDimension>
static constexpr std::vcl_size_t itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateNumberOfHypercubesOnBoundaryOfCube ( const std::vcl_size_t  m,
const std::vcl_size_t  n 
)
inlinestaticconstexprprivatenoexcept

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 221 of file itkConnectedImageNeighborhoodShape.h.

References itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateBinomialCoefficient(), itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculatePowerOfTwo(), and itk::Math::UnsignedProduct().

Referenced by itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateSumOfNumberOfHypercubesOnBoundaryOfCube().

◆ CalculateNumberOfOffsets()

template<unsigned int VImageDimension>
static constexpr std::vcl_size_t itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateNumberOfOffsets ( const std::vcl_size_t  maximumCityblockDistance,
const bool  includeCenterPixel 
)
inlinestaticconstexprprivatenoexcept

Calculates the number of offsets needed for this shape.

Definition at line 259 of file itkConnectedImageNeighborhoodShape.h.

References itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateNumberOfConnectedNeighbors().

◆ CalculatePowerOfTwo()

template<unsigned int VImageDimension>
static constexpr std::uintmax_t itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculatePowerOfTwo ( const std::vcl_size_t  n)
inlinestaticconstexprprivatenoexcept

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 198 of file itkConnectedImageNeighborhoodShape.h.

References ITK_X_ASSERT.

Referenced by itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateNumberOfHypercubesOnBoundaryOfCube().

◆ CalculateSum()

template<unsigned int VImageDimension>
static constexpr std::uintmax_t itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateSum ( const std::uintmax_t  a,
const std::uintmax_t  b 
)
inlinestaticconstexprprivatenoexcept

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 189 of file itkConnectedImageNeighborhoodShape.h.

References ITK_X_ASSERT.

Referenced by itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateSumOfNumberOfHypercubesOnBoundaryOfCube().

◆ CalculateSumOfNumberOfHypercubesOnBoundaryOfCube()

template<unsigned int VImageDimension>
static constexpr std::vcl_size_t itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateSumOfNumberOfHypercubesOnBoundaryOfCube ( const std::vcl_size_t  i,
const std::vcl_size_t  m 
)
inlinestaticconstexprprivatenoexcept

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 236 of file itkConnectedImageNeighborhoodShape.h.

References itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateNumberOfHypercubesOnBoundaryOfCube(), itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateSum(), itk::ConnectedImageNeighborhoodShape< VImageDimension >::ImageDimension, and ITK_X_ASSERT.

Referenced by itk::ConnectedImageNeighborhoodShape< VImageDimension >::CalculateNumberOfConnectedNeighbors().

◆ FillOffsets()

template<unsigned int VImageDimension>
void itk::ConnectedImageNeighborhoodShape< VImageDimension >::FillOffsets ( Offset< ImageDimension > *const  offsets) const
inlinenoexcept

◆ GetNumberOfOffsets()

template<unsigned int VImageDimension>
constexpr std::vcl_size_t itk::ConnectedImageNeighborhoodShape< VImageDimension >::GetNumberOfOffsets ( ) const
inlineconstexprnoexcept

Returns the number of offsets needed for this shape.

Definition at line 125 of file itkConnectedImageNeighborhoodShape.h.

References itk::ConnectedImageNeighborhoodShape< VImageDimension >::m_NumberOfOffsets.

Referenced by itk::GenerateConnectedImageNeighborhoodShapeOffsets().

Friends And Related Function Documentation

◆ GenerateConnectedImageNeighborhoodShapeOffsets

template<unsigned int VImageDimension>
template<unsigned int VImageDimensionOfFriend, std::vcl_size_t VMaximumCityblockDistance, bool VIncludeCenterPixel>
std::array< Offset<VImageDimensionOfFriend>, ConnectedImageNeighborhoodShape<VImageDimensionOfFriend>::CalculateNumberOfOffsets(VMaximumCityblockDistance, VIncludeCenterPixel)> GenerateConnectedImageNeighborhoodShapeOffsets ( )
friend

Generates the offsets for a connected image neighborhood shape.

Definition at line 279 of file itkConnectedImageNeighborhoodShape.h.

Member Data Documentation

◆ ImageDimension

template<unsigned int VImageDimension>
constexpr unsigned int itk::ConnectedImageNeighborhoodShape< VImageDimension >::ImageDimension = VImageDimension
staticconstexpr

◆ m_IncludeCenterPixel

template<unsigned int VImageDimension>
bool itk::ConnectedImageNeighborhoodShape< VImageDimension >::m_IncludeCenterPixel
private

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 180 of file itkConnectedImageNeighborhoodShape.h.

Referenced by itk::ConnectedImageNeighborhoodShape< VImageDimension >::FillOffsets().

◆ m_MaximumCityblockDistance

template<unsigned int VImageDimension>
std::vcl_size_t itk::ConnectedImageNeighborhoodShape< VImageDimension >::m_MaximumCityblockDistance
private

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 176 of file itkConnectedImageNeighborhoodShape.h.

Referenced by itk::ConnectedImageNeighborhoodShape< VImageDimension >::FillOffsets().

◆ m_NumberOfOffsets

template<unsigned int VImageDimension>
std::vcl_size_t itk::ConnectedImageNeighborhoodShape< VImageDimension >::m_NumberOfOffsets
private

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 183 of file itkConnectedImageNeighborhoodShape.h.

Referenced by itk::ConnectedImageNeighborhoodShape< VImageDimension >::FillOffsets(), and itk::ConnectedImageNeighborhoodShape< VImageDimension >::GetNumberOfOffsets().


The documentation for this class was generated from the following file:
itk::GenerateImageNeighborhoodOffsets
std::vector< Offset< TImageNeighborhoodShape::ImageDimension > > GenerateImageNeighborhoodOffsets(const TImageNeighborhoodShape &shape)
Definition: itkImageNeighborhoodOffsets.h:31