00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkNumericTraitsFixedArrayPixel_h
00018 #define __itkNumericTraitsFixedArrayPixel_h
00019
00020 #include "itkNumericTraits.h"
00021 #include "itkFixedArray.h"
00022
00023
00024 namespace itk
00025 {
00026
00027
00028
00029
00030
00031
00032
00033
00034 #define itkNumericTraitsGenericArrayMacro(GENERIC_ARRAY, T, D) \
00035 template < ITK_NUMERIC_TRAITS_TEMPLATE_ARGUMENTS > \
00036 class NumericTraits<GENERIC_ARRAY< T, D > > \
00037 { \
00038 private: \
00039 \
00040 typedef ITK_NUMERIC_TRAITS_TYPENAME NumericTraits<T>::AbsType ElementAbsType; \
00041 typedef ITK_NUMERIC_TRAITS_TYPENAME NumericTraits<T>::AccumulateType ElementAccumulateType; \
00042 typedef ITK_NUMERIC_TRAITS_TYPENAME NumericTraits<T>::FloatType ElementFloatType; \
00043 typedef ITK_NUMERIC_TRAITS_TYPENAME NumericTraits<T>::PrintType ElementPrintType; \
00044 typedef ITK_NUMERIC_TRAITS_TYPENAME NumericTraits<T>::RealType ElementRealType; \
00045 \
00046 public: \
00047 \
00048 typedef T ValueType; \
00049 typedef GENERIC_ARRAY<T, D> Self; \
00050 \
00051 typedef GENERIC_ARRAY<ElementAbsType, D> AbsType; \
00052 typedef GENERIC_ARRAY<ElementAccumulateType, D> AccumulateType; \
00053 typedef GENERIC_ARRAY<ElementFloatType, D> FloatType; \
00054 typedef GENERIC_ARRAY<ElementPrintType, D> PrintType; \
00055 typedef GENERIC_ARRAY<ElementRealType, D> RealType; \
00056 \
00057 typedef ElementRealType ScalarRealType; \
00058 \
00059 static const Self max() \
00060 { \
00061 return Self( NumericTraits< T >::max() ); \
00062 } \
00063 static const Self min() \
00064 { \
00065 return Self( NumericTraits< T >::min() ); \
00066 } \
00067 static const Self NonpositiveMin() \
00068 { \
00069 return Self( NumericTraits< T >::NonpositiveMin() ); \
00070 } \
00071 static const Self ZeroValue() \
00072 { \
00073 return Self( NumericTraits<T>::ZeroValue() ); \
00074 } \
00075 static const Self OneValue() \
00076 { \
00077 return Self( NumericTraits<T>::OneValue() ); \
00078 } \
00079 static const Self ITKCommon_EXPORT Zero; \
00080 static const Self ITKCommon_EXPORT One; \
00081 };
00082
00083
00084 #ifdef ITK_USE_NUMERIC_TRAITS_PARTIAL_SPECIALIZATION
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096 #define ITK_NUMERIC_TRAITS_TYPENAME typename
00097 #define ITK_NUMERIC_TRAITS_TEMPLATE_ARGUMENTS typename T, unsigned int D
00098
00099
00100 #define itkNumericTraitsGenericArrayScalarsDimensionsMacro( GENERIC_ARRAY ) \
00101 itkNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, D );
00102
00103
00104 #define itkStaticNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, D ) \
00105 template< > const GENERIC_ARRAY<T,D> NumericTraits< GENERIC_ARRAY<T,D> >::Zero = GENERIC_ARRAY<T,D>( NumericTraits<T>::Zero ); \
00106 template< > const GENERIC_ARRAY<T,D> NumericTraits< GENERIC_ARRAY<T,D> >::One = GENERIC_ARRAY<T,D>( NumericTraits<T>::One );
00107
00108
00109 #else // ITK_USE_NUMERICTRAITS_PARTIAL_SPECIALIZATION
00110
00111
00112
00113
00114
00115
00116
00117
00118
00119 #define ITK_NUMERIC_TRAITS_TYPENAME
00120 #define ITK_NUMERIC_TRAITS_TEMPLATE_ARGUMENTS
00121
00122
00123
00124
00125 #define itkNumericTraitsGenericArrayDimensionsMacro( GENERIC_ARRAY, T ) \
00126 itkNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 1 ); \
00127 itkNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 2 ); \
00128 itkNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 3 ); \
00129 itkNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 4 ); \
00130 itkNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 5 ); \
00131 itkNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 6 ); \
00132 itkNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 7 ); \
00133 itkNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 8 ); \
00134 itkNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 9 ); \
00135 itkNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 10 );
00136
00137
00138 #define itkStaticNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, D ) \
00139 const GENERIC_ARRAY<T,D> NumericTraits< GENERIC_ARRAY<T,D> >::Zero = GENERIC_ARRAY<T,D>( NumericTraits<T>::Zero ); \
00140 const GENERIC_ARRAY<T,D> NumericTraits< GENERIC_ARRAY<T,D> >::One = GENERIC_ARRAY<T,D>( NumericTraits<T>::One );
00141
00142 #endif // ITK_USE_NUMERICTRAITS_PARTIAL_SPECIALIZATION
00143
00144
00145
00146
00147
00148
00149 #define itkStaticNumericTraitsGenericArrayDimensionsMacro( GENERIC_ARRAY, T ) \
00150 itkStaticNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 1 ); \
00151 itkStaticNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 2 ); \
00152 itkStaticNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 3 ); \
00153 itkStaticNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 4 ); \
00154 itkStaticNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 5 ); \
00155 itkStaticNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 6 ); \
00156 itkStaticNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 7 ); \
00157 itkStaticNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 8 ); \
00158 itkStaticNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 9 ); \
00159 itkStaticNumericTraitsGenericArrayMacro( GENERIC_ARRAY, T, 10 );
00160
00161
00162
00163
00164
00165
00166 #ifdef ITK_USE_NUMERIC_TRAITS_PARTIAL_SPECIALIZATION
00167
00168 itkNumericTraitsGenericArrayScalarsDimensionsMacro( FixedArray );
00169
00170 #else // ITK_USE_NUMERIC_TRAITS_PARTIAL_SPECIALIZATION
00171
00172 itkNumericTraitsGenericArrayDimensionsMacro( FixedArray, char );
00173 itkNumericTraitsGenericArrayDimensionsMacro( FixedArray, unsigned char );
00174 itkNumericTraitsGenericArrayDimensionsMacro( FixedArray, signed char );
00175 itkNumericTraitsGenericArrayDimensionsMacro( FixedArray, short );
00176 itkNumericTraitsGenericArrayDimensionsMacro( FixedArray, unsigned short );
00177 itkNumericTraitsGenericArrayDimensionsMacro( FixedArray, int );
00178 itkNumericTraitsGenericArrayDimensionsMacro( FixedArray, unsigned int );
00179 itkNumericTraitsGenericArrayDimensionsMacro( FixedArray, long );
00180 itkNumericTraitsGenericArrayDimensionsMacro( FixedArray, unsigned long );
00181 itkNumericTraitsGenericArrayDimensionsMacro( FixedArray, float );
00182 itkNumericTraitsGenericArrayDimensionsMacro( FixedArray, double );
00183 itkNumericTraitsGenericArrayDimensionsMacro( FixedArray, long double );
00184 #ifdef ITK_TYPE_USE_LONG_LONG
00185 itkNumericTraitsGenericArrayDimensionsMacro( FixedArray, long long );
00186 itkNumericTraitsGenericArrayDimensionsMacro( FixedArray, unsigned long long );
00187 #endif // ITK_TYPE_USE_LONG_LONG
00188
00189 #endif // ITK_USE_NUMERIC_TRAITS_PARTIAL_SPECIALIZATION
00190
00191 }
00192
00193 #endif // __itkNumericTraitsFixedArrayPixel_h
00194