ITK
4.12.0
Insight Segmentation and Registration Toolkit
Main Page
Related Pages
Modules
Namespaces
Classes
Files
Examples
WikiExamples/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(
int
,
char
*[])
{
typedef
itk::Image<float, 2>
FloatImageType;
FloatImageType::Pointer
floatImage =
FloatImageType::New
();
MyFunction(floatImage.GetPointer());
typedef
itk::Image<double, 2>
DoubleImageType;
DoubleImageType::Pointer
doubleImage =
DoubleImageType::New
();
MyFunction(doubleImage.GetPointer());
// Fails the concept check
// typedef itk::Image<int, 2> IntImageType;
// IntImageType::Pointer intImage = IntImageType::New();
// MyFunction(intImage.GetPointer());
// Fails the concept check
// typedef itk::Image<unsigned char, 2> UCharImageType;
// UCharImageType::Pointer ucharImage = UCharImageType::New();
// MyFunction(ucharImage.GetPointer());
return
EXIT_SUCCESS;
}
Generated on Tue May 30 2017 03:00:39 for ITK by
1.8.5