]> Creatis software - bbtk.git/blobdiff - packages/vtk/src/bbtkStaticLecture.cxx
#2981 BBTK Feature New Normal - FormatOutput of filters in string
[bbtk.git] / packages / vtk / src / bbtkStaticLecture.cxx
index e166919ed9f2b09e368ab4ca7ce63cddc105a2f3..fc1f9af7dd468b35ef8e0356f093ade9510f5bb3 100755 (executable)
 
 #include "bbtkStaticLecture.h"
 
+#include <string>
+
+int bbtkStaticLecture::GetTypeFormat( std::string formatStr , vtkImageData* image )
+{
+       int outputformat = VTK_UNSIGNED_CHAR;
+       if (formatStr=="SAME")
+       {                                               
+               if (image!=NULL) outputformat = image->GetScalarType();
+       }
+       else if (formatStr=="VTK_BIT")                          outputformat = VTK_BIT;                         // 1
+       else if (formatStr=="VTK_CHAR")                         outputformat = VTK_CHAR;                        // 2
+       else if (formatStr=="VTK_SIGNED_CHAR")          outputformat = VTK_SIGNED_CHAR;         // 15
+       else if (formatStr=="VTK_UNSIGNED_CHAR")        outputformat = VTK_UNSIGNED_CHAR;       // 3
+       else if (formatStr=="VTK_SHORT")                        outputformat = VTK_SHORT;                       // 4
+       else if (formatStr=="VTK_UNSIGNED_SHORT")       outputformat = VTK_UNSIGNED_SHORT;      // 5
+       else if (formatStr=="VTK_INT")                          outputformat = VTK_INT;                 // 6
+       else if (formatStr=="VTK_UNSIGNED_INT")         outputformat = VTK_UNSIGNED_INT;        // 7
+       else if (formatStr=="VTK_LONG")                         outputformat = VTK_LONG;                // 8  
+       else if (formatStr=="VTK_UNSIGNED_LONG")        outputformat = VTK_UNSIGNED_LONG;       // 9
+       else if (formatStr=="VTK_FLOAT")                        outputformat = VTK_FLOAT;               // 10
+       else if (formatStr=="VTK_DOUBLE")                       outputformat = VTK_DOUBLE;              // 11 
+       else if (formatStr=="MET_CHAR")                         outputformat = VTK_CHAR;                        // 2
+       else if (formatStr=="MET_UCHAR")                        outputformat = VTK_UNSIGNED_CHAR;       // 3
+       else if (formatStr=="MET_SHORT")                        outputformat = VTK_SHORT;                       // 4
+       else if (formatStr=="MET_USHORT")                       outputformat = VTK_UNSIGNED_SHORT;      // 5
+       else if (formatStr=="MET_SHORT")                        outputformat = VTK_SHORT;               // 4
+       else if (formatStr=="MET_FLOAT")                        outputformat = VTK_FLOAT;               // 10
+       else if (formatStr=="MET_DOUBLE")                       outputformat = VTK_DOUBLE;              // 11  
+
+    return outputformat;
+}
+
+
 
        void bbtkStaticLecture::setPixelValue(int i, int j, int k, vtkImageData* img, double value)
        {