MITK-IGT
IGT Extension of MITK
Loading...
Searching...
No Matches
mitkEndoMacros.h
Go to the documentation of this file.
1/*============================================================================
2
3The Medical Imaging Interaction Toolkit (MITK)
4
5Copyright (c) German Cancer Research Center (DKFZ)
6All rights reserved.
7
8Use of this source code is governed by a 3-clause BSD license that can be
9found in the LICENSE file.
10
11============================================================================*/
12#ifndef mitkEndoMacros_h
13#define mitkEndoMacros_h
14
18
22#define endoAccessCvMat(function, T, arg1, arg2) \
23if( arg2.type() == cv::DataType<float>::type ) \
24 function<float, T>( arg1, arg2 ); \
25else if( arg2.type() == cv::DataType<double>::type ) \
26 function<double, T>( arg1, arg2 ); \
27else if( arg2.type() == cv::DataType<unsigned short>::type ) \
28 function<unsigned short, T>( arg1, arg2 ); \
29else if( arg2.type() == cv::DataType<unsigned char>::type ) \
30 function<unsigned char, T>( arg1, arg2 ); \
31else if( arg2.type() == cv::DataType<int>::type ) \
32 function<int, T>( arg1, arg2 ); \
33else if( arg2.type() == cv::DataType<short>::type ) \
34 function<short, T>( arg1, arg2 ); \
35else if( arg2.type() == cv::DataType<char>::type ) \
36 function<char, T>( arg1, arg2 ); \
37else \
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) \
71public: \
72 virtual void Set##name (const type _arg) \
73 { \
74 if ( this->m_##name != _arg ) \
75 { \
76 this->m_##name = _arg; \
77 } \
78 } \
79protected: \
80 const type m_##name;
81
82#define endoSetOutput(name, type) \
83public: \
84 virtual void Set##name (type _arg) \
85 { \
86 if ( this->m_##name != _arg ) \
87 { \
88 this->m_##name = _arg; \
89 } \
90 } \
91protected: \
92 type m_##name;
93
94#endif