28#ifndef __elxElastixBase_h
29#define __elxElastixBase_h
35#include "itkDataObject.h"
38#include "itkVectorContainer.h"
39#include "itkImageFileReader.h"
40#include "itkChangeInformationImageFilter.h"
51#define elxGetObjectMacro( _name, _type ) \
52 virtual _type * Get##_name( void ) const \
54 return this->m_##_name.GetPointer(); \
58#define elxSetObjectMacro( _name, _type ) \
59 virtual void Set##_name( _type * _arg ) \
61 if( this->m_##_name != _arg ) \
63 this->m_##_name = _arg; \
64 this->GetAsITKBaseType()->Modified(); \
70#define elxGetNumberOfMacro( _name ) \
71 virtual unsigned int GetNumberOf##_name##s( void ) const \
73 if( this->Get##_name##Container() != nullptr ) \
75 return this->Get##_name##Container()->Size(); \
158 typedef itk::VectorContainer<
161 typedef itk::VectorContainer<
164 typedef itk::VectorContainer<
314 virtual int Run(
void ) = 0;
354 const FlatDirectionCosinesType & arg );
390 template<
class TImage >
405 bool useDirectionCosines,
DirectionType * originalDirectionCosines =
nullptr )
410 for(
unsigned int i = 0; i < fileNameContainer->Size(); ++i )
414 imageReader->SetFileName( fileNameContainer->ElementAt( i ).c_str() );
417 direction.SetIdentity();
418 infoChanger->SetOutputDirection( direction );
419 infoChanger->SetChangeDirection( !useDirectionCosines );
420 infoChanger->SetInput( imageReader->GetOutput() );
425 infoChanger->Update();
427 catch( itk::ExceptionObject & excp )
430 std::string err_str = excp.GetDescription();
431 err_str +=
"\nError occurred while reading the image described as "
432 + imageDescription +
", with file name " + imageReader->GetFileName() +
"\n";
433 excp.SetDescription( err_str );
440 imageContainer->CreateElementAt( i ) = image.GetPointer();
443 if( originalDirectionCosines )
445 *originalDirectionCosines = imageReader->GetOutput()->GetDirection();
450 return imageContainer;
462 imageContainer->CreateElementAt( 0 ) = image;
465 return imageContainer;
489 imageContainer->CreateElementAt( j ) = image;
492 return imageContainer;
557 const std::string & optionkey,
560 bool printinfo )
const;
566#undef elxGetObjectMacro
567#undef elxSetObjectMacro
568#undef elxGetNumberOfMacro
The BaseComponent class is a class that all elastix components should inherit from.
The ComponentDatabase class is a class that stores the New() functions of all components.
itk::SmartPointer< Self > Pointer
A class that deals with user given parameters and command line arguments.
itk::SmartPointer< Self > Pointer
~MultipleDataObjectFiller()=default
MultipleDataObjectFiller()=default
static DataObjectContainerPointer GenerateImageContainer(DataObjectPointer image)
ChangeInfoFilterType::Pointer ChangeInfoFilterPointer
~MultipleImageLoader()=default
ImageType::Pointer ImagePointer
MultipleImageLoader()=default
itk::ChangeInformationImageFilter< ImageType > ChangeInfoFilterType
ImageType::DirectionType DirectionType
itk::ImageFileReader< ImageType > ImageReaderType
static DataObjectContainerPointer GenerateImageContainer(DataObjectPointer image)
ImageReaderType::Pointer ImageReaderPointer
static DataObjectContainerPointer GenerateImageContainer(FileNameContainerType *fileNameContainer, const std::string &imageDescription, bool useDirectionCosines, DirectionType *originalDirectionCosines=nullptr)
This class creates an interface for elastix.
elxSetObjectMacro(FixedImageContainer, DataObjectContainerType)
elxSetObjectMacro(MetricContainer, ObjectContainerType)
virtual DBIndexType GetDBIndex(void)
itk::VectorContainer< unsigned int, ObjectPointer > ObjectContainerType
itk::DataObject DataObjectType
DataObjectContainerPointer m_FixedImageContainer
ConfigurationType::Pointer ConfigurationPointer
elxGetObjectMacro(MovingImageFileNameContainer, FileNameContainerType)
elxGetObjectMacro(ComponentDatabase, ComponentDatabaseType)
virtual void SetConfigurations(std::vector< ConfigurationPointer > &configurations)=0
elxGetNumberOfMacro(Metric)
DataObjectContainerPointer m_MovingImageContainer
ObjectContainerPointer m_RegistrationContainer
Configuration ConfigurationType
elxGetNumberOfMacro(MovingMaskFileName)
ObjectType::Pointer ObjectPointer
FileNameContainerPointer m_MovingMaskFileNameContainer
itk::VectorContainer< unsigned int, DataObjectPointer > DataObjectContainerType
elxSetObjectMacro(ResultImageContainer, DataObjectContainerType)
elxSetObjectMacro(OptimizerContainer, ObjectContainerType)
elxSetObjectMacro(RegistrationContainer, ObjectContainerType)
elxSetObjectMacro(ComponentDatabase, ComponentDatabaseType)
elxGetObjectMacro(InitialTransform, ObjectType)
elxGetObjectMacro(FixedImagePyramidContainer, ObjectContainerType)
elxGetObjectMacro(FixedMaskFileNameContainer, FileNameContainerType)
DataObjectContainerType::Pointer DataObjectContainerPointer
ObjectContainerPointer m_OptimizerContainer
ObjectContainerPointer m_ResampleInterpolatorContainer
elxGetNumberOfMacro(Transform)
FileNameContainerPointer m_FixedImageFileNameContainer
elxSetObjectMacro(InitialTransform, ObjectType)
elxGetNumberOfMacro(FixedImage)
ComponentDatabasePointer m_ComponentDatabase
elxSetObjectMacro(ResamplerContainer, ObjectContainerType)
elxGetObjectMacro(MovingImageContainer, DataObjectContainerType)
elxGetObjectMacro(TransformContainer, ObjectContainerType)
ConfigurationPointer m_Configuration
elxGetNumberOfMacro(MovingMask)
bool m_UseDirectionCosines
elxGetNumberOfMacro(MovingImage)
DataObjectContainerPointer m_FixedMaskContainer
elxSetObjectMacro(MovingImageContainer, DataObjectContainerType)
elxGetNumberOfMacro(FixedImagePyramid)
elxSetObjectMacro(MovingImagePyramidContainer, ObjectContainerType)
elxGetNumberOfMacro(FixedMaskFileName)
elxGetObjectMacro(OptimizerContainer, ObjectContainerType)
void AfterRegistrationBase(void) override
elxGetNumberOfMacro(FixedMask)
elxGetObjectMacro(ImageSamplerContainer, ObjectContainerType)
void BeforeRegistrationBase(void) override
ObjectContainerPointer m_ResamplerContainer
elxGetObjectMacro(MovingMaskContainer, DataObjectContainerType)
elxGetObjectMacro(FixedImageContainer, DataObjectContainerType)
ObjectContainerPointer m_InterpolatorContainer
FileNameContainerType::Pointer FileNameContainerPointer
int BeforeAllBase(void) override
DataObjectType::Pointer DataObjectPointer
elxGetObjectMacro(ResampleInterpolatorContainer, ObjectContainerType)
std::vector< double > FlatDirectionCosinesType
FlatDirectionCosinesType m_OriginalFixedImageDirection
elxGetObjectMacro(FixedImageFileNameContainer, FileNameContainerType)
ObjectContainerType::Pointer ObjectContainerPointer
elxSetObjectMacro(FixedImagePyramidContainer, ObjectContainerType)
virtual ITKBaseType * GetAsITKBaseType(void)
DataObjectContainerPointer m_ResultImageContainer
elxGetObjectMacro(Configuration, ConfigurationType)
elxSetObjectMacro(MovingMaskContainer, DataObjectContainerType)
elxGetNumberOfMacro(ResultImage)
elxGetNumberOfMacro(ResultDeformationField)
DataObjectContainerPointer m_MovingMaskContainer
elxGetNumberOfMacro(ResampleInterpolator)
elxGetObjectMacro(RegistrationContainer, ObjectContainerType)
elxSetObjectMacro(Configuration, ConfigurationType)
ComponentDatabase ComponentDatabaseType
elxSetObjectMacro(ResampleInterpolatorContainer, ObjectContainerType)
elxGetNumberOfMacro(Interpolator)
ComponentDatabaseType::IndexType DBIndexType
elxGetNumberOfMacro(MovingImageFileName)
elxSetObjectMacro(ImageSamplerContainer, ObjectContainerType)
ElastixBase(const Self &)
xl::xoutrow_type m_IterationInfo
elxSetObjectMacro(MovingMaskFileNameContainer, FileNameContainerType)
elxSetObjectMacro(MovingImageFileNameContainer, FileNameContainerType)
elxGetObjectMacro(InterpolatorContainer, ObjectContainerType)
int m_DefaultOutputPrecision
ObjectContainerPointer m_FixedImagePyramidContainer
virtual int BeforeAllTransformixBase(void)
elxGetObjectMacro(MetricContainer, ObjectContainerType)
FileNameContainerPointer GenerateFileNameContainer(const std::string &optionkey, int &errorcode, bool printerrors, bool printinfo) const
elxGetNumberOfMacro(Resampler)
elxSetObjectMacro(InterpolatorContainer, ObjectContainerType)
ObjectPointer m_InitialTransform
ObjectContainerPointer m_MovingImagePyramidContainer
elxGetObjectMacro(ResamplerContainer, ObjectContainerType)
elxGetObjectMacro(FinalTransform, ObjectType)
elxSetObjectMacro(ResultDeformationFieldContainer, DataObjectContainerType)
virtual ParameterMapType GetTransformParametersMap(void) const =0
virtual int ApplyTransform(void)=0
itk::VectorContainer< unsigned int, std::string > FileNameContainerType
void operator=(const Self &)
elxSetObjectMacro(FixedMaskFileNameContainer, FileNameContainerType)
elxSetObjectMacro(FixedMaskContainer, DataObjectContainerType)
elxGetNumberOfMacro(Optimizer)
ObjectContainerPointer m_TransformContainer
virtual void SetOriginalFixedImageDirectionFlat(const FlatDirectionCosinesType &arg)
ObjectContainerPointer m_MetricContainer
virtual void CreateTransformParametersMap(void)=0
ObjectContainerPointer m_ImageSamplerContainer
elxGetNumberOfMacro(Registration)
elxSetObjectMacro(TransformContainer, ObjectContainerType)
virtual bool GetUseDirectionCosines(void) const
virtual void SetDBIndex(DBIndexType _arg)
elxSetObjectMacro(FixedImageFileNameContainer, FileNameContainerType)
elxGetNumberOfMacro(MovingImagePyramid)
elxGetNumberOfMacro(ImageSampler)
ComponentDatabaseType::Pointer ComponentDatabasePointer
elxGetObjectMacro(ResultImageContainer, DataObjectContainerType)
elxGetObjectMacro(ResultDeformationFieldContainer, DataObjectContainerType)
~ElastixBase() override=default
elxGetObjectMacro(MovingMaskFileNameContainer, FileNameContainerType)
ObjectPointer m_FinalTransform
elxSetObjectMacro(FinalTransform, ObjectType)
elxGetObjectMacro(MovingImagePyramidContainer, ObjectContainerType)
elxGetNumberOfMacro(FixedImageFileName)
itk::ParameterMapInterface::ParameterMapType ParameterMapType
virtual int GetDefaultOutputPrecision(void) const
virtual const FlatDirectionCosinesType & GetOriginalFixedImageDirectionFlat(void) const
elxGetObjectMacro(FixedMaskContainer, DataObjectContainerType)
FileNameContainerPointer m_FixedMaskFileNameContainer
FileNameContainerPointer m_MovingImageFileNameContainer
DataObjectContainerPointer m_ResultDeformationFieldContainer
ParameterFileParser::ParameterMapType ParameterMapType
The xoutrow class can easily generate tables.