Medical Imaging Interaction Toolkit  2018.4.99-12ad79a3
Medical Imaging Interaction Toolkit
mitkEndoMacros.h
Go to the documentation of this file.
1 /*============================================================================
2 
3 The Medical Imaging Interaction Toolkit (MITK)
4 
5 Copyright (c) German Cancer Research Center (DKFZ)
6 All rights reserved.
7 
8 Use of this source code is governed by a 3-clause BSD license that can be
9 found in the LICENSE file.
10 
11 ============================================================================*/
12 #ifndef mitkEndoMacros_h
13 #define mitkEndoMacros_h
14 
18 
22 #define endoAccessCvMat(function, T, arg1, arg2) \
23 if( arg2.type() == cv::DataType<float>::type ) \
24  function<float, T>( arg1, arg2 ); \
25 else if( arg2.type() == cv::DataType<double>::type ) \
26  function<double, T>( arg1, arg2 ); \
27 else if( arg2.type() == cv::DataType<unsigned short>::type ) \
28  function<unsigned short, T>( arg1, arg2 ); \
29 else if( arg2.type() == cv::DataType<unsigned char>::type ) \
30  function<unsigned char, T>( arg1, arg2 ); \
31 else if( arg2.type() == cv::DataType<int>::type ) \
32  function<int, T>( arg1, arg2 ); \
33 else if( arg2.type() == cv::DataType<short>::type ) \
34  function<short, T>( arg1, arg2 ); \
35 else if( arg2.type() == cv::DataType<char>::type ) \
36  function<char, T>( arg1, arg2 ); \
37 else \
38  throw std::invalid_argument("Unknown type for cv::Mat");
39 
43 #define endoExec(macroAlgName, macroOutputType, macroOutputVarName, ...)\
44  macroOutputType macroOutputVarName;\
45  { \
46  macroAlgName _macroAlgName(__VA_ARGS__, &macroOutputVarName);\
47  _macroAlgName.Update();\
48  }
49 
53 #define endoExec2(macroAlgName, macroOutputType1, macroOutputVarName1, macroOutputType2, macroOutputVarName2, ...)\
54  macroOutputType1 macroOutputVarName1;\
55  macroOutputType1 macroOutputVarName1;\
56  { \
57  macroAlgName _macroAlgName(__VA_ARGS__, &macroOutputVarName1, &macroOutputVarName2);\
58  _macroAlgName.Update();\
59  }
60 
64 #ifdef WIN32
65  static const std::string DIR_SEPARATOR = "\\";
66 #else
67  static const std::string DIR_SEPARATOR = "/";
68 #endif
69 
70 #define endoSetInput(name, type) \
71 public: \
72  virtual void Set##name (const type _arg) \
73  { \
74  if ( this->m_##name != _arg ) \
75  { \
76  this->m_##name = _arg; \
77  } \
78  } \
79 protected: \
80  const type m_##name;
81 
82 #define endoSetOutput(name, type) \
83 public: \
84  virtual void Set##name (type _arg) \
85  { \
86  if ( this->m_##name != _arg ) \
87  { \
88  this->m_##name = _arg; \
89  } \
90  } \
91 protected: \
92  type m_##name;
93 
94 #endif // mitkEndoMacros_h
static const std::string DIR_SEPARATOR