Create a Binary Ball Structuring Element#

Synopsis#

Create an elliptical structuring element

Results#

Code#

C++#

#include "itkBinaryBallStructuringElement.h"

int
main()
{
  constexpr unsigned int Dimension = 3;
  using PixelType = float;

  using StructuringElementType = itk::BinaryBallStructuringElement<PixelType, Dimension>;
  StructuringElementType structuringElement;
  structuringElement.SetRadius(5);
  structuringElement.CreateStructuringElement();

  return EXIT_SUCCESS;
}

Classes demonstrated#

template<typename TPixel, unsigned int VDimension = 2, typename TAllocator = NeighborhoodAllocator<TPixel>>
class BinaryBallStructuringElement : public itk::Neighborhood<TPixel, VDimension, TAllocator>

A Neighborhood that represents a ball structuring element (ellipsoid) with binary elements.

This class defines a Neighborhood whose elements are either off or on depending on whether they are outside or inside an ellipsoid whose radii match the radii of the Neighborhood. This class can be used as a structuring element for the Morphology image filters.

A BinaryBallStructuringElement has an N-dimensional radius. The radius is defined separately for each dimension as the number of pixels that the neighborhood extends outward from the center pixel. For example, a 2D BinaryBallStructuringElement object with a radius of 2x3 has sides of length 5x7.

BinaryBallStructuringElement objects always have an unambiguous center because their side lengths are always odd.

Internally, this class carries out all of its computations using the FlatStructuringElement. It is preferable to use that class instead of this one because FlatStructuringElement is more flexible.

See

Neighborhood

See

MorphologyImageFilter

See

BinaryDilateImageFilter

See

BinaryErodeImageFilter

ITK Sphinx Examples:

See itk::BinaryBallStructuringElement for additional documentation.