24 #ifndef __elxElastixBase_h
25 #define __elxElastixBase_h
30 #include "itkObject.h"
31 #include "itkDataObject.h"
34 #include "itkVectorContainer.h"
35 #include "itkImageFileReader.h"
36 #include "itkChangeInformationImageFilter.h"
47 #define elxGetObjectMacro(_name,_type) \
48 virtual _type * Get##_name (void) const \
50 return this->m_##_name .GetPointer(); \
54 #define elxSetObjectMacro(_name,_type) \
55 virtual void Set##_name (_type * _arg) \
57 if ( this->m_##_name != _arg ) \
59 this->m_##_name = _arg; \
60 this->GetAsITKBaseType()->Modified(); \
66 #define elxGetNumberOfMacro(_name) \
67 virtual unsigned int GetNumberOf##_name##s(void) const \
69 if ( this->Get##_name##Container() != 0 ) \
71 return this->Get##_name##Container()->Size(); \
156 typedef itk::VectorContainer<
159 typedef itk::VectorContainer<
162 typedef itk::VectorContainer<
188 virtual void SetDBIndex( DBIndexType _arg );
191 return this->m_DBIndex;
296 virtual int Run(
void ) = 0;
299 virtual int ApplyTransform(
void ) = 0;
304 virtual int BeforeAllBase(
void );
309 virtual int BeforeAllTransformixBase(
void );
314 virtual void BeforeRegistrationBase(
void );
315 virtual void AfterRegistrationBase(
void );
321 virtual int GetDefaultOutputPrecision(
void )
const
323 return this->m_DefaultOutputPrecision;
329 virtual bool GetUseDirectionCosines(
void )
const;
333 virtual void SetOriginalFixedImageDirectionFlat(
334 const FlatDirectionCosinesType & arg );
335 virtual const FlatDirectionCosinesType &
336 GetOriginalFixedImageDirectionFlat(
void )
const;
343 ConfigurationPointer m_Configuration;
361 template <
class TImage >
375 bool useDirectionCosines,
DirectionType * originalDirectionCosines = NULL )
380 for (
unsigned int i = 0; i < fileNameContainer->Size(); ++i )
384 imageReader->SetFileName( fileNameContainer->ElementAt( i ).c_str() );
387 direction.SetIdentity();
388 infoChanger->SetOutputDirection( direction );
389 infoChanger->SetChangeDirection( !useDirectionCosines );
390 infoChanger->SetInput( imageReader->GetOutput() );
395 infoChanger->Update();
397 catch( itk::ExceptionObject & excp )
400 std::string err_str = excp.GetDescription();
401 err_str +=
"\nError occurred while reading the image described as "
402 + imageDescription +
", with file name " + imageReader->GetFileName() +
"\n";
403 excp.SetDescription( err_str );
410 imageContainer->CreateElementAt(i) = image.GetPointer();
413 if ( originalDirectionCosines )
415 *originalDirectionCosines = imageReader->GetOutput()->GetDirection();
420 return imageContainer;
432 void operator=(
const Self& );
479 const std::string & optionkey,
482 bool printinfo )
const;
489 #undef elxGetObjectMacro
490 #undef elxSetObjectMacro
491 #undef elxGetNumberOfMacro
493 #endif // end #ifndef __elxElastixBase_h