go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxMetricBase.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 elxMetricBase_h
19#define elxMetricBase_h
20
22#include "elxMacro.h"
23
24#include "elxBaseComponentSE.h"
26#include "itkImageGridSampler.h"
27#include "itkPointSet.h"
28
29namespace elastix
30{
31
71template <class TElastix>
72class ITK_TEMPLATE_EXPORT MetricBase : public BaseComponentSE<TElastix>
73{
74public:
76
80
83
85 using typename Superclass::ElastixType;
86 using typename Superclass::RegistrationType;
87
89 using FixedImageType = typename ElastixType::FixedImageType;
90 using FixedPointType = typename FixedImageType::PointType;
91 using FixedPointValueType = typename FixedPointType::ValueType;
92 using MovingImageType = typename ElastixType::MovingImageType;
93 using MovingPointType = typename MovingImageType::PointType;
94 using MovingPointValueType = typename MovingPointType::ValueType;
95
97 using ITKBaseType = itk::SingleValuedCostFunction;
100
102 itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension);
104 itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension);
105
107 using CoordinateRepresentationType = typename ITKBaseType::ParametersValueType;
109 FixedImageDimension,
110 itk::DefaultStaticMeshTraits<CoordinateRepresentationType,
111 FixedImageDimension,
112 FixedImageDimension,
117 MovingImageDimension,
118 itk::DefaultStaticMeshTraits<CoordinateRepresentationType,
119 MovingImageDimension,
120 MovingImageDimension,
124
127
129 using MeasureType = typename ITKBaseType::MeasureType;
130
134 {
135 return &(this->GetSelf());
136 }
137
138
140 const ITKBaseType *
142 {
143 return &(this->GetSelf());
144 }
145
146
151 void
153
157 void
159
163 virtual void
165
169 virtual bool
171
176 virtual void
178
183 virtual ImageSamplerBaseType *
185
187 virtual bool
189 {
190 return this->m_ShowExactMetricValue;
191 }
192
194 virtual MeasureType
196 {
197 return this->m_CurrentExactMetricValue;
198 }
199
200protected:
202 using ParametersType = typename ITKBaseType::ParametersType;
203
208
210 MetricBase() = default;
212 ~MetricBase() override = default;
213
223 virtual MeasureType
224 GetExactValue(const ParametersType & parameters);
225
228 bool m_ShowExactMetricValue{ false };
229 ExactMetricImageSamplerPointer m_ExactMetricSampler{ nullptr };
230 MeasureType m_CurrentExactMetricValue{ 0.0 };
231 ExactMetricSampleGridSpacingType m_ExactMetricSampleGridSpacing{ itk::MakeFilled<ExactMetricSampleGridSpacingType>(
232 1) };
233 unsigned int m_ExactMetricEachXNumberOfIterations{ 1 };
234
235private:
237};
238
239} // end namespace elastix
240
241#ifndef ITK_MANUAL_INSTANTIATION
242# include "elxMetricBase.hxx"
243#endif
244
245#endif // end #ifndef elxMetricBase_h
The BaseComponentSE class is a base class for elastix components that provides some basic functionali...
typename ElastixType::RegistrationBaseType RegistrationType
This class is the elastix base class for all Metrics.
virtual bool GetShowExactMetricValue() const
itkStaticConstMacro(FixedImageDimension, unsigned int, FixedImageType::ImageDimension)
itk::PointSet< CoordinateRepresentationType, MovingImageDimension, itk::DefaultStaticMeshTraits< CoordinateRepresentationType, MovingImageDimension, MovingImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > MovingPointSetType
typename FixedImageType::PointType FixedPointType
typename FixedPointType::ValueType FixedPointValueType
void AfterEachIterationBase() override
itk::PointSet< CoordinateRepresentationType, FixedImageDimension, itk::DefaultStaticMeshTraits< CoordinateRepresentationType, FixedImageDimension, FixedImageDimension, CoordinateRepresentationType, CoordinateRepresentationType, CoordinateRepresentationType > > FixedPointSetType
virtual void SelectNewSamples()
virtual void SetAdvancedMetricImageSampler(ImageSamplerBaseType *sampler)
virtual bool GetAdvancedMetricUseImageSampler() const
itk::SingleValuedCostFunction ITKBaseType
typename ExactMetricImageSamplerType::SampleGridSpacingType ExactMetricSampleGridSpacingType
typename ElastixType::FixedImageType FixedImageType
typename AdvancedMetricType::ImageSamplerType ImageSamplerBaseType
virtual ImageSamplerBaseType * GetAdvancedMetricImageSampler() const
ITKBaseType * GetAsITKBaseType()
~MetricBase() override=default
virtual MeasureType GetExactValue(const ParametersType &parameters)
ITK_DISALLOW_COPY_AND_MOVE(MetricBase)
elxDeclarePureVirtualGetSelfMacro(ITKBaseType)
virtual MeasureType GetCurrentExactMetricValue() const
const ITKBaseType * GetAsITKBaseType() const
typename ElastixType::MovingImageType MovingImageType
void BeforeEachResolutionBase() override
typename AdvancedMetricType::MovingImageDerivativeScalesType MovingImageDerivativeScalesType
typename MovingImageType::PointType MovingPointType
typename ITKBaseType::ParametersValueType CoordinateRepresentationType
itkStaticConstMacro(MovingImageDimension, unsigned int, MovingImageType::ImageDimension)
typename MovingPointType::ValueType MovingPointValueType
typename ITKBaseType::ParametersType ParametersType
typename ExactMetricImageSamplerType::Pointer ExactMetricImageSamplerPointer
typename ITKBaseType::MeasureType MeasureType
An extension of the ITK ImageToImageMetric. It is the intended base class for all elastix metrics.
Samples image voxels on a regular grid.
typename InputImageType::OffsetType SampleGridSpacingType
This class is a base class for any image sampler.


Generated on 2024-07-17 for elastix by doxygen 1.11.0 (9b424b03c9833626cd435af22a444888fbbb192d) elastix logo