go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxMacro.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright UMC Utrecht and contributors
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  * http://www.apache.org/licenses/LICENSE-2.0.txt
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  *=========================================================================*/
18 #ifndef __elxMacro_h
19 #define __elxMacro_h
20 
29 #include "itkWin32Header.h"
30 
92 #define elxInstallMacro( _classname ) \
93  template< ::elx::ComponentDatabase::IndexType VIndex > \
94  class _classname##_install \
95  { \
96 public: \
97  typedef typename::elx::ElastixTypedef< VIndex >::ElastixType ElastixType; \
98  typedef::elx::ComponentDatabase::ComponentDescriptionType ComponentDescriptionType; \
99  static int DO( ::elx::ComponentDatabase * cdb ) \
100  { \
101  ComponentDescriptionType name = ::elx::_classname< ElastixType >::elxGetClassNameStatic(); \
102  int dummy = ::elx::InstallFunctions< ::elx::_classname< ElastixType > >::InstallComponent( name, VIndex, cdb ); \
103  if( ::elx::ElastixTypedef< VIndex + 1 >::Defined() ) \
104  { return _classname##_install< VIndex + 1 >::DO( cdb ); } \
105  return dummy; \
106  } \
107  }; \
108  template< > \
109  class _classname##_install< ::elx::NrOfSupportedImageTypes + 1 > \
110  { \
111 public: \
112  typedef::elx::ComponentDatabase::ComponentDescriptionType ComponentDescriptionType; \
113  static int DO( ::elx::ComponentDatabase * ) \
114  { return 0; } \
115  }; \
116  extern "C" int _classname##InstallComponent( \
117  ::elx::ComponentDatabase * _cdb ) \
118  { \
119  int _InstallDummy##_classname = _classname##_install< 1 >::DO( _cdb ); \
120  return _InstallDummy##_classname; \
121  } //ignore semicolon
122 
140 #define elxInstallComponentFunctionDeclarationMacro( _classname ) \
141  extern "C" int _classname##InstallComponent( \
142  ::elx::ComponentDatabase * _cdb )
143 
161 #define elxInstallComponentFunctionCallMacro( _classname ) \
162  ret |= _classname##InstallComponent( _cdb )
163 
171 #define elxPrepareImageTypeSupportMacro() \
172  template< ::elx::ComponentDatabase::IndexType VIndex > \
173  \
174  class ElastixTypedef \
175  { \
176 public: \
177  \
178  \
179  typedef::itk::Object ElastixType; \
180  typedef::elx::ComponentDatabase::PixelTypeDescriptionType PixelTypeString; \
181  static PixelTypeString fPixelTypeAsString( void ) \
182  { return PixelTypeString( "" ); } \
183  static PixelTypeString mPixelTypeAsString( void ) \
184  { return PixelTypeString( "" ); } \
185  static unsigned int fDim( void ) \
186  { return 0; } \
187  static unsigned int mDim( void ) \
188  { return 0; } \
189  \
190  \
191  static bool Defined( void ) \
192  { return false; } \
193  }
194 
222 #define elxSupportedImageTypeMacro( _fPixelType, _fDim, _mPixelType, _mDim, _VIndex ) \
223  template< > \
224  class ElastixTypedef< _VIndex > \
225  { \
226 public: \
227  typedef::itk::Image< _fPixelType, _fDim > FixedImageType; \
228  typedef::itk::Image< _mPixelType, _mDim > MovingImageType; \
229  typedef::elx::ElastixTemplate< FixedImageType, MovingImageType > ElastixType; \
230  typedef::elx::ComponentDatabase::PixelTypeDescriptionType PixelTypeString; \
231  static PixelTypeString fPixelTypeAsString( void ) \
232  { return PixelTypeString( #_fPixelType ); } \
233  static PixelTypeString mPixelTypeAsString( void ) \
234  { return PixelTypeString( #_mPixelType ); } \
235  static unsigned int fDim( void ) \
236  { return _fDim; } \
237  static unsigned int mDim( void ) \
238  { return _mDim; } \
239  static bool Defined( void ) \
240  { return true; } \
241  }
242 
262 #define elxClassNameMacro( _name ) \
263  static const char * elxGetClassNameStatic( void ) { return _name; } \
264  virtual const char * elxGetClassName( void ) const { return _name; }
265 
277 #define elxout ::xl::xout[ "standard" ]
278 
279 #endif // end #ifndef __elxMacro_h


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo