Authors belong to:
- University of LYON http://www.universite-lyon.fr/
- - Léon Bérard cancer center http://oncora1.lyon.fnclcc.fr
+ - Léon Bérard cancer center http://www.centreleonberard.fr
- CREATIS CNRS laboratory http://www.creatis.insa-lyon.fr
This software is distributed WITHOUT ANY WARRANTY; without even
- BSD See included LICENSE.txt file
- CeCILL-B http://www.cecill.info/licences/Licence_CeCILL-B_V1-en.html
-======================================================================-====*/
+===========================================================================**/
#ifndef CLITKCOMMON_H
#define CLITKCOMMON_H
#include <itkImageRegionConstIterator.h>
#include <itkImageRegionIterator.h>
+// std include
#include <fstream>
+// Include for "rusage"
+#include <ctime>
+#if defined(unix) || defined(__APPLE__)
+# include <sys/time.h>
+# include <sys/resource.h>
+#elif defined(WIN32)
+# include <windows.h>
+#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
template<class T> std::string toStringVector(const T * t, const int n);
template<class T> std::string toStringVector(const T & t, const int n);
template<class T> std::string toStringVector(const std::vector<T> & t);
+ template <class T> bool fromString(T& t,
+ const std::string& s,
+ std::ios_base& (*f)(std::ios_base&)=std::dec);
//--------------------------------------------------------------------
// Display a progress %
template<class ImageType>
void CloneImage(const typename ImageType::Pointer & input, typename ImageType::Pointer & output);
+ //--------------------------------------------------------------------
+ void PrintMemoryUsed();
+
#include "clitkCommon.txx"
} // end namespace