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.
00001 /*======================================================================
00002 
00003   This file is part of the elastix software.
00004 
00005   Copyright (c) University Medical Center Utrecht. All rights reserved.
00006   See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
00007   details.
00008 
00009      This software is distributed WITHOUT ANY WARRANTY; without even
00010      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011      PURPOSE. See the above copyright notices for more information.
00012 
00013 ======================================================================*/
00014 
00015 #ifndef __elxMacro_h
00016 #define __elxMacro_h
00017 
00018 
00080 #define elxInstallMacro(_classname) \
00081   template < ::elx::ComponentDatabase::IndexType VIndex> \
00082     class _classname##_install \
00083   { \
00084   public: \
00085     typedef typename ::elx::ElastixTypedef<VIndex>::ElastixType ElastixType; \
00086     typedef ::elx::ComponentDatabase::ComponentDescriptionType ComponentDescriptionType; \
00087     static int DO(::elx::ComponentDatabase * cdb) \
00088     { \
00089     ComponentDescriptionType name = ::elx:: _classname <ElastixType>::elxGetClassNameStatic(); \
00090     int dummy = ::elx::InstallFunctions< ::elx:: _classname <ElastixType> >::InstallComponent(name, VIndex, cdb); \
00091       if ( ::elx::ElastixTypedef<VIndex+1>::Defined() ) \
00092       { return _classname##_install<VIndex+1>::DO( cdb ); } \
00093       return dummy;  \
00094     } \
00095   }; \
00096   template <> \
00097     class _classname##_install < ::elx::NrOfSupportedImageTypes+1 > \
00098   { \
00099   public: \
00100     typedef ::elx::ComponentDatabase::ComponentDescriptionType ComponentDescriptionType; \
00101     static int DO(::elx::ComponentDatabase *  ) \
00102     { return 0; } \
00103   }; \
00104   extern "C" int _classname##InstallComponent( \
00105     ::elx::ComponentDatabase * _cdb ) \
00106   { \
00107     int _InstallDummy##_classname = _classname##_install<1>::DO( _cdb  ); \
00108     return _InstallDummy##_classname ; \
00109   }//ignore semicolon
00110 
00111 
00129 #define elxInstallComponentFunctionDeclarationMacro(_classname)\
00130 extern "C" int _classname##InstallComponent( \
00131     ::elx::ComponentDatabase * _cdb )
00132 
00133 
00151 #define elxInstallComponentFunctionCallMacro(_classname)\
00152   ret |= _classname##InstallComponent( _cdb )
00153 
00154 
00162 #define elxPrepareImageTypeSupportMacro() \
00163   template < ::elx::ComponentDatabase::IndexType VIndex >   \
00164     class ElastixTypedef \
00165   { \
00166   public: \
00167  \
00168  \
00169     typedef ::itk::Object ElastixType;  \
00170     typedef ::elx::ComponentDatabase::PixelTypeDescriptionType PixelTypeString; \
00171     static PixelTypeString fPixelTypeAsString(void) \
00172       { return PixelTypeString("");} \
00173     static PixelTypeString mPixelTypeAsString(void) \
00174       { return PixelTypeString("");} \
00175     static unsigned int fDim(void) \
00176       { return 0;} \
00177     static unsigned int mDim(void) \
00178       { return 0;} \
00179  \
00180  \
00181     static bool Defined(void) \
00182       { return false;} \
00183   }
00184 
00185 
00213 #define elxSupportedImageTypeMacro(_fPixelType,_fDim,_mPixelType,_mDim,_VIndex) \
00214   template<> \
00215     class ElastixTypedef < _VIndex > \
00216   { \
00217   public: \
00218     typedef ::itk::Image< _fPixelType , _fDim > FixedImageType; \
00219     typedef ::itk::Image< _mPixelType , _mDim > MovingImageType; \
00220     typedef ::elx::ElastixTemplate< FixedImageType, MovingImageType > ElastixType; \
00221     typedef ::elx::ComponentDatabase::PixelTypeDescriptionType PixelTypeString; \
00222     static PixelTypeString fPixelTypeAsString(void) \
00223       { return PixelTypeString( #_fPixelType );} \
00224     static PixelTypeString mPixelTypeAsString(void) \
00225       { return PixelTypeString( #_mPixelType );} \
00226     static unsigned int fDim(void) \
00227       { return _fDim ;} \
00228     static unsigned int mDim(void) \
00229       { return _mDim ;} \
00230     static bool Defined(void) \
00231     { return true; }  \
00232   }
00233 
00234 
00254 #define elxClassNameMacro(_name) \
00255 static const char * elxGetClassNameStatic( void ) { return _name ; } \
00256 virtual const char * elxGetClassName( void ) const { return _name ; }
00257 
00258 
00270 #define elxout ::xl::xout["standard"]
00271 
00272 
00273 #endif // end #ifndef __elxMacro_h
00274 


Generated on 24-05-2012 for elastix by doxygen 1.7.6.1 elastix logo