![]() |
Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages |
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 __elxTransformBase_h 00016 #define __elxTransformBase_h 00017 00019 #include "elxMacro.h" 00020 00021 #include "elxBaseComponentSE.h" 00022 #include "itkAdvancedTransform.h" 00023 #include "itkAdvancedCombinationTransform.h" 00024 #include "elxComponentDatabase.h" 00025 #include "elxProgressCommand.h" 00026 00027 #include <fstream> 00028 #include <iomanip> 00029 00030 namespace elastix 00031 { 00032 //using namespace itk; //Not here, because a TransformBase class was added to ITK... 00033 00127 template <class TElastix> 00128 class TransformBase 00129 : public BaseComponentSE<TElastix> 00130 { 00131 public: 00132 00134 typedef TransformBase Self; 00135 typedef BaseComponentSE<TElastix> Superclass; 00136 00138 itkTypeMacro( TransformBase, BaseComponentSE ); 00139 00141 typedef typename Superclass::ElastixType ElastixType; 00142 typedef typename Superclass::ElastixPointer ElastixPointer; 00143 typedef typename Superclass::ConfigurationType ConfigurationType; 00144 typedef typename Superclass::ConfigurationPointer ConfigurationPointer; 00145 typedef typename ConfigurationType 00146 ::CommandLineArgumentMapType CommandLineArgumentMapType; 00147 typedef typename ConfigurationType 00148 ::CommandLineEntryType CommandLineEntryType; 00149 typedef typename Superclass::RegistrationType RegistrationType; 00150 typedef typename Superclass::RegistrationPointer RegistrationPointer; 00151 00153 typedef typename ElastixType::CoordRepType CoordRepType; 00154 typedef typename ElastixType::FixedImageType FixedImageType; 00155 typedef typename ElastixType::MovingImageType MovingImageType; 00156 00158 typedef ComponentDatabase ComponentDatabaseType; 00159 typedef ComponentDatabaseType::ComponentDescriptionType ComponentDescriptionType; 00160 typedef ComponentDatabase::PtrToCreator PtrToCreator; 00161 00163 typedef elx::ProgressCommand ProgressCommandType; 00164 00166 itkStaticConstMacro( FixedImageDimension, 00167 unsigned int, FixedImageType::ImageDimension ); 00168 00170 itkStaticConstMacro( MovingImageDimension, 00171 unsigned int, MovingImageType::ImageDimension ); 00172 00174 typedef itk::Object ObjectType; 00175 typedef itk::AdvancedTransform< 00176 CoordRepType, 00177 itkGetStaticConstMacro( FixedImageDimension ), 00178 itkGetStaticConstMacro( MovingImageDimension ) > ITKBaseType; 00179 typedef itk::AdvancedCombinationTransform<CoordRepType, 00180 itkGetStaticConstMacro( FixedImageDimension ) > CombinationTransformType; 00181 typedef typename 00182 CombinationTransformType::InitialTransformType InitialTransformType; 00183 00185 typedef typename ITKBaseType::ParametersType ParametersType; 00186 typedef typename ParametersType::ValueType ValueType; 00187 00189 typedef typename ITKBaseType::InputPointType InputPointType; 00190 typedef typename ITKBaseType::OutputPointType OutputPointType; 00191 00193 typedef typename RegistrationType::ITKBaseType ITKRegistrationType; 00194 typedef typename ITKRegistrationType::OptimizerType OptimizerType; 00195 typedef typename OptimizerType::ScalesType ScalesType; 00196 00198 virtual ITKBaseType * GetAsITKBaseType( void ) 00199 { 00200 return dynamic_cast<ITKBaseType *>( this ); 00201 } 00202 00204 virtual const ITKBaseType * GetAsITKBaseType( void ) const 00205 { 00206 return dynamic_cast<const ITKBaseType *>( this ); 00207 } 00208 00209 virtual const CombinationTransformType * GetAsCombinationTransform(void) const 00210 { 00211 return dynamic_cast<const CombinationTransformType * >( this ); 00212 } 00213 virtual CombinationTransformType * GetAsCombinationTransform(void) 00214 { 00215 return dynamic_cast<CombinationTransformType * >( this ); 00216 } 00217 00221 virtual int BeforeAllBase( void ); 00222 00226 virtual int BeforeAllTransformix( void ); 00227 00231 virtual void BeforeRegistrationBase( void ); 00232 00236 virtual void AfterRegistrationBase( void ); 00237 00239 virtual const InitialTransformType * GetInitialTransform( void ) const; 00240 00242 virtual void SetInitialTransform( InitialTransformType * _arg ); 00243 00245 virtual void SetTransformParametersFileName( const char * filename ); 00246 00248 itkGetStringMacro( TransformParametersFileName ); 00249 00251 virtual void ReadFromFile( void ); 00252 00254 virtual void WriteToFile( const ParametersType & param ) const; 00255 00257 virtual void WriteToFile( void ) const; 00258 00260 virtual void SetReadWriteTransformParameters( const bool _arg ); 00261 00263 virtual void ReadInitialTransformFromFile( 00264 const char * transformParameterFileName ); 00265 00267 virtual void TransformPoints( void ) const; 00268 00270 virtual void TransformPointsSomePoints( const std::string filename ) const; 00271 00273 virtual void TransformPointsSomePointsVTK( const std::string filename ) const; 00274 00276 virtual void TransformPointsAllPoints( void ) const; 00277 00279 virtual void ComputeDeterminantOfSpatialJacobian( void ) const; 00280 00282 virtual void ComputeSpatialJacobian( void ) const; 00283 00287 virtual void SetFinalParameters( void ); 00288 00289 protected: 00290 00292 TransformBase(); 00294 virtual ~TransformBase(); 00295 00302 void AutomaticScalesEstimation( ScalesType & scales ) const; 00303 00305 ParametersType * m_TransformParametersPointer; 00306 std::string m_TransformParametersFileName; 00307 ParametersType m_FinalParameters; 00308 00309 private: 00310 00312 TransformBase( const Self& ); // purposely not implemented 00314 void operator=( const Self& ); // purposely not implemented 00315 00317 bool m_ReadWriteTransformParameters; 00318 00319 }; // end class TransformBase 00320 00321 00322 } // end namespace elastix 00323 00324 00325 #ifndef ITK_MANUAL_INSTANTIATION 00326 #include "elxTransformBase.hxx" 00327 #endif 00328 00329 #endif // end #ifndef __elxTransformBase_h
Generated on 24-10-2011 for elastix by ![]() |
![]() |