Loading...
Searching...
No Matches
elxElastixTemplate.h
Go to the documentation of this file.
/*=========================================================================
*
* Copyright UMC Utrecht and contributors
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0.txt
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*=========================================================================*/
#ifndef elxElastixTemplate_h
#define elxElastixTemplate_h
#include "elxElastixBase.h"
#include "elxFixedImagePyramidBase.h"
#include "elxImageSamplerBase.h"
#include "elxInterpolatorBase.h"
#include "elxMetricBase.h"
#include "elxMovingImagePyramidBase.h"
#include "elxOptimizerBase.h"
#include "elxRegistrationBase.h"
#include "elxResampleInterpolatorBase.h"
#include "elxResamplerBase.h"
#include "elxTransformBase.h"
// ITK header files:
#include <itkCommand.h>
#include <itkImage.h>
#include <itkObject.h>
#include <sstream>
#define elxGetBaseMacro(_name, _elxbasetype) \
_elxbasetype * GetElx##_name##Base(const unsigned int idx = 0) const \
{ \
if (idx < this->GetNumberOf##_name##s()) \
{ \
return dynamic_cast<_elxbasetype *>(this->Get##_name##Container()->ElementAt(idx).GetPointer()); \
} \
return nullptr; \
}
// end elxGetBaseMacro
namespace elastix
{
template <class TFixedImage, class TMovingImage>
class ITK_TEMPLATE_EXPORT ElastixTemplate final : public ElastixBase
{
public:
ITK_DISALLOW_COPY_AND_MOVE(ElastixTemplate);
using Self = ElastixTemplate;
using Superclass = ElastixBase;
using Pointer = itk::SmartPointer<Self>;
using ConstPointer = itk::SmartPointer<const Self>;
itkNewMacro(Self);
itkTypeMacro(ElastixTemplate, ElastixBase);
using FixedImageType = TFixedImage;
using MovingImageType = TMovingImage;
using FixedImagePointer = typename FixedImageType::Pointer;
using MovingImagePointer = typename MovingImageType::Pointer;
itkStaticConstMacro(Dimension, unsigned int, FixedImageType::ImageDimension);
itkStaticConstMacro(FixedDimension, unsigned int, FixedImageType::ImageDimension);
itkStaticConstMacro(MovingDimension, unsigned int, MovingImageType::ImageDimension);
using MaskPixelType = unsigned char;
using FixedMaskType = itk::Image<MaskPixelType, FixedDimension>;
using MovingMaskType = itk::Image<MaskPixelType, MovingDimension>;
using FixedMaskPointer = typename FixedMaskType::Pointer;
using MovingMaskPointer = typename MovingMaskType::Pointer;
using FixedImageDirectionType = typename FixedImageType::DirectionType;
using BaseComponentType = BaseComponent;
using PtrToMemberFunction = void (BaseComponentType::*)();
using PtrToMemberFunction2 = int (BaseComponentType::*)();
using BeforeEachResolutionCommandType = itk::SimpleMemberCommand<Self>;
using AfterEachResolutionCommandType = itk::SimpleMemberCommand<Self>;
using AfterEachIterationCommandType = itk::SimpleMemberCommand<Self>;
using BeforeEachResolutionCommandPointer = typename BeforeEachResolutionCommandType::Pointer;
using AfterEachResolutionCommandPointer = typename AfterEachResolutionCommandType::Pointer;
using AfterEachIterationCommandPointer = typename AfterEachIterationCommandType::Pointer;
using FixedImagePyramidBaseType = FixedImagePyramidBase<Self>;
using MovingImagePyramidBaseType = MovingImagePyramidBase<Self>;
using InterpolatorBaseType = InterpolatorBase<Self>;
using ImageSamplerBaseType = elx::ImageSamplerBase<Self>;
using MetricBaseType = MetricBase<Self>;
using OptimizerBaseType = OptimizerBase<Self>;
using RegistrationBaseType = RegistrationBase<Self>;
using ResamplerBaseType = ResamplerBase<Self>;
using ResampleInterpolatorBaseType = ResampleInterpolatorBase<Self>;
using TransformBaseType = elx::TransformBase<Self>;
using InputImageType = MovingImageType;
using OutputImageType = MovingImageType;
using ParameterMapType = itk::ParameterMapInterface::ParameterMapType;
elxGetBaseMacro(FixedImagePyramid, FixedImagePyramidBaseType);
elxGetBaseMacro(MovingImagePyramid, MovingImagePyramidBaseType);
elxGetBaseMacro(Interpolator, InterpolatorBaseType);
elxGetBaseMacro(ImageSampler, ImageSamplerBaseType);
elxGetBaseMacro(Metric, MetricBaseType);
elxGetBaseMacro(Optimizer, OptimizerBaseType);
elxGetBaseMacro(Registration, RegistrationBaseType);
elxGetBaseMacro(Resampler, ResamplerBaseType);
elxGetBaseMacro(ResampleInterpolator, ResampleInterpolatorBaseType);
elxGetBaseMacro(Transform, TransformBaseType);
FixedImageType *
GetFixedImage(unsigned int idx = 0) const;
MovingImageType *
GetMovingImage(unsigned int idx = 0) const;
FixedMaskType *
GetFixedMask(unsigned int idx = 0) const;
MovingMaskType *
GetMovingMask(unsigned int idx = 0) const;
int
Run() override;
int
ApplyTransform(bool doReadTransform) override;
int
BeforeAll() override;
int
BeforeAllTransformix();
void
BeforeRegistration() override;
void
BeforeEachResolution() override;
void
AfterEachResolution() override;
void
AfterEachIteration() override;
void
AfterRegistration() override;
itkGetConstMacro(IterationCounter, unsigned int);
itkGetStringMacro(CurrentTransformParameterFileName);
bool
GetOriginalFixedImageDirection(FixedImageDirectionType & direction) const;
private:
ElastixTemplate() = default;
~ElastixTemplate() override = default;
BeforeEachResolutionCommandPointer m_BeforeEachResolutionCommand{};
AfterEachIterationCommandPointer m_AfterEachIterationCommand{};
AfterEachResolutionCommandPointer m_AfterEachResolutionCommand{};
void
CreateTransformParameterFile(const std::string & FileName, const bool ToLog);
void
CreateTransformParameterMap() override;
void
OpenIterationInfoFile();
void
CallInEachComponent(PtrToMemberFunction func);
int
CallInEachComponentInt(PtrToMemberFunction2 func);
void
ConfigureComponents(Self * This);
void
SetOriginalFixedImageDirection(const FixedImageDirectionType & arg);
};
} // end namespace elastix
#undef elxGetBaseMacro
#ifndef ITK_MANUAL_INSTANTIATION
# include "elxElastixTemplate.hxx"
#endif
#endif // end #ifndef elxElastixTemplate_h
elastix::BaseComponent
The BaseComponent class is a class that all elastix components should inherit from.
Definition elxBaseComponent.h:54
elastix::ElastixBase::ElastixBase
ElastixBase()
elastix::ElastixTemplate::ResamplerBaseType
ResamplerBase< Self > ResamplerBaseType
Definition elxElastixTemplate.h:164
elastix::ElastixTemplate::TransformBaseType
elx::TransformBase< Self > TransformBaseType
Definition elxElastixTemplate.h:166
elastix::ElastixTemplate::itkStaticConstMacro
itkStaticConstMacro(MovingDimension, unsigned int, MovingImageType::ImageDimension)
elastix::ElastixTemplate::OutputImageType
MovingImageType OutputImageType
Definition elxElastixTemplate.h:173
elastix::ElastixTemplate::AfterEachIterationCommandPointer
typename AfterEachIterationCommandType::Pointer AfterEachIterationCommandPointer
Definition elxElastixTemplate.h:154
elastix::ElastixTemplate::CallInEachComponentInt
int CallInEachComponentInt(PtrToMemberFunction2 func)
elastix::ElastixTemplate::m_AfterEachIterationCommand
AfterEachIterationCommandPointer m_AfterEachIterationCommand
Definition elxElastixTemplate.h:263
elastix::ElastixTemplate::GetOriginalFixedImageDirection
bool GetOriginalFixedImageDirection(FixedImageDirectionType &direction) const
elastix::ElastixTemplate::BeforeAll
int BeforeAll() override
elastix::ElastixTemplate::CreateTransformParameterMap
void CreateTransformParameterMap() override
elastix::ElastixTemplate::elxGetBaseMacro
elxGetBaseMacro(Optimizer, OptimizerBaseType)
elastix::ElastixTemplate::BeforeRegistration
void BeforeRegistration() override
elastix::ElastixTemplate::MetricBaseType
MetricBase< Self > MetricBaseType
Definition elxElastixTemplate.h:161
elastix::ElastixTemplate::MovingMaskPointer
typename MovingMaskType::Pointer MovingMaskPointer
Definition elxElastixTemplate.h:136
elastix::ElastixTemplate::MovingImagePointer
typename MovingImageType::Pointer MovingImagePointer
Definition elxElastixTemplate.h:124
elastix::ElastixTemplate::ElastixTemplate
ElastixTemplate()=default
elastix::ElastixTemplate::Pointer
itk::SmartPointer< Self > Pointer
Definition elxElastixTemplate.h:111
elastix::ElastixTemplate::BeforeAllTransformix
int BeforeAllTransformix()
elastix::ElastixTemplate::FixedImageType
TFixedImage FixedImageType
Definition elxElastixTemplate.h:121
elastix::ElastixTemplate::FixedImageDirectionType
typename FixedImageType::DirectionType FixedImageDirectionType
Definition elxElastixTemplate.h:139
elastix::ElastixTemplate::elxGetBaseMacro
elxGetBaseMacro(Transform, TransformBaseType)
elastix::ElastixTemplate::elxGetBaseMacro
elxGetBaseMacro(Resampler, ResamplerBaseType)
elastix::ElastixTemplate::SetOriginalFixedImageDirection
void SetOriginalFixedImageDirection(const FixedImageDirectionType &arg)
elastix::ElastixTemplate::CallInEachComponent
void CallInEachComponent(PtrToMemberFunction func)
elastix::ElastixTemplate::BeforeEachResolutionCommandType
itk::SimpleMemberCommand< Self > BeforeEachResolutionCommandType
Definition elxElastixTemplate.h:149
elastix::ElastixTemplate::AfterEachResolutionCommandPointer
typename AfterEachResolutionCommandType::Pointer AfterEachResolutionCommandPointer
Definition elxElastixTemplate.h:153
elastix::ElastixTemplate::elxGetBaseMacro
elxGetBaseMacro(Metric, MetricBaseType)
elastix::ElastixTemplate::MovingMaskType
itk::Image< MaskPixelType, MovingDimension > MovingMaskType
Definition elxElastixTemplate.h:134
elastix::ElastixTemplate::~ElastixTemplate
~ElastixTemplate() override=default
elastix::ElastixTemplate::InputImageType
MovingImageType InputImageType
Definition elxElastixTemplate.h:172
elastix::ElastixTemplate::OpenIterationInfoFile
void OpenIterationInfoFile()
elastix::ElastixTemplate::FixedMaskType
itk::Image< MaskPixelType, FixedDimension > FixedMaskType
Definition elxElastixTemplate.h:133
elastix::ElastixTemplate::elxGetBaseMacro
elxGetBaseMacro(FixedImagePyramid, FixedImagePyramidBaseType)
elastix::ElastixTemplate::GetMovingMask
MovingMaskType * GetMovingMask(unsigned int idx=0) const
elastix::ElastixTemplate::m_BeforeEachResolutionCommand
BeforeEachResolutionCommandPointer m_BeforeEachResolutionCommand
Definition elxElastixTemplate.h:262
elastix::ElastixTemplate::itkStaticConstMacro
itkStaticConstMacro(FixedDimension, unsigned int, FixedImageType::ImageDimension)
elastix::ElastixTemplate::Run
int Run() override
elastix::ElastixTemplate::ImageSamplerBaseType
elx::ImageSamplerBase< Self > ImageSamplerBaseType
Definition elxElastixTemplate.h:160
elastix::ElastixTemplate::FixedImagePointer
typename FixedImageType::Pointer FixedImagePointer
Definition elxElastixTemplate.h:123
elastix::ElastixTemplate::BaseComponentType
BaseComponent BaseComponentType
Definition elxElastixTemplate.h:142
elastix::ElastixTemplate::AfterEachIteration
void AfterEachIteration() override
elastix::ElastixTemplate::Superclass
ElastixBase Superclass
Definition elxElastixTemplate.h:110
elastix::ElastixTemplate::itkStaticConstMacro
itkStaticConstMacro(Dimension, unsigned int, FixedImageType::ImageDimension)
elastix::ElastixTemplate::CreateTransformParameterFile
void CreateTransformParameterFile(const std::string &FileName, const bool ToLog)
elastix::ElastixTemplate::GetFixedMask
FixedMaskType * GetFixedMask(unsigned int idx=0) const
elastix::ElastixTemplate::InterpolatorBaseType
InterpolatorBase< Self > InterpolatorBaseType
Definition elxElastixTemplate.h:159
elastix::ElastixTemplate::MaskPixelType
unsigned char MaskPixelType
Definition elxElastixTemplate.h:132
elastix::ElastixTemplate::ConstPointer
itk::SmartPointer< const Self > ConstPointer
Definition elxElastixTemplate.h:112
elastix::ElastixTemplate::ITK_DISALLOW_COPY_AND_MOVE
ITK_DISALLOW_COPY_AND_MOVE(ElastixTemplate)
elastix::ElastixTemplate::PtrToMemberFunction
void(BaseComponentType::*)() PtrToMemberFunction
Definition elxElastixTemplate.h:145
elastix::ElastixTemplate::BeforeEachResolutionCommandPointer
typename BeforeEachResolutionCommandType::Pointer BeforeEachResolutionCommandPointer
Definition elxElastixTemplate.h:152
elastix::ElastixTemplate::GetMovingImage
MovingImageType * GetMovingImage(unsigned int idx=0) const
elastix::ElastixTemplate::Self
ElastixTemplate Self
Definition elxElastixTemplate.h:109
elastix::ElastixTemplate::AfterEachResolution
void AfterEachResolution() override
elastix::ElastixTemplate::MovingImagePyramidBaseType
MovingImagePyramidBase< Self > MovingImagePyramidBaseType
Definition elxElastixTemplate.h:158
elastix::ElastixTemplate::elxGetBaseMacro
elxGetBaseMacro(Registration, RegistrationBaseType)
elastix::ElastixTemplate::FixedMaskPointer
typename FixedMaskType::Pointer FixedMaskPointer
Definition elxElastixTemplate.h:135
elastix::ElastixTemplate::AfterEachIterationCommandType
itk::SimpleMemberCommand< Self > AfterEachIterationCommandType
Definition elxElastixTemplate.h:151
elastix::ElastixTemplate::ConfigureComponents
void ConfigureComponents(Self *This)
elastix::ElastixTemplate::ResampleInterpolatorBaseType
ResampleInterpolatorBase< Self > ResampleInterpolatorBaseType
Definition elxElastixTemplate.h:165
elastix::ElastixTemplate::elxGetBaseMacro
elxGetBaseMacro(ResampleInterpolator, ResampleInterpolatorBaseType)
elastix::ElastixTemplate::AfterRegistration
void AfterRegistration() override
elastix::ElastixTemplate::FixedImagePyramidBaseType
FixedImagePyramidBase< Self > FixedImagePyramidBaseType
Definition elxElastixTemplate.h:157
elastix::ElastixTemplate::RegistrationBaseType
RegistrationBase< Self > RegistrationBaseType
Definition elxElastixTemplate.h:163
elastix::ElastixTemplate::AfterEachResolutionCommandType
itk::SimpleMemberCommand< Self > AfterEachResolutionCommandType
Definition elxElastixTemplate.h:150
elastix::ElastixTemplate::GetFixedImage
FixedImageType * GetFixedImage(unsigned int idx=0) const
elastix::ElastixTemplate::MovingImageType
TMovingImage MovingImageType
Definition elxElastixTemplate.h:122
elastix::ElastixTemplate::ApplyTransform
int ApplyTransform(bool doReadTransform) override
elastix::ElastixTemplate::ParameterMapType
itk::ParameterMapInterface::ParameterMapType ParameterMapType
Definition elxElastixTemplate.h:176
elastix::ElastixTemplate::elxGetBaseMacro
elxGetBaseMacro(Interpolator, InterpolatorBaseType)
elastix::ElastixTemplate::m_AfterEachResolutionCommand
AfterEachResolutionCommandPointer m_AfterEachResolutionCommand
Definition elxElastixTemplate.h:264
elastix::ElastixTemplate::OptimizerBaseType
OptimizerBase< Self > OptimizerBaseType
Definition elxElastixTemplate.h:162
elastix::ElastixTemplate::elxGetBaseMacro
elxGetBaseMacro(ImageSampler, ImageSamplerBaseType)
elastix::ElastixTemplate::BeforeEachResolution
void BeforeEachResolution() override
elastix::ElastixTemplate::elxGetBaseMacro
elxGetBaseMacro(MovingImagePyramid, MovingImagePyramidBaseType)
elastix::ElastixTemplate::PtrToMemberFunction2
int(BaseComponentType::*)() PtrToMemberFunction2
Definition elxElastixTemplate.h:146
elastix::FixedImagePyramidBase
This class is the elastix base class for all FixedImagePyramids.
Definition elxFixedImagePyramidBase.h:59
elastix::InterpolatorBase
This class is the elastix base class for all Interpolators.
Definition elxInterpolatorBase.h:45
elastix::MetricBase
This class is the elastix base class for all Metrics.
Definition elxMetricBase.h:73
elastix::MovingImagePyramidBase
This class is the elastix base class for all MovingImagePyramids.
Definition elxMovingImagePyramidBase.h:61
elastix::OptimizerBase
This class is the elastix base class for all Optimizers.
Definition elxOptimizerBase.h:54
elastix::RegistrationBase
This class is the elastix base class for all Registration schemes.
Definition elxRegistrationBase.h:76
elastix::ResampleInterpolatorBase
This class is the elastix base class for all ResampleInterpolators.
Definition elxResampleInterpolatorBase.h:44
elastix::ResamplerBase
Definition elxResamplerBase.h:78
elastix::TransformBase
This class is the elastix base class for all Transforms.
Definition elxTransformBase.h:138
int
itk::ImageSamplerBase
This class is a base class for any image sampler.
Definition itkImageSamplerBase.h:44
itk::ParameterMapInterface::ParameterMapType
ParameterFileParser::ParameterMapType ParameterMapType
Definition itkParameterMapInterface.h:97
elxElastixBase.h
elxFixedImagePyramidBase.h
elxImageSamplerBase.h
elxInterpolatorBase.h
elxMetricBase.h
elxMovingImagePyramidBase.h
elxOptimizerBase.h
elxRegistrationBase.h
elxResampleInterpolatorBase.h
elxResamplerBase.h
elxTransformBase.h
elastix
Definition elxDefaultConstruct.h:25

Generated on 1768596610 for elastix by 1.15.0 |