go home Home | Main Page | Topics | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
Loading...
Searching...
No Matches
itkSingleValuedPointSetToPointSetMetric.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/*=========================================================================
19
20 Program: Insight Segmentation & Registration Toolkit
21 Module: $RCSfile: itkSingleValuedPointSetToPointSetMetric.h,v $
22 Date: $Date: 2009-01-26 21:45:56 $
23 Version: $Revision: 1.2 $
24
25 Copyright (c) Insight Software Consortium. All rights reserved.
26 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
27
28 This software is distributed WITHOUT ANY WARRANTY; without even
29 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
30 PURPOSE. See the above copyright notices for more information.
31
32=========================================================================*/
33#ifndef itkSingleValuedPointSetToPointSetMetric_h
34#define itkSingleValuedPointSetToPointSetMetric_h
35
36#include "itkImageBase.h"
38#include "itkSingleValuedCostFunction.h"
39#include "itkMacro.h"
40#include "itkImageMaskSpatialObject.h"
41#include "itkPointSet.h"
42#include "itkDeref.h"
43
44namespace itk
45{
46
60
61template <typename TFixedPointSet, typename TMovingPointSet>
62class ITK_TEMPLATE_EXPORT SingleValuedPointSetToPointSetMetric : public SingleValuedCostFunction
63{
64public:
66
69 using Superclass = SingleValuedCostFunction;
70 using Pointer = SmartPointer<Self>;
71 using ConstPointer = SmartPointer<const Self>;
72
74 using CoordinateRepresentationType = Superclass::ParametersValueType;
75
78
80 using FixedPointSetType = TFixedPointSet;
81 using FixedPointSetConstPointer = typename FixedPointSetType::ConstPointer;
82 using MovingPointSetType = TMovingPointSet;
83 using MovingPointSetConstPointer = typename MovingPointSetType::ConstPointer;
84 using PointIterator = typename FixedPointSetType::PointsContainer::ConstIterator;
85
87 itkStaticConstMacro(FixedPointSetDimension, unsigned int, TFixedPointSet::PointDimension);
88 itkStaticConstMacro(MovingPointSetDimension, unsigned int, TMovingPointSet::PointDimension);
89
94 using InputPointType = typename TransformType::InputPointType;
95 using OutputPointType = typename TransformType::OutputPointType;
96 using TransformParametersType = typename TransformType::ParametersType;
97 using TransformJacobianType = typename TransformType::JacobianType;
98
99 using FixedImageMaskType = ImageMaskSpatialObject<Self::FixedPointSetDimension>;
100 using FixedImageMaskPointer = typename FixedImageMaskType::Pointer;
101 using FixedImageMaskConstPointer = typename FixedImageMaskType::ConstPointer;
102 using MovingImageMaskType = ImageMaskSpatialObject<Self::MovingPointSetDimension>;
103 using MovingImageMaskPointer = typename MovingImageMaskType::Pointer;
104 using MovingImageMaskConstPointer = typename MovingImageMaskType::ConstPointer;
105
107 using Superclass::MeasureType;
108 using Superclass::DerivativeType;
109 using DerivativeValueType = typename DerivativeType::ValueType;
110 using Superclass::ParametersType;
111
114
116 itkSetConstObjectMacro(FixedPointSet, FixedPointSetType);
117
119 itkGetConstObjectMacro(FixedPointSet, FixedPointSetType);
120
122 itkSetConstObjectMacro(MovingPointSet, MovingPointSetType);
123
125 itkGetConstObjectMacro(MovingPointSet, MovingPointSetType);
126
128 itkSetObjectMacro(Transform, TransformType);
129
131 itkGetConstObjectMacro(Transform, TransformType);
132
134 void
135 SetTransformParameters(const ParametersType & parameters) const;
136
138 unsigned int
139 GetNumberOfParameters() const override
140 {
141 return this->m_Transform->GetNumberOfParameters();
142 }
143
147 virtual void
149
151 // \todo: currently not used
152 itkSetConstObjectMacro(FixedImageMask, FixedImageMaskType);
153
155 itkGetConstObjectMacro(FixedImageMask, FixedImageMaskType);
156
158 itkSetConstObjectMacro(MovingImageMask, MovingImageMaskType);
159
161 itkGetConstObjectMacro(MovingImageMask, MovingImageMaskType);
162
164 virtual void
166
168 itkSetMacro(UseMetricSingleThreaded, bool);
169 itkGetConstReferenceMacro(UseMetricSingleThreaded, bool);
170 itkBooleanMacro(UseMetricSingleThreaded);
171
172protected:
175
177 void
178 PrintSelf(std::ostream & os, Indent indent) const override;
179
181 const auto &
183 {
184 // Sanity check.
185 if (!m_FixedPointSet)
186 {
187 itkExceptionMacro("Fixed point set has not been assigned");
188 }
189 return Deref(m_FixedPointSet->GetPoints()).CastToSTLConstContainer();
190 }
191
193 const auto &
195 {
196 // Sanity check.
197 if (!m_MovingPointSet)
198 {
199 itkExceptionMacro("Moving point set has not been assigned");
200 }
201 return Deref(m_MovingPointSet->GetPoints()).CastToSTLConstContainer();
202 }
203
209 mutable TransformPointer m_Transform{ nullptr };
210
211 mutable unsigned int m_NumberOfPointsCounted{ 0 };
212
215};
216
217} // end namespace itk
218
219#ifndef ITK_MANUAL_INSTANTIATION
220# include "itkSingleValuedPointSetToPointSetMetric.hxx"
221#endif
222
223#endif
Transform maps points, vectors and covariant vectors from an input space to an output space.
typename MovingImageMaskType::ConstPointer MovingImageMaskConstPointer
ITK_DISALLOW_COPY_AND_MOVE(SingleValuedPointSetToPointSetMetric)
itkStaticConstMacro(FixedPointSetDimension, unsigned int, TFixedPointSet::PointDimension)
typename TransformType::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
typename FixedImageMaskType::ConstPointer FixedImageMaskConstPointer
itkStaticConstMacro(MovingPointSetDimension, unsigned int, TMovingPointSet::PointDimension)
void PrintSelf(std::ostream &os, Indent indent) const override
typename MovingPointSetType::ConstPointer MovingPointSetConstPointer
typename FixedPointSetType::ConstPointer FixedPointSetConstPointer
~SingleValuedPointSetToPointSetMetric() override=default
ImageMaskSpatialObject< Self::MovingPointSetDimension > MovingImageMaskType
virtual void BeforeThreadedGetValueAndDerivative(const TransformParametersType &parameters) const
AdvancedTransform< CoordinateRepresentationType, Self::FixedPointSetDimension, Self::MovingPointSetDimension > TransformType
ImageMaskSpatialObject< Self::FixedPointSetDimension > FixedImageMaskType
typename FixedPointSetType::PointsContainer::ConstIterator PointIterator
void SetTransformParameters(const ParametersType &parameters) const
itkOverrideGetNameOfClassMacro(SingleValuedPointSetToPointSetMetric)


Generated on 1774142652 for elastix by doxygen 1.15.0 elastix logo