ITK
6.0.0
Insight Toolkit
SphinxExamples/src/Developer/ConceptChecking.cxx
#include <
itkConceptChecking.h
>
#include <
itkImage.h
>
template
<
typename
TImage>
void
MyFunction(
const
TImage *
const
image)
{
itkConceptMacro
(nameOfCheck, (
itk::Concept::IsFloatingPoint<typename TImage::ValueType>
));
}
int
main()
{
using
FloatImageType =
itk::Image<float, 2>
;
auto
floatImage =
FloatImageType::New
();
MyFunction(floatImage.GetPointer());
using
DoubleImageType =
itk::Image<double, 2>
;
auto
doubleImage =
DoubleImageType::New
();
MyFunction(doubleImage.GetPointer());
// Fails the concept check
// using IntImageType = itk::Image<int, 2>;
// auto intImage = IntImageType::New();
// MyFunction(intImage.GetPointer());
// Fails the concept check
// using UCharImageType = itk::Image<unsigned char, 2>;
// auto ucharImage = UCharImageType::New();
// MyFunction(ucharImage.GetPointer());
return
EXIT_SUCCESS;
}
itkConceptChecking.h
itkImage.h
itk::Concept::IsFloatingPoint
Definition:
itkConceptChecking.h:953
itkConceptMacro
#define itkConceptMacro(name, concept)
Definition:
itkConceptChecking.h:65
itk::Image
Templated n-dimensional image class.
Definition:
itkImage.h:88
New
static Pointer New()
Generated on
unknown
for ITK by
1.8.16