/usr/include/InsightToolkit/Common/itkNumericTraitsVariableLengthVectorPixel.h is in libinsighttoolkit3-dev 3.20.1-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | /*=========================================================================
Program: Insight Segmentation & Registration Toolkit
Module: itkNumericTraitsVariableLengthVectorPixel.h
Language: C++
Date: $Date$
Version: $Revision$
Copyright (c) Insight Software Consortium. All rights reserved.
See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
This software is distributed WITHOUT ANY WARRANTY; without even
the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
PURPOSE. See the above copyright notices for more information.
=========================================================================*/
#ifndef __itkNumericTraitsVariableLengthVectorPixel_h
#define __itkNumericTraitsVariableLengthVectorPixel_h
#include "itkNumericTraits.h"
#include "itkVariableLengthVector.h"
// This file defines numeric traits for VariableLengthVector< T > as pixel type
// Note that the Zero(), One(), min() and max() methods here take references to
// a pixel as input. This is due to the fact that the length of the
// VariableLengthVector is not known until run-time. Since the most common use
// of Zero and One is for comparison purposes or initialization of sums etc,
// this might just as easily be re-written with a pixel passed in as a
// reference and the length is inferred from this pixel.
//
// This work is part of the National Alliance for Medical Image Computing
// (NAMIC), funded by the National Institutes of Health through the NIH Roadmap
// for Medical Research, Grant U54 EB005149.
namespace itk
{
//
// First we define a macro that can be customized to be used for a sequence of
// specializations or for a generic template instantiation. This Macro covers
// the implementation for good compilers and for Visual Studio 6.0.
//
#define itkNumericTraitsVariableLengthVectorPixelMacro(T) \
template < _TEMPLATE_ARGUMENT_ > \
class NumericTraits<VariableLengthVector< T > > \
{ \
public: \
typedef T ValueType; \
\
typedef _TYPENAME_ NumericTraits<T>::AbsType ElementAbsType; \
typedef _TYPENAME_ NumericTraits<T>::AccumulateType ElementAccumulateType; \
typedef _TYPENAME_ NumericTraits<T>::FloatType ElementFloatType; \
typedef _TYPENAME_ NumericTraits<T>::PrintType ElementPrintType; \
typedef _TYPENAME_ NumericTraits<T>::RealType ElementRealType; \
\
typedef VariableLengthVector<T> Self; \
\
typedef VariableLengthVector<ElementAbsType> AbsType; \
typedef VariableLengthVector<ElementAccumulateType> AccumulateType; \
typedef VariableLengthVector<ElementFloatType> FloatType; \
typedef VariableLengthVector<ElementPrintType> PrintType; \
typedef VariableLengthVector<ElementRealType> RealType; \
\
typedef ElementRealType ScalarRealType; \
\
static const Self max( const Self & a ) \
{ \
Self b(a.Size()); \
b.Fill( NumericTraits< T >::max() ); \
return b; \
} \
static const Self min( const Self & a ) \
{ \
Self b(a.Size()); \
b.Fill( NumericTraits< T >::min() ); \
return b; \
} \
static const Self Zero( const Self & a ) \
{ \
Self b(a.Size()); \
b.Fill( NumericTraits< T >::Zero ); \
return b; \
} \
static const Self One( const Self & a ) \
{ \
Self b(a.Size()); \
b.Fill( NumericTraits< T >::One ); \
return b; \
} \
};
#ifndef ITK_USE_NUMERIC_TRAITS_PARTIAL_SPECIALIZATION
// These two symbols below are defined empty on purpose
#define _TYPENAME_
#define _TEMPLATE_ARGUMENT_
//
// List here the specializations of the Traits:
//
itkNumericTraitsVariableLengthVectorPixelMacro( char );
itkNumericTraitsVariableLengthVectorPixelMacro( unsigned char );
itkNumericTraitsVariableLengthVectorPixelMacro( short );
itkNumericTraitsVariableLengthVectorPixelMacro( unsigned short );
itkNumericTraitsVariableLengthVectorPixelMacro( int );
itkNumericTraitsVariableLengthVectorPixelMacro( unsigned int );
itkNumericTraitsVariableLengthVectorPixelMacro( long );
itkNumericTraitsVariableLengthVectorPixelMacro( unsigned long );
itkNumericTraitsVariableLengthVectorPixelMacro( float );
itkNumericTraitsVariableLengthVectorPixelMacro( double );
#else
// For all the other good compilers, we provide here a generic implementation
// based on creating types of VariableLengthVectors whose components are the
// types of the NumericTraits from the original VariableLengthVectors
// components. This implementation doesn't require specializations, since it
// is based on the concept that
//
// NumericTraits< VariableLengthVector< T > > is defined piecewise by
// VariableLengthVector< NumericTraits< T > >
//
//
// By defining the following symbols, the Macro above gets customized to become
// a generic template implementation of the traits
//
#define _TYPENAME_ typename
#define _TEMPLATE_ARGUMENT_ class T
//
// Then we simply call the macro once with the generic template argument T.
//
itkNumericTraitsVariableLengthVectorPixelMacro( T );
#endif // ITK_USE_NUMERIC_TRAITS_PARTIAL_SPECIALIZATION
//
// Finally, to avoid contamination of other files with the symbols defined
// here, we undefine the helper macros
//
#undef _TYPENAME_
#undef _TEMPLATE_ARGUMENT_
} // end namespace itk
#endif // __itkNumericTraitsVariableLengthVector_h
|