go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkMultiInputImageToImageMetricBase.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 itkMultiInputImageToImageMetricBase_h
19#define itkMultiInputImageToImageMetricBase_h
20
22#include <vector>
23
25#define itkSetNumberOfMacro(name) \
26 virtual void SetNumberOf##name##s(const unsigned int _arg) \
27 { \
28 if (this->m_NumberOf##name##s != _arg) \
29 { \
30 this->m_##name##Vector.resize(_arg); \
31 this->m_NumberOf##name##s = _arg; \
32 this->Modified(); \
33 } \
34 } // comments for allowing ; after calling the macro
35
36namespace itk
37{
38
48template <class TFixedImage, class TMovingImage>
49class ITK_TEMPLATE_EXPORT MultiInputImageToImageMetricBase
50 : public AdvancedImageToImageMetric<TFixedImage, TMovingImage>
51{
52public:
54
58 using Pointer = SmartPointer<Self>;
59 using ConstPointer = SmartPointer<const Self>;
60
63
65 itkStaticConstMacro(MovingImageDimension, unsigned int, TMovingImage::ImageDimension);
66 itkStaticConstMacro(FixedImageDimension, unsigned int, TFixedImage::ImageDimension);
67
69 using typename Superclass::CoordinateRepresentationType;
70 using typename Superclass::MovingImageType;
71 using typename Superclass::MovingImagePixelType;
72 using typename Superclass::MovingImagePointer;
73 using typename Superclass::MovingImageConstPointer;
74 using typename Superclass::FixedImageType;
75 using typename Superclass::FixedImagePointer;
76 using typename Superclass::FixedImageConstPointer;
77 using typename Superclass::FixedImageRegionType;
78 using typename Superclass::TransformType;
79 using typename Superclass::TransformPointer;
80 using typename Superclass::InputPointType;
81 using typename Superclass::OutputPointType;
82 using typename Superclass::TransformParametersType;
83 using typename Superclass::TransformJacobianType;
84 using typename Superclass::InterpolatorType;
85 using typename Superclass::InterpolatorPointer;
86 using typename Superclass::RealType;
87 using typename Superclass::GradientPixelType;
88 using typename Superclass::GradientImageType;
89 using typename Superclass::GradientImagePointer;
90 using typename Superclass::GradientImageFilterType;
91 using typename Superclass::GradientImageFilterPointer;
92 using typename Superclass::FixedImageMaskType;
93 using typename Superclass::FixedImageMaskPointer;
94 using typename Superclass::MovingImageMaskType;
95 using typename Superclass::MovingImageMaskPointer;
96 using typename Superclass::MeasureType;
97 using typename Superclass::DerivativeType;
98 using typename Superclass::ParametersType;
99
100 using FixedImageInterpolatorType = InterpolateImageFunction<FixedImageType, CoordinateRepresentationType>;
101 using FixedImageInterpolatorPointer = typename FixedImageInterpolatorType::Pointer;
102
104 using FixedImageVectorType = std::vector<FixedImageConstPointer>;
105 using FixedImageMaskVectorType = std::vector<FixedImageMaskPointer>;
106 using FixedImageRegionVectorType = std::vector<FixedImageRegionType>;
107 using MovingImageVectorType = std::vector<MovingImageConstPointer>;
108 using MovingImageMaskVectorType = std::vector<MovingImageMaskPointer>;
109 using InterpolatorVectorType = std::vector<InterpolatorPointer>;
110 using FixedImageInterpolatorVectorType = std::vector<FixedImageInterpolatorPointer>;
111
115 virtual void
116 SetFixedImage(const FixedImageType * _arg, unsigned int pos);
117
119 void
120 SetFixedImage(const FixedImageType * _arg) override
121 {
122 this->SetFixedImage(_arg, 0);
123 }
124
125
127 virtual const FixedImageType *
128 GetFixedImage(unsigned int pos) const;
129
131 const FixedImageType *
132 GetFixedImage() const override
133 {
134 return this->GetFixedImage(0);
142 itkGetConstMacro(NumberOfFixedImages, unsigned int);
143
147 virtual void
148 SetFixedImageMask(FixedImageMaskType * _arg, unsigned int pos);
149
151 void
152 SetFixedImageMask(FixedImageMaskType * _arg) override
153 {
154 this->SetFixedImageMask(_arg, 0);
155 }
156
157
159 virtual FixedImageMaskType *
160 GetFixedImageMask(unsigned int pos) const;
161
163 FixedImageMaskType *
164 GetFixedImageMask() const override
165 {
166 return this->GetFixedImageMask(0);
167 }
168
169
171 itkSetNumberOfMacro(FixedImageMask);
172
174 itkGetConstMacro(NumberOfFixedImageMasks, unsigned int);
175
179 virtual void
180 SetFixedImageRegion(const FixedImageRegionType _arg, unsigned int pos);
181
183 void
184 SetFixedImageRegion(const FixedImageRegionType _arg) override
185 {
186 this->SetFixedImageRegion(_arg, 0);
187 }
188
189
191 virtual const FixedImageRegionType &
192 GetFixedImageRegion(unsigned int pos) const;
193
195 const FixedImageRegionType &
196 GetFixedImageRegion() const override
197 {
198 return this->GetFixedImageRegion(0);
199 }
200
201
203 itkSetNumberOfMacro(FixedImageRegion);
204
206 itkGetConstMacro(NumberOfFixedImageRegions, unsigned int);
207
211 virtual void
212 SetMovingImage(const MovingImageType * _arg, unsigned int pos);
213
215 void
216 SetMovingImage(const MovingImageType * _arg) override
217 {
218 this->SetMovingImage(_arg, 0);
219 }
220
221
223 virtual const MovingImageType *
224 GetMovingImage(unsigned int pos) const;
225
227 const MovingImageType *
228 GetMovingImage() const override
229 {
230 return this->GetMovingImage(0);
231 }
232
233
236
238 itkGetConstMacro(NumberOfMovingImages, unsigned int);
239
243 virtual void
244 SetMovingImageMask(MovingImageMaskType * _arg, unsigned int pos);
245
247 void
248 SetMovingImageMask(MovingImageMaskType * _arg) override
249 {
250 this->SetMovingImageMask(_arg, 0);
251 }
252
253
255 virtual MovingImageMaskType *
256 GetMovingImageMask(unsigned int pos) const;
257
259 MovingImageMaskType *
260 GetMovingImageMask() const override
261 {
262 return this->GetMovingImageMask(0);
263 }
264
265
267 itkSetNumberOfMacro(MovingImageMask);
268
270 itkGetConstMacro(NumberOfMovingImageMasks, unsigned int);
271
277 virtual void
278 SetInterpolator(InterpolatorType * _arg, unsigned int pos);
279
281 void
282 SetInterpolator(InterpolatorType * _arg) override
283 {
284 return this->SetInterpolator(_arg, 0);
285 }
286
287
289 virtual InterpolatorType *
290 GetInterpolator(unsigned int pos) const;
291
293 InterpolatorType *
294 GetInterpolator() const override
295 {
296 return this->GetInterpolator(0);
297 }
298
299
301 itkSetNumberOfMacro(Interpolator);
302
304 itkGetConstMacro(NumberOfInterpolators, unsigned int);
305
307 itkGetConstMacro(InterpolatorsAreBSpline, bool);
308
314 virtual void
316
318 virtual void
320 {
321 return this->SetFixedImageInterpolator(_arg, 0);
322 }
323
324
326 virtual FixedImageInterpolatorType *
327 GetFixedImageInterpolator(unsigned int pos) const;
328
332 {
333 return this->GetFixedImageInterpolator(0);
334 }
335
336
338 itkSetNumberOfMacro(FixedImageInterpolator);
339
341 itkGetConstMacro(NumberOfFixedImageInterpolators, unsigned int);
342
346 void
347 Initialize() override;
348
349protected:
352
355
361
364 using BSplineInterpolatorPointer = typename BSplineInterpolatorType::Pointer;
365 using BSplineInterpolatorVectorType = std::vector<BSplineInterpolatorPointer>;
366
368 void
370
374 virtual void
376
380 bool
382 RealType & movingImageValue,
383 MovingImageDerivativeType * gradient) const override;
384
386 bool
387 IsInsideMovingMask(const MovingImagePointType & mappedPoint) const override;
388
397
398 bool m_InterpolatorsAreBSpline{ false };
400
401private:
406 void
408
410 FixedImageRegionType m_DummyFixedImageRegion;
411
412 unsigned int m_NumberOfFixedImages{ 0 };
413 unsigned int m_NumberOfFixedImageMasks{ 0 };
414 unsigned int m_NumberOfFixedImageRegions{ 0 };
415 unsigned int m_NumberOfMovingImages{ 0 };
416 unsigned int m_NumberOfMovingImageMasks{ 0 };
417 unsigned int m_NumberOfInterpolators{ 0 };
418 unsigned int m_NumberOfFixedImageInterpolators{ 0 };
419};
420
421} // end namespace itk
422
423#undef itkSetNumberOfMacro
424
425#ifndef ITK_MANUAL_INSTANTIATION
426# include "itkMultiInputImageToImageMetricBase.hxx"
427#endif
428
429#endif // end #ifndef itkMultiInputImageToImageMetricBase_h
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics.
typename TransformType::OutputPointType MovingImagePointType
typename MovingImageType::IndexType MovingImageIndexType
typename MovingImageType::Pointer MovingImagePointer
BSplineInterpolateImageFunction< MovingImageType, CoordinateRepresentationType, double > BSplineInterpolatorType
typename FixedImageType::Pointer FixedImagePointer
typename BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
typename InterpolatorType::ContinuousIndexType MovingImageContinuousIndexType
Implements a metric base class that takes multiple inputs.
FixedImageInterpolatorVectorType m_FixedImageInterpolatorVector
const FixedImageType * GetFixedImage() const override
typename TransformType::OutputPointType MovingImagePointType
void SetFixedImageMask(FixedImageMaskType *_arg) override
std::vector< MovingImageConstPointer > MovingImageVectorType
typename FixedImageInterpolatorType::Pointer FixedImageInterpolatorPointer
ITK_DISALLOW_COPY_AND_MOVE(MultiInputImageToImageMetricBase)
virtual void SetFixedImageRegion(const FixedImageRegionType _arg, unsigned int pos)
void SetMovingImage(const MovingImageType *_arg) override
const FixedImageRegionType & GetFixedImageRegion() const override
virtual MovingImageMaskType * GetMovingImageMask(unsigned int pos) const
std::vector< BSplineInterpolatorPointer > BSplineInterpolatorVectorType
virtual const FixedImageRegionType & GetFixedImageRegion(unsigned int pos) const
virtual void SetFixedImageMask(FixedImageMaskType *_arg, unsigned int pos)
void SetMovingImageMask(MovingImageMaskType *_arg) override
std::vector< FixedImageInterpolatorPointer > FixedImageInterpolatorVectorType
virtual InterpolatorType * GetInterpolator(unsigned int pos) const
bool EvaluateMovingImageValueAndDerivative(const MovingImagePointType &mappedPoint, RealType &movingImageValue, MovingImageDerivativeType *gradient) const override
void SetInterpolator(InterpolatorType *_arg) override
std::vector< InterpolatorPointer > InterpolatorVectorType
virtual const MovingImageType * GetMovingImage(unsigned int pos) const
const MovingImageType * GetMovingImage() const override
virtual const FixedImageType * GetFixedImage(unsigned int pos) const
~MultiInputImageToImageMetricBase() override=default
void SetFixedImage(const FixedImageType *_arg) override
virtual void SetFixedImageInterpolator(FixedImageInterpolatorType *_arg, unsigned int pos)
FixedImageMaskType * GetFixedImageMask() const override
virtual void SetMovingImage(const MovingImageType *_arg, unsigned int pos)
MovingImageMaskType * GetMovingImageMask() const override
virtual FixedImageInterpolatorType * GetFixedImageInterpolator(unsigned int pos) const
InterpolateImageFunction< FixedImageType, CoordinateRepresentationType > FixedImageInterpolatorType
std::vector< MovingImageMaskPointer > MovingImageMaskVectorType
typename BSplineInterpolatorType::CovariantVectorType MovingImageDerivativeType
itkStaticConstMacro(MovingImageDimension, unsigned int, TMovingImage::ImageDimension)
std::vector< FixedImageConstPointer > FixedImageVectorType
void SetFixedImageRegion(const FixedImageRegionType _arg) override
itkSetNumberOfMacro(FixedImageInterpolator)
std::vector< FixedImageMaskPointer > FixedImageMaskVectorType
virtual FixedImageMaskType * GetFixedImageMask(unsigned int pos) const
itkStaticConstMacro(FixedImageDimension, unsigned int, TFixedImage::ImageDimension)
virtual FixedImageInterpolatorType * GetFixedImageInterpolator() const
bool IsInsideMovingMask(const MovingImagePointType &mappedPoint) const override
virtual void SetInterpolator(InterpolatorType *_arg, unsigned int pos)
virtual void SetFixedImageInterpolator(FixedImageInterpolatorType *_arg)
virtual void SetMovingImageMask(MovingImageMaskType *_arg, unsigned int pos)
std::vector< FixedImageRegionType > FixedImageRegionVectorType
typename BSplineInterpolatorType::Pointer BSplineInterpolatorPointer
void FastEvaluateMovingImageValueAndDerivative(...) const =delete
virtual void SetFixedImage(const FixedImageType *_arg, unsigned int pos)
#define itkSetNumberOfMacro(name)


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