ITK  6.0.0
Insight Toolkit
itkObjectToObjectMetric.h
Go to the documentation of this file.
1/*=========================================================================
2 *
3 * Copyright NumFOCUS
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 * https://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 itkObjectToObjectMetric_h
19#define itkObjectToObjectMetric_h
20
21
23
25#include "itkImage.h"
26#include "itkObject.h"
27#include "itkPointSet.h"
28#include "itkTransform.h"
29
30namespace itk
31{
32
88template <unsigned int TFixedDimension,
89 unsigned int TMovingDimension,
90 typename TVirtualImage = Image<double, TFixedDimension>,
91 typename TParametersValueType = double>
92class ITK_TEMPLATE_EXPORT ObjectToObjectMetric : public ObjectToObjectMetricBaseTemplate<TParametersValueType>
93{
94public:
95 ITK_DISALLOW_COPY_AND_MOVE(ObjectToObjectMetric);
96
102
104 itkOverrideGetNameOfClassMacro(ObjectToObjectMetric);
105
107 using CoordinateRepresentationType = TParametersValueType;
108
110 using InternalComputationValueType = TParametersValueType;
111
113 using typename Superclass::MeasureType;
114
116 using ObjectType = typename Superclass::Object;
117
119 using typename Superclass::DerivativeType;
120 using typename Superclass::DerivativeValueType;
121
123 using typename Superclass::ParametersType;
124 using typename Superclass::NumberOfParametersType;
125
126 using typename Superclass::GradientSourceEnum;
127
130
132 static constexpr DimensionType FixedDimension = TFixedDimension;
133 static constexpr DimensionType MovingDimension = TMovingDimension;
134 static constexpr DimensionType VirtualDimension = TVirtualImage::ImageDimension;
135
137 using VirtualImageType = TVirtualImage;
140 using VirtualPixelType = typename VirtualImageType::PixelType;
143 using VirtualSpacingType = typename VirtualImageType::SpacingType;
149
153
157
162
167
172
176
177 void
178 Initialize() override;
179
181 GetNumberOfParameters() const override;
184 void
185 SetParameters(ParametersType & params) override;
186 const ParametersType &
187 GetParameters() const override;
188 bool
189 HasLocalSupport() const override;
190 void
191 UpdateTransformParameters(const DerivativeType & derivative, TParametersValueType factor) override;
192
194 itkSetObjectMacro(FixedTransform, FixedTransformType);
195
197 itkGetModifiableObjectMacro(FixedTransform, FixedTransformType);
198
200 itkSetObjectMacro(MovingTransform, MovingTransformType);
201
203 itkGetModifiableObjectMacro(MovingTransform, MovingTransformType);
204
207 void
209
211 const MovingTransformType *
213
216 itkGetConstMacro(NumberOfValidPoints, SizeValueType);
217
234 void
236 const VirtualOriginType & origin,
237 const VirtualDirectionType & direction,
238 const VirtualRegionType & region);
239
242 void
244
249 virtual bool
251
257 virtual const TimeStamp &
259
264
269
274
277 const VirtualRegionType &
279
280 itkGetModifiableObjectMacro(VirtualImage, VirtualImageType);
281
293 const NumberOfParametersType & numberOfLocalParameters) const;
294
306 const NumberOfParametersType & numberOfLocalParameters) const;
307
312 bool
314 bool
318 using MetricCategoryType = typename Superclass::MetricCategoryEnum;
319
322 GetMetricCategory() const override
323 {
324 return MetricCategoryType::OBJECT_METRIC;
325 }
326
327protected:
329 ~ObjectToObjectMetric() override = default;
330
331 void
332 PrintSelf(std::ostream & os, Indent indent) const override;
333
336 virtual void
338
339 bool
341 void
343
350
357 bool
359
361 FixedTransformPointer m_FixedTransform{};
362 MovingTransformPointer m_MovingTransform{};
363
364 VirtualImagePointer m_VirtualImage{};
365
368 bool m_UserHasSetVirtualDomain{};
369
373 mutable SizeValueType m_NumberOfValidPoints{ 0 };
374};
375} // end namespace itk
376
377#ifndef ITK_MANUAL_INSTANTIATION
378# include "itkObjectToObjectMetric.hxx"
379#endif
380
381#endif
Array2D class representing a 2D array.
Definition: itkArray2D.h:43
Provides local/dense/high-dimensionality transformation via a a displacement field.
Control indentation during Print() invocation.
Definition: itkIndent.h:50
Light weight base class for most itk classes.
Base class for all object-to-object similarity metrics added in ITKv4.
Computes similarity between regions of two objects.
VirtualDirectionType GetVirtualDirection() const
bool IsInsideVirtualDomain(const VirtualIndexType &index) const
typename VirtualImageType::ConstPointer VirtualImageConstPointer
typename VirtualRegionType::SizeType VirtualSizeType
void Initialize() override
const ParametersType & GetParameters() const override
typename MovingTransformType::OutputPointType MovingOutputPointType
typename VirtualImageType::DirectionType VirtualDirectionType
TParametersValueType CoordinateRepresentationType
typename VirtualImageType::IndexType VirtualIndexType
typename FixedTransformType::JacobianType JacobianType
typename MovingTransformType::ParametersType MovingTransformParametersType
typename Superclass::Object ObjectType
typename VirtualImageType::PointType VirtualOriginType
TParametersValueType InternalComputationValueType
MetricCategoryType GetMetricCategory() const override
void UpdateTransformParameters(const DerivativeType &derivative, TParametersValueType factor) override
typename MovingTransformType::Pointer MovingTransformPointer
typename MovingTransformType::JacobianType MovingTransformJacobianType
bool VerifyNumberOfValidPoints(MeasureType &value, DerivativeType &derivative) const
typename FixedTransformType::OutputPointType FixedOutputPointType
void SetParameters(ParametersType &params) override
const MovingTransformType * GetTransform()
const MovingDisplacementFieldTransformType * GetMovingDisplacementFieldTransform() const
void PrintSelf(std::ostream &os, Indent indent) const override
typename VirtualImageType::PixelType VirtualPixelType
virtual bool SupportsArbitraryVirtualDomainSamples() const =0
typename FixedTransformType::ParametersType FixedTransformParametersType
OffsetValueType ComputeParameterOffsetFromVirtualIndex(const VirtualIndexType &index, const NumberOfParametersType &numberOfLocalParameters) const
typename MovingTransformType::InputPointType MovingInputPointType
const VirtualRegionType & GetVirtualRegion() const
typename VirtualImageType::Pointer VirtualImagePointer
void SetVirtualDomainFromImage(const VirtualImageType *virtualImage)
typename VirtualPointSetType::Pointer VirtualPointSetPointer
void SetVirtualDomain(const VirtualSpacingType &spacing, const VirtualOriginType &origin, const VirtualDirectionType &direction, const VirtualRegionType &region)
typename FixedTransformType::InputPointType FixedInputPointType
typename VirtualImageType::PointType VirtualPointType
typename Superclass::MetricCategoryEnum MetricCategoryType
VirtualOriginType GetVirtualOrigin() const
virtual const TimeStamp & GetVirtualDomainTimeStamp() const
void SetTransform(MovingTransformType *transform)
typename FixedTransformType::Pointer FixedTransformPointer
NumberOfParametersType GetNumberOfLocalParameters() const override
bool HasLocalSupport() const override
typename VirtualImageType::RegionType VirtualRegionType
typename VirtualImageType::SizeType VirtualRadiusType
bool IsInsideVirtualDomain(const VirtualPointType &point) const
virtual void VerifyDisplacementFieldSizeAndPhysicalSpace()
typename VirtualImageType::SpacingType VirtualSpacingType
typename FixedTransformType::JacobianType FixedTransformJacobianType
OffsetValueType ComputeParameterOffsetFromVirtualPoint(const VirtualPointType &point, const NumberOfParametersType &numberOfLocalParameters) const
bool TransformPhysicalPointToVirtualIndex(const VirtualPointType &, VirtualIndexType &) const
void TransformVirtualIndexToPhysicalPoint(const VirtualIndexType &, VirtualPointType &) const
~ObjectToObjectMetric() override=default
VirtualSpacingType GetVirtualSpacing() const
NumberOfParametersType GetNumberOfParameters() const override
Class to hold and manage different parameter types used during optimization.
A superclass of the N-dimensional mesh structure; supports point (geometric coordinate and attribute)...
Definition: itkPointSet.h:82
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:54
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:61
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:84
SmartPointer< const Self > ConstPointer
SmartPointer< Self > Pointer
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
*par Constraints *The filter image with at least two dimensions and a vector *length of at least The theory supports extension to scalar but *the implementation of the itk vector classes do not **The template parameter TRealType must be floating point(float or double) or *a user-defined "real" numerical type with arithmetic operations defined *sufficient to compute derivatives. **\par Performance *This filter will automatically multithread if run with *SetUsePrincipleComponents
unsigned long SizeValueType
Definition: itkIntTypes.h:86
long OffsetValueType
Definition: itkIntTypes.h:97