Concept Checking Is Same Dimension#

Synopsis#

Check at compilation time that 2 dimensions are the same.

Results#

Code#

C++#

#include "itkImage.h"
#include "itkConceptChecking.h"

template <typename TImage, unsigned int VDimension>
void
CheckIfDimensionIsTheSame(const TImage * const)
{
  itkConceptMacro(nameOfCheck, (itk::Concept::SameDimension<TImage::ImageDimension, VDimension>));
}
int
main()
{
  constexpr unsigned int Dimension = 2;
  using PixelType = unsigned char;
  using ImageType = itk::Image<PixelType, Dimension>;
  auto image = ImageType::New();

  CheckIfDimensionIsTheSame<ImageType, 2>(image.GetPointer());

  using ImageType2 = itk::Image<PixelType, Dimension>;

  CheckIfDimensionIsTheSame<ImageType, ImageType2::ImageDimension>(image.GetPointer());

  return EXIT_SUCCESS;
}