18 #ifndef itkDefaultConvertPixelTraits_h 19 #define itkDefaultConvertPixelTraits_h 40 template<
typename PixelType >
49 {
return PixelType::GetNumberOfComponents(); }
52 {
return PixelType::GetNumberOfComponents( ); }
56 {
return pixel.GetNthComponent(c); }
60 { pixel.SetNthComponent(c, v); }
64 {
return pixel.GetScalarValue(); }
68 #define ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(type) \ 70 class DefaultConvertPixelTraits< type > \ 73 typedef type ComponentType; \ 74 static unsigned int GetNumberOfComponents() \ 78 static unsigned int GetNumberOfComponents(const type) \ 82 static void SetNthComponent(int, type & pixel, const ComponentType &v) \ 86 static type GetNthComponent(int, const type pixel) \ 90 static type GetScalarValue(const type &pixel) \ 111 #undef ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL 117 template<
unsigned int VDimension>
127 static void SetNthComponent(
int i, TargetType & pixel,
const ComponentType &v)
141 #define ITK_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(type) \ 142 template<typename TComponentType, unsigned VDimension > \ 143 class DefaultConvertPixelTraits< type< TComponentType, VDimension > > \ 146 typedef type< TComponentType, VDimension > TargetType; \ 147 typedef TComponentType ComponentType; \ 148 static unsigned int GetNumberOfComponents() \ 152 static unsigned int GetNumberOfComponents( const TargetType ) \ 156 static void SetNthComponent(int i, TargetType & pixel, \ 157 const ComponentType &v) \ 161 static ComponentType GetNthComponent(int i, const TargetType pixel) \ 165 static ComponentType GetScalarValue(const TargetType &pixel) \ 184 template<
typename VComponent>
199 const ComponentType &v)
217 template<
typename VComponent>
232 const ComponentType &v)
234 const unsigned int row = i / pixel.
Cols();
235 const unsigned int col = i % pixel.
Cols();
240 const unsigned int row = i / pixel.
Cols();
241 const unsigned int col = i % pixel.
Cols();
242 return pixel(row,col);
260 template<
typename VComponent,
unsigned VRows,
unsigned VCols >
268 return VRows * VCols;
271 const ComponentType &v)
273 const unsigned int row = i / VCols;
274 const unsigned int col = i % VCols;
279 const unsigned int row = i / VCols;
280 const unsigned int col = i % VCols;
281 return pixel[row][col];
293 template<
typename TComponent >
307 pixel = TargetType( v, pixel.imag() );
311 pixel = TargetType(pixel.real(), v);
316 return std::norm(pixel);
VariableSizeMatrix< VComponent > TargetType
A templated class holding a M x N size Matrix.
unsigned int Rows() const
Represent the offset between two n-dimensional indexes in a n-dimensional image.
static ComponentType GetScalarValue(const PixelType &pixel)
static unsigned int GetNumberOfComponents(const TargetType pixel)
static void SetNthComponent(int c, PixelType &pixel, const ComponentType &v)
signed long OffsetValueType
static void SetNthComponent(int i, TargetType &pixel, const ComponentType &v)
static ComponentType GetScalarValue(const TargetType &pixel)
A templated class holding a M x N size Matrix.
Traits class used to by ConvertPixels to convert blocks of pixels.
VariableLengthVector< VComponent > TargetType
PixelType::ComponentType ComponentType
static ComponentType GetNthComponent(int i, const TargetType &pixel)
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes...
unsigned int Cols() const
Simulate a standard C array with copy semnatics.
unsigned int Size(void) const noexcept
static ComponentType GetNthComponent(int c, const PixelType &pixel)
static unsigned int GetNumberOfComponents()
Represents an array whose length can be defined at run-time.
static void SetNthComponent(int i, TargetType &pixel, const ComponentType &v)
A templated class holding a n-Dimensional vector.
ITK_DEFAULTCONVERTTRAITS_FIXEDARRAY_TYPE(Vector)
ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(float) ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(double) ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(int) ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(char) ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(short) ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned int) ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(signed char) ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned char) ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned short) ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(long) ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned long) ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(long long) ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(unsigned long long) ITK_DEFAULTCONVERTTRAITS_NATIVE_SPECIAL(bool) template< unsigned int VDimension > class DefaultConvertPixelTraits< Offset< VDimension > >
Matrix< VComponent, VRows, VCols > TargetType
static void SetNthComponent(int i, TargetType &pixel, const ComponentType &v)
static unsigned int GetNumberOfComponents()
static ComponentType GetScalarValue(const TargetType &)
static ComponentType GetNthComponent(int i, const TargetType &pixel)
static unsigned int GetNumberOfComponents(const TargetType pixel)
RealValueType GetNorm() const noexcept
static ComponentType GetScalarValue(const TargetType &pixel)
static unsigned int GetNumberOfComponents()
static ComponentType GetNthComponent(int i, const TargetType &pixel)
static ComponentType GetScalarValue(const TargetType &pixel)
A templated class holding a geometric point in n-Dimensional space.
A templated class holding a n-Dimensional covariant vector.
static unsigned int GetNumberOfComponents(const PixelType itkNotUsed(pixel))
static void SetNthComponent(int i, TargetType &pixel, const ComponentType &v)
typedef::std::complex< TComponent > TargetType
static unsigned int GetNumberOfComponents()
static unsigned int GetNumberOfComponents()