go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxElastixTemplate.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright UMC Utrecht and contributors
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18#ifndef elxElastixTemplate_h
19#define elxElastixTemplate_h
20
21#include "elxElastixBase.h"
23#include "elxImageSamplerBase.h"
24#include "elxInterpolatorBase.h"
25#include "elxMetricBase.h"
27#include "elxOptimizerBase.h"
28#include "elxRegistrationBase.h"
30#include "elxResamplerBase.h"
31#include "elxTransformBase.h"
32
33// ITK header files:
34#include <itkCommand.h>
35#include <itkImage.h>
36#include <itkObject.h>
37
38#include <sstream>
39
54#define elxGetBaseMacro(_name, _elxbasetype) \
55 _elxbasetype * GetElx##_name##Base(const unsigned int idx = 0) const \
56 { \
57 if (idx < this->GetNumberOf##_name##s()) \
58 { \
59 return dynamic_cast<_elxbasetype *>(this->Get##_name##Container()->ElementAt(idx).GetPointer()); \
60 } \
61 return nullptr; \
62 }
63// end elxGetBaseMacro
64
65namespace elastix
66{
67
102template <class TFixedImage, class TMovingImage>
103class ITK_TEMPLATE_EXPORT ElastixTemplate final : public ElastixBase
104{
105public:
107
111 using Pointer = itk::SmartPointer<Self>;
112 using ConstPointer = itk::SmartPointer<const Self>;
113
115 itkNewMacro(Self);
116
119
121 using FixedImageType = TFixedImage;
122 using MovingImageType = TMovingImage;
123 using FixedImagePointer = typename FixedImageType::Pointer;
124 using MovingImagePointer = typename MovingImageType::Pointer;
125
127 itkStaticConstMacro(Dimension, unsigned int, FixedImageType::ImageDimension);
128 itkStaticConstMacro(FixedDimension, unsigned int, FixedImageType::ImageDimension);
129 itkStaticConstMacro(MovingDimension, unsigned int, MovingImageType::ImageDimension);
130
132 using MaskPixelType = unsigned char;
133 using FixedMaskType = itk::Image<MaskPixelType, FixedDimension>;
134 using MovingMaskType = itk::Image<MaskPixelType, MovingDimension>;
135 using FixedMaskPointer = typename FixedMaskType::Pointer;
136 using MovingMaskPointer = typename MovingMaskType::Pointer;
137
139 using FixedImageDirectionType = typename FixedImageType::DirectionType;
140
143
147
149 using BeforeEachResolutionCommandType = itk::SimpleMemberCommand<Self>;
150 using AfterEachResolutionCommandType = itk::SimpleMemberCommand<Self>;
151 using AfterEachIterationCommandType = itk::SimpleMemberCommand<Self>;
152 using BeforeEachResolutionCommandPointer = typename BeforeEachResolutionCommandType::Pointer;
153 using AfterEachResolutionCommandPointer = typename AfterEachResolutionCommandType::Pointer;
154 using AfterEachIterationCommandPointer = typename AfterEachIterationCommandType::Pointer;
155
167
174
177
191
197 GetFixedImage(unsigned int idx = 0) const;
198
200 GetMovingImage(unsigned int idx = 0) const;
201
207 GetFixedMask(unsigned int idx = 0) const;
208
210 GetMovingMask(unsigned int idx = 0) const;
211
216 int
217 Run() override;
218
219 int
220 ApplyTransform(bool doReadTransform) override;
221
223 int
224 BeforeAll() override;
225
226 int
228
229 void
231
232 void
234
235 void
237
238 void
240
241 void
243
245 itkGetConstMacro(IterationCounter, unsigned int);
246
248 itkGetStringMacro(CurrentTransformParameterFileName);
249
254 bool
256
257private:
258 ElastixTemplate() = default;
259 ~ElastixTemplate() override = default;
260
262 BeforeEachResolutionCommandPointer m_BeforeEachResolutionCommand{};
263 AfterEachIterationCommandPointer m_AfterEachIterationCommand{};
264 AfterEachResolutionCommandPointer m_AfterEachResolutionCommand{};
265
267 void
268 CreateTransformParameterFile(const std::string & FileName, const bool ToLog);
269
271 void
273
275 void
277
291 void
293
294 int
296
301 void
303
305 void
307};
308
309} // end namespace elastix
310
311#undef elxGetBaseMacro
312
313#ifndef ITK_MANUAL_INSTANTIATION
314# include "elxElastixTemplate.hxx"
315#endif
316
317#endif // end #ifndef elxElastixTemplate_h
The BaseComponent class is a class that all elastix components should inherit from.
This class creates an interface for elastix.
The main elastix class, which connects components and invokes the BeforeRegistration(),...
itkStaticConstMacro(MovingDimension, unsigned int, MovingImageType::ImageDimension)
typename AfterEachIterationCommandType::Pointer AfterEachIterationCommandPointer
int CallInEachComponentInt(PtrToMemberFunction2 func)
bool GetOriginalFixedImageDirection(FixedImageDirectionType &direction) const
int BeforeAll() override
elxGetBaseMacro(Optimizer, OptimizerBaseType)
void BeforeRegistration() override
typename MovingMaskType::Pointer MovingMaskPointer
typename MovingImageType::Pointer MovingImagePointer
itk::SmartPointer< Self > Pointer
typename FixedImageType::DirectionType FixedImageDirectionType
elxGetBaseMacro(Transform, TransformBaseType)
elxGetBaseMacro(Resampler, ResamplerBaseType)
void SetOriginalFixedImageDirection(const FixedImageDirectionType &arg)
void CallInEachComponent(PtrToMemberFunction func)
itk::SimpleMemberCommand< Self > BeforeEachResolutionCommandType
typename AfterEachResolutionCommandType::Pointer AfterEachResolutionCommandPointer
elxGetBaseMacro(Metric, MetricBaseType)
itk::Image< MaskPixelType, MovingDimension > MovingMaskType
~ElastixTemplate() override=default
itk::Image< MaskPixelType, FixedDimension > FixedMaskType
elxGetBaseMacro(FixedImagePyramid, FixedImagePyramidBaseType)
MovingMaskType * GetMovingMask(unsigned int idx=0) const
itkStaticConstMacro(FixedDimension, unsigned int, FixedImageType::ImageDimension)
typename FixedImageType::Pointer FixedImagePointer
void AfterEachIteration() override
itkStaticConstMacro(Dimension, unsigned int, FixedImageType::ImageDimension)
void CreateTransformParameterFile(const std::string &FileName, const bool ToLog)
void CreateTransformParametersMap() override
FixedMaskType * GetFixedMask(unsigned int idx=0) const
itk::SmartPointer< const Self > ConstPointer
ITK_DISALLOW_COPY_AND_MOVE(ElastixTemplate)
void(BaseComponentType::*)() PtrToMemberFunction
typename BeforeEachResolutionCommandType::Pointer BeforeEachResolutionCommandPointer
MovingImageType * GetMovingImage(unsigned int idx=0) const
void AfterEachResolution() override
elxGetBaseMacro(Registration, RegistrationBaseType)
typename FixedMaskType::Pointer FixedMaskPointer
itk::SimpleMemberCommand< Self > AfterEachIterationCommandType
void ConfigureComponents(Self *This)
elxGetBaseMacro(ResampleInterpolator, ResampleInterpolatorBaseType)
void AfterRegistration() override
itk::SimpleMemberCommand< Self > AfterEachResolutionCommandType
FixedImageType * GetFixedImage(unsigned int idx=0) const
int ApplyTransform(bool doReadTransform) override
itk::ParameterMapInterface::ParameterMapType ParameterMapType
elxGetBaseMacro(Interpolator, InterpolatorBaseType)
elxGetBaseMacro(ImageSampler, ImageSamplerBaseType)
void BeforeEachResolution() override
elxGetBaseMacro(MovingImagePyramid, MovingImagePyramidBaseType)
int(BaseComponentType::*)() PtrToMemberFunction2
This class is the elastix base class for all FixedImagePyramids.
This class is the elastix base class for all Interpolators.
This class is the elastix base class for all Metrics.
Definition: elxMetricBase.h:73
This class is the elastix base class for all MovingImagePyramids.
This class is the elastix base class for all Optimizers.
This class is the elastix base class for all Registration schemes.
This class is the elastix base class for all ResampleInterpolators.
This class is the elastix base class for all Transforms.
This class is a base class for any image sampler.
ParameterFileParser::ParameterMapType ParameterMapType


Generated on 2023-01-13 for elastix by doxygen 1.9.6 elastix logo