]> Creatis software - clitk.git/blobdiff - common/clitkCommon.h
BUG seed_arg was used instead of seedRadius_arg
[clitk.git] / common / clitkCommon.h
index 97808d8d870ba778887a8ba98542cd3ea7ddf8b5..11a6255955e8b2185c25b49334bd64158d58a8dc 100644 (file)
 #  include <windows.h>
 #endif
 
+#if ITK_VERSION_MAJOR < 4
+namespace itk
+{
+  typedef unsigned int ThreadIdType;
+}
+#endif
+
 //--------------------------------------------------------------------
 namespace clitk {
 
   typedef unsigned char uchar;
   typedef unsigned short ushort;
   typedef unsigned int uint;
+  
+#define CLITK_TRY_CATCH_EXIT(func) \
+  try { \
+    func; \
+  } \
+  catch (const itk::ExceptionObject& e) { \
+    e.Print(std::cout); \
+    exit(-1);\
+  } \
+  catch (const std::exception& e) { \
+    std::cout << e.what() << std::endl; \
+    exit(-2);\
+  } \
+  catch (...) { \
+    std::cout << "Unknown excpetion" << std::endl; \
+    exit(-3); \
+  }
+    
 
   //--------------------------------------------------------------------
   // when everything goes wrong