18 #ifndef itkMeasurementVectorTraits_h
19 #define itkMeasurementVectorTraits_h
22 #include "vnl/vnl_vector_fixed.h"
61 template<
typename TVectorType >
75 template<
typename TValue1,
unsigned int VLength,
typename TValue2,
unsigned int VLength2 >
78 const char *errMsg =
"Length Mismatch")
80 if ( VLength != VLength2 )
82 itkGenericExceptionMacro(<< errMsg);
87 template<
typename TValue1,
unsigned int VLength,
typename TValue2,
unsigned int VLength2 >
90 const char *errMsg =
"Length Mismatch")
92 if ( VLength != VLength2 )
94 itkGenericExceptionMacro(<< errMsg);
99 template<
typename TValue1,
typename TValue2 >
105 itkGenericExceptionMacro(<< errMsg);
110 template<
typename TValue1,
typename TValue2 >
116 itkGenericExceptionMacro(<< errMsg);
121 template<
typename TValue1,
typename TValue2 >
124 const char *errMsg =
"Length Mismatch")
128 itkGenericExceptionMacro(<< errMsg);
133 template<
typename TValue1,
typename TValue2 >
136 const char *errMsg =
"Length Mismatch")
140 itkGenericExceptionMacro(<< errMsg);
145 template<
typename TValue1,
typename TValue2 >
147 const std::vector< TValue2 > & b,
const char *errMsg =
"Length Mismatch")
149 if ( b.size() != a.size() )
151 itkGenericExceptionMacro(<< errMsg);
156 template<
typename TValue1,
typename TValue2 >
158 const std::vector< TValue2 > *b,
const char *errMsg =
"Length Mismatch")
160 if ( b->size() != a->size() )
162 itkGenericExceptionMacro(<< errMsg);
167 template<
typename TValue1,
unsigned int VLength,
typename TValue2 >
177 if ( b.
Size() != VLength )
179 itkGenericExceptionMacro(<< errMsg);
185 template<
typename TValue1,
unsigned int VLength,
typename TValue2 >
189 if ( b->
Size() == 0 )
193 else if ( b->
Size() != VLength )
195 itkGenericExceptionMacro(<< errMsg);
200 template<
typename TValue1,
unsigned int VLength,
typename TValue2 >
203 const char *errMsg =
"Length Mismatch")
211 if ( b.
Size() != VLength )
213 itkGenericExceptionMacro(<< errMsg);
219 template<
typename TValue1,
unsigned int VLength,
typename TValue2 >
222 const char *errMsg =
"Length Mismatch")
224 if ( b->
Size() == 0 )
228 else if ( b->
Size() != VLength )
230 itkGenericExceptionMacro(<< errMsg);
235 template<
typename TValue1,
unsigned int VLength,
typename TValue2 >
237 const std::vector< TValue2 > & b,
const char *errMsg =
"Length Mismatch")
245 if ( b.size() != VLength )
247 itkGenericExceptionMacro(<< errMsg);
253 template<
typename TValue1,
unsigned int VLength,
typename TValue2 >
255 const std::vector< TValue2 > *b,
const char *errMsg =
"Length Mismatch")
257 if ( b->size() == 0 )
261 else if ( b->size() != VLength )
263 itkGenericExceptionMacro(<< errMsg);
268 template<
typename TValue1,
unsigned int VLength >
276 else if ( l != VLength )
278 itkGenericExceptionMacro(<< errMsg);
283 template<
typename TValue1,
unsigned int VLength >
291 else if ( l != VLength )
293 itkGenericExceptionMacro(<< errMsg);
298 template<
typename TValue >
302 if ( ( ( l != 0 ) && ( a.
Size() != l ) ) || ( a.
Size() == 0 ) )
304 itkGenericExceptionMacro(<< errMsg);
313 template<
typename TValue >
317 if ( ( ( l != 0 ) && ( a->
Size() != l ) ) || ( a->
Size() == 0 ) )
319 itkGenericExceptionMacro(<< errMsg);
328 template<
typename TValue >
332 if ( ( ( l != 0 ) && ( a.
Size() != l ) ) || ( a.
Size() == 0 ) )
334 itkGenericExceptionMacro(<< errMsg);
343 template<
typename TValue >
347 if ( ( ( l != 0 ) && ( a->
Size() != l ) ) || ( a->
Size() == 0 ) )
349 itkGenericExceptionMacro(<< errMsg);
358 template<
typename TValue >
362 if ( ( ( l != 0 ) && ( a.size() != l ) ) || ( a.empty() ) )
364 itkGenericExceptionMacro(<< errMsg);
373 template<
typename TValue >
377 if ( ( ( l != 0 ) && ( a->size() != l ) ) || ( a->size() == 0 ) )
379 itkGenericExceptionMacro(<< errMsg);
388 template<
typename TArrayType >
389 static void Assign(TArrayType & m,
const TArrayType & v)
394 template<
typename TValue,
unsigned int VLength >
407 template<
typename TMeasurementVector >
411 using ValueType =
typename TMeasurementVector::ValueType;
414 template<
typename T >
424 template<
typename TPixelType >
445 class MeasurementVectorPixelTraits< unsigned char >
452 class MeasurementVectorPixelTraits< signed char >
459 class MeasurementVectorPixelTraits< unsigned short >
466 class MeasurementVectorPixelTraits< signed short >
473 class MeasurementVectorPixelTraits< unsigned int >
480 class MeasurementVectorPixelTraits< signed int >
487 class MeasurementVectorPixelTraits< unsigned long >
494 class MeasurementVectorPixelTraits< signed long >
501 class MeasurementVectorPixelTraits< unsigned long long >
508 class MeasurementVectorPixelTraits< signed long long >
515 class MeasurementVectorPixelTraits< float >
522 class MeasurementVectorPixelTraits< double >
533 #endif // itkMeasurementVectorTraits_h
Array class with size defined at construction time.
typename TMeasurementVector::ValueType ValueType
static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > &, const Array< TValue2 > &b, const char *errMsg="Length Mismatch")
static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > &, const std::vector< TValue2 > &b, const char *errMsg="Length Mismatch")
static MeasurementVectorLength Assert(const VariableLengthVector< TValue1 > *a, const VariableLengthVector< TValue2 > *b, const char *errMsg="Length Mismatch")
Define numeric traits for std::vector.
static MeasurementVectorLength Assert(const std::vector< TValue > &a, const MeasurementVectorLength l, const char *errMsg="Length Mismatch")
static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > *, const MeasurementVectorLength l, const char *errMsg="Length Mismatch")
static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > &, const MeasurementVectorLength l, const char *errMsg="Length Mismatch")
static void Assign(TArrayType &m, const TArrayType &v)
static void Assign(FixedArray< TValue, VLength > &m, const TValue &v)
static MeasurementVectorLength Assert(const std::vector< TValue > *a, const MeasurementVectorLength l, const char *errMsg="Length Mismatch")
static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > *, const Array< TValue2 > *b, const char *errMsg="Length Mismatch")
Simulate a standard C array with copy semnatics.
static MeasurementVectorLength Assert(const VariableLengthVector< TValue1 > &a, const VariableLengthVector< TValue2 > &b, const char *errMsg="Length Mismatch")
static bool IsResizable(const TVectorType &)
NumericTraits< AbsoluteFrequencyType >::AccumulateType TotalAbsoluteFrequencyType
TPixelType MeasurementVectorType
Represents an array whose length can be defined at run-time.
NumericTraits< AbsoluteFrequencyType >::RealType RelativeFrequencyType
SizeValueType IdentifierType
static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > *, const VariableLengthVector< TValue2 > *b, const char *errMsg="Length Mismatch")
static MeasurementVectorLength Assert(const Array< TValue > *a, const MeasurementVectorLength l, const char *errMsg="Length Mismatch")
SizeValueType Size() const
static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > &, const VariableLengthVector< TValue2 > &b, const char *errMsg="Length Mismatch")
static MeasurementVectorLength Assert(const Array< TValue > &a, const MeasurementVectorLength l, const char *errMsg="Length Mismatch")
unsigned int Size() const
static MeasurementVectorLength Assert(const VariableLengthVector< TValue > &a, const MeasurementVectorLength l, const char *errMsg="Length Mismatch")
InstanceIdentifier AbsoluteFrequencyType
static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > *, const std::vector< TValue2 > *b, const char *errMsg="Length Mismatch")
static MeasurementVectorLength Assert(const Array< TValue1 > &a, const Array< TValue2 > &b, const char *errMsg="Length Mismatch")
static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > &, const FixedArray< TValue2, VLength2 > &, const char *errMsg="Length Mismatch")
IdentifierType InstanceIdentifier
static MeasurementVectorLength Assert(const FixedArray< TValue1, VLength > *, const FixedArray< TValue2, VLength2 > *, const char *errMsg="Length Mismatch")
static MeasurementVectorLength Assert(const std::vector< TValue1 > *a, const std::vector< TValue2 > *b, const char *errMsg="Length Mismatch")
unsigned int MeasurementVectorLength
static MeasurementVectorLength Assert(const std::vector< TValue1 > &a, const std::vector< TValue2 > &b, const char *errMsg="Length Mismatch")
NumericTraits< RelativeFrequencyType >::AccumulateType TotalRelativeFrequencyType
static MeasurementVectorLength Assert(const Array< TValue1 > *a, const Array< TValue2 > *b, const char *errMsg="Length Mismatch")
static MeasurementVectorLength Assert(const VariableLengthVector< TValue > *a, const MeasurementVectorLength l, const char *errMsg="Length Mismatch")