go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxElastixMain.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 __elxElastixMain_h
00016 #define __elxElastixMain_h
00017 
00018 #include "elxComponentDatabase.h"
00019 #include "elxComponentLoader.h"
00020 
00021 #include "elxBaseComponent.h"
00022 #include "elxElastixBase.h"
00023 #include "itkObject.h"
00024 
00025 #include <iostream>
00026 #include <fstream>
00027 
00028 
00029 
00030 namespace elastix
00031 {
00032 using namespace itk;
00033 
00039 
00050 extern int xoutSetup( const char * logfilename );
00051 
00093 class ElastixMain : public Object
00094 {
00095 public:
00096 
00098   typedef ElastixMain               Self;
00099   typedef Object                    Superclass;
00100   typedef SmartPointer<Self>        Pointer;
00101   typedef SmartPointer<const Self>  ConstPointer;
00102 
00104   itkNewMacro( Self );
00105 
00107   itkTypeMacro( ElastixMain, Object );
00108 
00112   typedef Object                  ObjectType;
00113   typedef ObjectType::Pointer     ObjectPointer;
00114   typedef DataObject              DataObjectType;
00115   typedef DataObjectType::Pointer DataObjectPointer;
00116 
00118   typedef ElastixBase                                     ElastixBaseType;
00119   typedef ElastixBase::ConfigurationType                  ConfigurationType;
00120   typedef ConfigurationType::CommandLineArgumentMapType              ArgumentMapType;
00121   typedef ConfigurationType::Pointer                      ConfigurationPointer;
00122   typedef ElastixBase::ObjectContainerType                ObjectContainerType;
00123   typedef ElastixBase::DataObjectContainerType            DataObjectContainerType;
00124   typedef ElastixBase::ObjectContainerPointer             ObjectContainerPointer;
00125   typedef ElastixBase::DataObjectContainerPointer         DataObjectContainerPointer;
00126   typedef ElastixBase::FlatDirectionCosinesType           FlatDirectionCosinesType;
00127 
00131   typedef ComponentDatabase                               ComponentDatabaseType;
00132   typedef ComponentDatabaseType::Pointer                  ComponentDatabasePointer;
00133   typedef ComponentDatabaseType::PtrToCreator             PtrToCreator;
00134   typedef ComponentDatabaseType::ComponentDescriptionType ComponentDescriptionType;
00135   typedef ComponentDatabaseType::PixelTypeDescriptionType PixelTypeDescriptionType;
00136   typedef ComponentDatabaseType::ImageDimensionType       ImageDimensionType;
00137   typedef ComponentDatabaseType::IndexType                DBIndexType;
00138 
00140   typedef ComponentLoader                                 ComponentLoaderType;
00141   typedef ComponentLoaderType::Pointer                    ComponentLoaderPointer;
00142 
00144   itkSetMacro( FixedImagePixelType,   PixelTypeDescriptionType );
00145   itkSetMacro( MovingImagePixelType,  PixelTypeDescriptionType );
00146   itkSetMacro( FixedImageDimension,   ImageDimensionType );
00147   itkSetMacro( MovingImageDimension,  ImageDimensionType );
00148   itkGetMacro( FixedImagePixelType,   PixelTypeDescriptionType );
00149   itkGetMacro( MovingImagePixelType,  PixelTypeDescriptionType );
00150   itkGetMacro( FixedImageDimension,   ImageDimensionType );
00151   itkGetMacro( MovingImageDimension,  ImageDimensionType );
00152 
00157   itkSetObjectMacro( FixedImageContainer,  DataObjectContainerType );
00158   itkSetObjectMacro( MovingImageContainer, DataObjectContainerType );
00159   itkGetObjectMacro( FixedImageContainer,  DataObjectContainerType );
00160   itkGetObjectMacro( MovingImageContainer, DataObjectContainerType );
00161 
00166   itkSetObjectMacro( FixedMaskContainer, DataObjectContainerType );
00167   itkSetObjectMacro( MovingMaskContainer, DataObjectContainerType );
00168   itkGetObjectMacro( FixedMaskContainer, DataObjectContainerType );
00169   itkGetObjectMacro( MovingMaskContainer, DataObjectContainerType );
00170 
00172   itkSetObjectMacro( Configuration, ConfigurationType );
00173   itkGetObjectMacro( Configuration, ConfigurationType );
00174 
00179   itkGetObjectMacro( Elastix, ObjectType );
00180 
00184   virtual ElastixBaseType * GetElastixBase(void) const;
00185 
00191   itkGetObjectMacro( FinalTransform, ObjectType );
00192 
00197   itkSetObjectMacro( InitialTransform, ObjectType );
00198   itkGetObjectMacro( InitialTransform, ObjectType );
00199 
00202   virtual void SetOriginalFixedImageDirectionFlat(
00203     const FlatDirectionCosinesType & arg );
00204   virtual const FlatDirectionCosinesType &
00205     GetOriginalFixedImageDirectionFlat( void ) const;
00206 
00208   void SetElastixLevel( unsigned int level );
00209   unsigned int GetElastixLevel( void );
00210 
00212   void SetTotalNumberOfElastixLevels( unsigned int levels );
00213   unsigned int GetTotalNumberOfElastixLevels( void );
00214 
00216   itkGetConstMacro( DBIndex, DBIndexType );
00217 
00222   virtual void EnterCommandLineArguments( ArgumentMapType & argmap );
00223 
00229   virtual int Run( void );
00230 
00235   virtual int Run( ArgumentMapType & argmap );
00236 
00241   virtual void SetProcessPriority( void ) const;
00242 
00247   virtual void SetMaximumNumberOfThreads( void ) const;
00248 
00250   static ComponentDatabase * GetComponentDatabase( void )
00251   {
00252     return s_CDB.GetPointer();
00253   }
00254 
00255   static void SetComponentDatabase( ComponentDatabase * arg )
00256   {
00257     if ( s_CDB != arg )
00258     {
00259       s_CDB = arg;
00260     }
00261   }
00262 
00263   static void UnloadComponents( void );
00264 
00265 protected:
00266 
00267   ElastixMain();
00268   virtual ~ElastixMain();
00269 
00273   ObjectPointer m_Elastix;
00274 
00276   ConfigurationPointer  m_Configuration;
00277 
00279   PixelTypeDescriptionType    m_FixedImagePixelType;
00280   ImageDimensionType          m_FixedImageDimension;
00281   PixelTypeDescriptionType    m_MovingImagePixelType;
00282   ImageDimensionType          m_MovingImageDimension;
00283 
00284   DBIndexType                 m_DBIndex;
00285 
00287   DataObjectContainerPointer  m_FixedImageContainer;
00288   DataObjectContainerPointer  m_MovingImageContainer;
00289   DataObjectContainerPointer  m_FixedMaskContainer;
00290   DataObjectContainerPointer  m_MovingMaskContainer;
00291 
00293   ObjectPointer m_FinalTransform;
00294 
00296   ObjectPointer m_InitialTransform;
00297 
00298   FlatDirectionCosinesType     m_OriginalFixedImageDirection;
00299 
00300   static ComponentDatabasePointer s_CDB;
00301   static ComponentLoaderPointer s_ComponentLoader;
00302   virtual int LoadComponents( void );
00303 
00308   virtual int InitDBIndex( void );
00309 
00313   virtual ObjectPointer CreateComponent( const ComponentDescriptionType & name );
00314 
00330   virtual ObjectContainerPointer CreateComponents(
00331     const ComponentDescriptionType & key,
00332     const ComponentDescriptionType & defaultComponentName,
00333     int & errorcode,
00334     bool mandatoryComponent = true );
00335 
00336 private:
00337 
00338   ElastixMain( const Self& );     // purposely not implemented
00339   void operator=( const Self& );  // purposely not implemented
00340 
00341 }; // end class ElastixMain
00342 
00343 
00344 } // end namespace elastix
00345 
00346 
00347 #endif // end #ifndef __elxElastixMain_h
00348 


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