]> Creatis software - clitk.git/blobdiff - tools/clitkImageConvertGenericFilter.h
support for multiple vector image conversions
[clitk.git] / tools / clitkImageConvertGenericFilter.h
index 6064b1821dbd0a6593c063fa452b8c05021bdeda..71ef2c93360e398606f23027b1b650429e0916e3 100644 (file)
@@ -30,8 +30,6 @@
 // clitk include
 #include "clitkImageToImageGenericFilter.h"
 
-// itk include
-#include "itkCastImageFilter.h"
 
 namespace clitk {
   
@@ -69,10 +67,322 @@ namespace clitk {
     bool mDisplayWarning;
 
     template<class InputImageType, class OutputPixelType> void UpdateWithOutputType();
+    template<class InputImageType, class OutputPixelType> void UpdateWithOutputVectorType();
 
   }; // end class ImageConvertGenericFilter
 
-  //#include "clitkImageConvertGenericFilter.txx"
+#define VEC_UPDATE_DECL(TYPE_IN, COMP, DIM, TYPE_OUT) \
+  template<> void ImageConvertGenericFilter::UpdateWithOutputType<itk::Image<itk::Vector<TYPE_IN, COMP>, DIM>, TYPE_OUT>()
+  
+VEC_UPDATE_DECL(char, 2, 2, unsigned char);
+VEC_UPDATE_DECL(char, 2, 3, unsigned char);
+VEC_UPDATE_DECL(char, 2, 4, unsigned char);
+VEC_UPDATE_DECL(char, 2, 2, char);
+VEC_UPDATE_DECL(char, 2, 3, char);
+VEC_UPDATE_DECL(char, 2, 4, char);
+VEC_UPDATE_DECL(char, 2, 2, unsigned short);
+VEC_UPDATE_DECL(char, 2, 3, unsigned short);
+VEC_UPDATE_DECL(char, 2, 4, unsigned short);
+VEC_UPDATE_DECL(char, 2, 2, short);
+VEC_UPDATE_DECL(char, 2, 3, short);
+VEC_UPDATE_DECL(char, 2, 4, short);
+VEC_UPDATE_DECL(char, 2, 2, int);
+VEC_UPDATE_DECL(char, 2, 3, int);
+VEC_UPDATE_DECL(char, 2, 4, int);
+VEC_UPDATE_DECL(char, 2, 2, float);
+VEC_UPDATE_DECL(char, 2, 3, float);
+VEC_UPDATE_DECL(char, 2, 4, float);
+VEC_UPDATE_DECL(char, 2, 2, double);
+VEC_UPDATE_DECL(char, 2, 3, double);
+VEC_UPDATE_DECL(char, 2, 4, double);
+
+VEC_UPDATE_DECL(char, 3, 2, unsigned char);
+VEC_UPDATE_DECL(char, 3, 3, unsigned char);
+VEC_UPDATE_DECL(char, 3, 4, unsigned char);
+VEC_UPDATE_DECL(char, 3, 2, char);
+VEC_UPDATE_DECL(char, 3, 3, char);
+VEC_UPDATE_DECL(char, 3, 4, char);
+VEC_UPDATE_DECL(char, 3, 2, unsigned short);
+VEC_UPDATE_DECL(char, 3, 3, unsigned short);
+VEC_UPDATE_DECL(char, 3, 4, unsigned short);
+VEC_UPDATE_DECL(char, 3, 2, short);
+VEC_UPDATE_DECL(char, 3, 3, short);
+VEC_UPDATE_DECL(char, 3, 4, short);
+VEC_UPDATE_DECL(char, 3, 2, int);
+VEC_UPDATE_DECL(char, 3, 3, int);
+VEC_UPDATE_DECL(char, 3, 4, int);
+VEC_UPDATE_DECL(char, 3, 2, float);
+VEC_UPDATE_DECL(char, 3, 3, float);
+VEC_UPDATE_DECL(char, 3, 4, float);
+VEC_UPDATE_DECL(char, 3, 2, double);
+VEC_UPDATE_DECL(char, 3, 3, double);
+VEC_UPDATE_DECL(char, 3, 4, double);
+
+VEC_UPDATE_DECL(unsigned char, 2, 2, unsigned char);
+VEC_UPDATE_DECL(unsigned char, 2, 3, unsigned char);
+VEC_UPDATE_DECL(unsigned char, 2, 4, unsigned char);
+VEC_UPDATE_DECL(unsigned char, 2, 2, char);
+VEC_UPDATE_DECL(unsigned char, 2, 3, char);
+VEC_UPDATE_DECL(unsigned char, 2, 4, char);
+VEC_UPDATE_DECL(unsigned char, 2, 2, unsigned short);
+VEC_UPDATE_DECL(unsigned char, 2, 3, unsigned short);
+VEC_UPDATE_DECL(unsigned char, 2, 4, unsigned short);
+VEC_UPDATE_DECL(unsigned char, 2, 2, short);
+VEC_UPDATE_DECL(unsigned char, 2, 3, short);
+VEC_UPDATE_DECL(unsigned char, 2, 4, short);
+VEC_UPDATE_DECL(unsigned char, 2, 2, int);
+VEC_UPDATE_DECL(unsigned char, 2, 3, int);
+VEC_UPDATE_DECL(unsigned char, 2, 4, int);
+VEC_UPDATE_DECL(unsigned char, 2, 2, float);
+VEC_UPDATE_DECL(unsigned char, 2, 3, float);
+VEC_UPDATE_DECL(unsigned char, 2, 4, float);
+VEC_UPDATE_DECL(unsigned char, 2, 2, double);
+VEC_UPDATE_DECL(unsigned char, 2, 3, double);
+VEC_UPDATE_DECL(unsigned char, 2, 4, double);
+
+VEC_UPDATE_DECL(unsigned char, 3, 2, unsigned char);
+VEC_UPDATE_DECL(unsigned char, 3, 3, unsigned char);
+VEC_UPDATE_DECL(unsigned char, 3, 4, unsigned char);
+VEC_UPDATE_DECL(unsigned char, 3, 2, char);
+VEC_UPDATE_DECL(unsigned char, 3, 3, char);
+VEC_UPDATE_DECL(unsigned char, 3, 4, char);
+VEC_UPDATE_DECL(unsigned char, 3, 2, unsigned short);
+VEC_UPDATE_DECL(unsigned char, 3, 3, unsigned short);
+VEC_UPDATE_DECL(unsigned char, 3, 4, unsigned short);
+VEC_UPDATE_DECL(unsigned char, 3, 2, short);
+VEC_UPDATE_DECL(unsigned char, 3, 3, short);
+VEC_UPDATE_DECL(unsigned char, 3, 4, short);
+VEC_UPDATE_DECL(unsigned char, 3, 2, int);
+VEC_UPDATE_DECL(unsigned char, 3, 3, int);
+VEC_UPDATE_DECL(unsigned char, 3, 4, int);
+VEC_UPDATE_DECL(unsigned char, 3, 2, float);
+VEC_UPDATE_DECL(unsigned char, 3, 3, float);
+VEC_UPDATE_DECL(unsigned char, 3, 4, float);
+VEC_UPDATE_DECL(unsigned char, 3, 2, double);
+VEC_UPDATE_DECL(unsigned char, 3, 3, double);
+VEC_UPDATE_DECL(unsigned char, 3, 4, double);
+
+VEC_UPDATE_DECL(short, 2, 2, unsigned char);
+VEC_UPDATE_DECL(short, 2, 3, unsigned char);
+VEC_UPDATE_DECL(short, 2, 4, unsigned char);
+VEC_UPDATE_DECL(short, 2, 2, char);
+VEC_UPDATE_DECL(short, 2, 3, char);
+VEC_UPDATE_DECL(short, 2, 4, char);
+VEC_UPDATE_DECL(short, 2, 2, unsigned short);
+VEC_UPDATE_DECL(short, 2, 3, unsigned short);
+VEC_UPDATE_DECL(short, 2, 4, unsigned short);
+VEC_UPDATE_DECL(short, 2, 2, short);
+VEC_UPDATE_DECL(short, 2, 3, short);
+VEC_UPDATE_DECL(short, 2, 4, short);
+VEC_UPDATE_DECL(short, 2, 2, int);
+VEC_UPDATE_DECL(short, 2, 3, int);
+VEC_UPDATE_DECL(short, 2, 4, int);
+VEC_UPDATE_DECL(short, 2, 2, float);
+VEC_UPDATE_DECL(short, 2, 3, float);
+VEC_UPDATE_DECL(short, 2, 4, float);
+VEC_UPDATE_DECL(short, 2, 2, double);
+VEC_UPDATE_DECL(short, 2, 3, double);
+VEC_UPDATE_DECL(short, 2, 4, double);
+
+VEC_UPDATE_DECL(short, 3, 2, unsigned char);
+VEC_UPDATE_DECL(short, 3, 3, unsigned char);
+VEC_UPDATE_DECL(short, 3, 4, unsigned char);
+VEC_UPDATE_DECL(short, 3, 2, char);
+VEC_UPDATE_DECL(short, 3, 3, char);
+VEC_UPDATE_DECL(short, 3, 4, char);
+VEC_UPDATE_DECL(short, 3, 2, unsigned short);
+VEC_UPDATE_DECL(short, 3, 3, unsigned short);
+VEC_UPDATE_DECL(short, 3, 4, unsigned short);
+VEC_UPDATE_DECL(short, 3, 2, short);
+VEC_UPDATE_DECL(short, 3, 3, short);
+VEC_UPDATE_DECL(short, 3, 4, short);
+VEC_UPDATE_DECL(short, 3, 2, int);
+VEC_UPDATE_DECL(short, 3, 3, int);
+VEC_UPDATE_DECL(short, 3, 4, int);
+VEC_UPDATE_DECL(short, 3, 2, float);
+VEC_UPDATE_DECL(short, 3, 3, float);
+VEC_UPDATE_DECL(short, 3, 4, float);
+VEC_UPDATE_DECL(short, 3, 2, double);
+VEC_UPDATE_DECL(short, 3, 3, double);
+VEC_UPDATE_DECL(short, 3, 4, double);
+
+VEC_UPDATE_DECL(unsigned short, 2, 2, unsigned char);
+VEC_UPDATE_DECL(unsigned short, 2, 3, unsigned char);
+VEC_UPDATE_DECL(unsigned short, 2, 4, unsigned char);
+VEC_UPDATE_DECL(unsigned short, 2, 2, char);
+VEC_UPDATE_DECL(unsigned short, 2, 3, char);
+VEC_UPDATE_DECL(unsigned short, 2, 4, char);
+VEC_UPDATE_DECL(unsigned short, 2, 2, unsigned short);
+VEC_UPDATE_DECL(unsigned short, 2, 3, unsigned short);
+VEC_UPDATE_DECL(unsigned short, 2, 4, unsigned short);
+VEC_UPDATE_DECL(unsigned short, 2, 2, short);
+VEC_UPDATE_DECL(unsigned short, 2, 3, short);
+VEC_UPDATE_DECL(unsigned short, 2, 4, short);
+VEC_UPDATE_DECL(unsigned short, 2, 2, int);
+VEC_UPDATE_DECL(unsigned short, 2, 3, int);
+VEC_UPDATE_DECL(unsigned short, 2, 4, int);
+VEC_UPDATE_DECL(unsigned short, 2, 2, float);
+VEC_UPDATE_DECL(unsigned short, 2, 3, float);
+VEC_UPDATE_DECL(unsigned short, 2, 4, float);
+VEC_UPDATE_DECL(unsigned short, 2, 2, double);
+VEC_UPDATE_DECL(unsigned short, 2, 3, double);
+VEC_UPDATE_DECL(unsigned short, 2, 4, double);
+
+VEC_UPDATE_DECL(unsigned short, 3, 2, unsigned char);
+VEC_UPDATE_DECL(unsigned short, 3, 3, unsigned char);
+VEC_UPDATE_DECL(unsigned short, 3, 4, unsigned char);
+VEC_UPDATE_DECL(unsigned short, 3, 2, char);
+VEC_UPDATE_DECL(unsigned short, 3, 3, char);
+VEC_UPDATE_DECL(unsigned short, 3, 4, char);
+VEC_UPDATE_DECL(unsigned short, 3, 2, unsigned short);
+VEC_UPDATE_DECL(unsigned short, 3, 3, unsigned short);
+VEC_UPDATE_DECL(unsigned short, 3, 4, unsigned short);
+VEC_UPDATE_DECL(unsigned short, 3, 2, short);
+VEC_UPDATE_DECL(unsigned short, 3, 3, short);
+VEC_UPDATE_DECL(unsigned short, 3, 4, short);
+VEC_UPDATE_DECL(unsigned short, 3, 2, int);
+VEC_UPDATE_DECL(unsigned short, 3, 3, int);
+VEC_UPDATE_DECL(unsigned short, 3, 4, int);
+VEC_UPDATE_DECL(unsigned short, 3, 2, float);
+VEC_UPDATE_DECL(unsigned short, 3, 3, float);
+VEC_UPDATE_DECL(unsigned short, 3, 4, float);
+VEC_UPDATE_DECL(unsigned short, 3, 2, double);
+VEC_UPDATE_DECL(unsigned short, 3, 3, double);
+VEC_UPDATE_DECL(unsigned short, 3, 4, double);
+
+VEC_UPDATE_DECL(int, 2, 2, unsigned char);
+VEC_UPDATE_DECL(int, 2, 3, unsigned char);
+VEC_UPDATE_DECL(int, 2, 4, unsigned char);
+VEC_UPDATE_DECL(int, 2, 2, char);
+VEC_UPDATE_DECL(int, 2, 3, char);
+VEC_UPDATE_DECL(int, 2, 4, char);
+VEC_UPDATE_DECL(int, 2, 2, unsigned short);
+VEC_UPDATE_DECL(int, 2, 3, unsigned short);
+VEC_UPDATE_DECL(int, 2, 4, unsigned short);
+VEC_UPDATE_DECL(int, 2, 2, short);
+VEC_UPDATE_DECL(int, 2, 3, short);
+VEC_UPDATE_DECL(int, 2, 4, short);
+VEC_UPDATE_DECL(int, 2, 2, int);
+VEC_UPDATE_DECL(int, 2, 3, int);
+VEC_UPDATE_DECL(int, 2, 4, int);
+VEC_UPDATE_DECL(int, 2, 2, float);
+VEC_UPDATE_DECL(int, 2, 3, float);
+VEC_UPDATE_DECL(int, 2, 4, float);
+VEC_UPDATE_DECL(int, 2, 2, double);
+VEC_UPDATE_DECL(int, 2, 3, double);
+VEC_UPDATE_DECL(int, 2, 4, double);
+
+VEC_UPDATE_DECL(int, 3, 2, unsigned char);
+VEC_UPDATE_DECL(int, 3, 3, unsigned char);
+VEC_UPDATE_DECL(int, 3, 4, unsigned char);
+VEC_UPDATE_DECL(int, 3, 2, char);
+VEC_UPDATE_DECL(int, 3, 3, char);
+VEC_UPDATE_DECL(int, 3, 4, char);
+VEC_UPDATE_DECL(int, 3, 2, unsigned short);
+VEC_UPDATE_DECL(int, 3, 3, unsigned short);
+VEC_UPDATE_DECL(int, 3, 4, unsigned short);
+VEC_UPDATE_DECL(int, 3, 2, short);
+VEC_UPDATE_DECL(int, 3, 3, short);
+VEC_UPDATE_DECL(int, 3, 4, short);
+VEC_UPDATE_DECL(int, 3, 2, int);
+VEC_UPDATE_DECL(int, 3, 3, int);
+VEC_UPDATE_DECL(int, 3, 4, int);
+VEC_UPDATE_DECL(int, 3, 2, float);
+VEC_UPDATE_DECL(int, 3, 3, float);
+VEC_UPDATE_DECL(int, 3, 4, float);
+VEC_UPDATE_DECL(int, 3, 2, double);
+VEC_UPDATE_DECL(int, 3, 3, double);
+VEC_UPDATE_DECL(int, 3, 4, double);
+
+VEC_UPDATE_DECL(float, 2, 2, unsigned char);
+VEC_UPDATE_DECL(float, 2, 3, unsigned char);
+VEC_UPDATE_DECL(float, 2, 4, unsigned char);
+VEC_UPDATE_DECL(float, 2, 2, char);
+VEC_UPDATE_DECL(float, 2, 3, char);
+VEC_UPDATE_DECL(float, 2, 4, char);
+VEC_UPDATE_DECL(float, 2, 2, unsigned short);
+VEC_UPDATE_DECL(float, 2, 3, unsigned short);
+VEC_UPDATE_DECL(float, 2, 4, unsigned short);
+VEC_UPDATE_DECL(float, 2, 2, short);
+VEC_UPDATE_DECL(float, 2, 3, short);
+VEC_UPDATE_DECL(float, 2, 4, short);
+VEC_UPDATE_DECL(float, 2, 2, int);
+VEC_UPDATE_DECL(float, 2, 3, int);
+VEC_UPDATE_DECL(float, 2, 4, int);
+VEC_UPDATE_DECL(float, 2, 2, float);
+VEC_UPDATE_DECL(float, 2, 3, float);
+VEC_UPDATE_DECL(float, 2, 4, float);
+VEC_UPDATE_DECL(float, 2, 2, double);
+VEC_UPDATE_DECL(float, 2, 3, double);
+VEC_UPDATE_DECL(float, 2, 4, double);
+
+VEC_UPDATE_DECL(float, 3, 2, unsigned char);
+VEC_UPDATE_DECL(float, 3, 3, unsigned char);
+VEC_UPDATE_DECL(float, 3, 4, unsigned char);
+VEC_UPDATE_DECL(float, 3, 2, char);
+VEC_UPDATE_DECL(float, 3, 3, char);
+VEC_UPDATE_DECL(float, 3, 4, char);
+VEC_UPDATE_DECL(float, 3, 2, unsigned short);
+VEC_UPDATE_DECL(float, 3, 3, unsigned short);
+VEC_UPDATE_DECL(float, 3, 4, unsigned short);
+VEC_UPDATE_DECL(float, 3, 2, short);
+VEC_UPDATE_DECL(float, 3, 3, short);
+VEC_UPDATE_DECL(float, 3, 4, short);
+VEC_UPDATE_DECL(float, 3, 2, int);
+VEC_UPDATE_DECL(float, 3, 3, int);
+VEC_UPDATE_DECL(float, 3, 4, int);
+VEC_UPDATE_DECL(float, 3, 2, float);
+VEC_UPDATE_DECL(float, 3, 3, float);
+VEC_UPDATE_DECL(float, 3, 4, float);
+VEC_UPDATE_DECL(float, 3, 2, double);
+VEC_UPDATE_DECL(float, 3, 3, double);
+VEC_UPDATE_DECL(float, 3, 4, double);
+  
+VEC_UPDATE_DECL(double, 2, 2, unsigned char);
+VEC_UPDATE_DECL(double, 2, 3, unsigned char);
+VEC_UPDATE_DECL(double, 2, 4, unsigned char);
+VEC_UPDATE_DECL(double, 2, 2, char);
+VEC_UPDATE_DECL(double, 2, 3, char);
+VEC_UPDATE_DECL(double, 2, 4, char);
+VEC_UPDATE_DECL(double, 2, 2, unsigned short);
+VEC_UPDATE_DECL(double, 2, 3, unsigned short);
+VEC_UPDATE_DECL(double, 2, 4, unsigned short);
+VEC_UPDATE_DECL(double, 2, 2, short);
+VEC_UPDATE_DECL(double, 2, 3, short);
+VEC_UPDATE_DECL(double, 2, 4, short);
+VEC_UPDATE_DECL(double, 2, 2, int);
+VEC_UPDATE_DECL(double, 2, 3, int);
+VEC_UPDATE_DECL(double, 2, 4, int);
+VEC_UPDATE_DECL(double, 2, 2, float);
+VEC_UPDATE_DECL(double, 2, 3, float);
+VEC_UPDATE_DECL(double, 2, 4, float);
+VEC_UPDATE_DECL(double, 2, 2, double);
+VEC_UPDATE_DECL(double, 2, 3, double);
+VEC_UPDATE_DECL(double, 2, 4, double);
+
+VEC_UPDATE_DECL(double, 3, 2, unsigned char);
+VEC_UPDATE_DECL(double, 3, 3, unsigned char);
+VEC_UPDATE_DECL(double, 3, 4, unsigned char);
+VEC_UPDATE_DECL(double, 3, 2, char);
+VEC_UPDATE_DECL(double, 3, 3, char);
+VEC_UPDATE_DECL(double, 3, 4, char);
+VEC_UPDATE_DECL(double, 3, 2, unsigned short);
+VEC_UPDATE_DECL(double, 3, 3, unsigned short);
+VEC_UPDATE_DECL(double, 3, 4, unsigned short);
+VEC_UPDATE_DECL(double, 3, 2, short);
+VEC_UPDATE_DECL(double, 3, 3, short);
+VEC_UPDATE_DECL(double, 3, 4, short);
+VEC_UPDATE_DECL(double, 3, 2, int);
+VEC_UPDATE_DECL(double, 3, 3, int);
+VEC_UPDATE_DECL(double, 3, 4, int);
+VEC_UPDATE_DECL(double, 3, 2, float);
+VEC_UPDATE_DECL(double, 3, 3, float);
+VEC_UPDATE_DECL(double, 3, 4, float);
+VEC_UPDATE_DECL(double, 3, 2, double);
+VEC_UPDATE_DECL(double, 3, 3, double);
+VEC_UPDATE_DECL(double, 3, 4, double);  
+
+//#include "clitkImageConvertGenericFilter.txx"
 
 } // end namespace