go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
elxAdvancedTransformAdapter.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 itkAdvancedTransformAdapter_h
19#define itkAdvancedTransformAdapter_h
20
22#include "itkMacro.h"
23#include <itkDeref.h>
24
25
26namespace elastix
27{
28
37template <class TScalarType, unsigned int NDimensions>
38class ITK_TEMPLATE_EXPORT AdvancedTransformAdapter
39 : public itk::AdvancedTransform<TScalarType, NDimensions, NDimensions>
40{
41public:
43
47 using Pointer = itk::SmartPointer<Self>;
48 using ConstPointer = itk::SmartPointer<const Self>;
49
51 itkNewMacro(Self);
52
55
57 itkStaticConstMacro(InputSpaceDimension, unsigned int, Superclass::InputSpaceDimension);
58 itkStaticConstMacro(OutputSpaceDimension, unsigned int, Superclass::OutputSpaceDimension);
59
61 using typename Superclass::ParametersType;
62 using typename Superclass::JacobianType;
63 using typename Superclass::InputVectorType;
64 using typename Superclass::OutputVectorType;
65 using typename Superclass::InputCovariantVectorType;
66 using typename Superclass::OutputCovariantVectorType;
67 using typename Superclass::InputVnlVectorType;
68 using typename Superclass::OutputVnlVectorType;
69 using typename Superclass::InputPointType;
70 using typename Superclass::OutputPointType;
72 using typename Superclass::SpatialHessianType;
76
78 void
79 SetParameters(const ParametersType & parameters) override
80 {
81 // SetParameters may be called by elx::TransformBase<TElastix>::ReadFromFile(), but only for an empty list of
82 // parameters _and_ an unspecified (null) m_ExternalTransform.
83 if (m_ExternalTransform || !parameters.empty())
84 {
85 itkExceptionMacro("The parameters of an external transform cannot be set! Only the trivial case of setting an "
86 "empty parameters to an unspecified (null) external transform is supported!");
87 }
88 }
89
91 void
92 SetFixedParameters(const ParametersType &) override
93 {
94 itkExceptionMacro(<< unimplementedOverrideMessage);
95 }
96
98 const ParametersType &
99 GetFixedParameters() const override
100 {
101 return itk::Deref(m_ExternalTransform.GetPointer()).GetFixedParameters();
102 }
103
105 OutputPointType
106 TransformPoint(const InputPointType & point) const override
107 {
108 return itk::Deref(m_ExternalTransform.GetPointer()).TransformPoint(point);
109 }
110
112 OutputVectorType
113 TransformVector(const InputVectorType &) const override
114 {
115 itkExceptionMacro(<< unimplementedOverrideMessage);
116 }
117
118 OutputVnlVectorType
119 TransformVector(const InputVnlVectorType &) const override
120 {
121 itkExceptionMacro(<< unimplementedOverrideMessage);
122 }
123
124 OutputCovariantVectorType
125 TransformCovariantVector(const InputCovariantVectorType &) const override
126 {
127 itkExceptionMacro(<< unimplementedOverrideMessage);
128 }
129
130 bool
131 IsLinear() const override
132 {
133 return itk::Deref(m_ExternalTransform.GetPointer()).IsLinear();
134 }
135
137 void
138 GetJacobian(const InputPointType &, JacobianType &, NonZeroJacobianIndicesType &) const override
139 {
140 itkExceptionMacro(<< unimplementedOverrideMessage);
141 }
142
143 void
144 GetSpatialJacobian(const InputPointType &, SpatialJacobianType &) const override
145 {
146 itkExceptionMacro(<< unimplementedOverrideMessage);
147 }
148
149 void
150 GetSpatialHessian(const InputPointType &, SpatialHessianType &) const override
151 {
152 itkExceptionMacro(<< unimplementedOverrideMessage);
153 }
154
155 void
156 GetJacobianOfSpatialJacobian(const InputPointType &,
158 NonZeroJacobianIndicesType &) const override
159 {
160 itkExceptionMacro(<< unimplementedOverrideMessage);
161 }
162
163 void
164 GetJacobianOfSpatialJacobian(const InputPointType &,
167 NonZeroJacobianIndicesType &) const override
168 {
169 itkExceptionMacro(<< unimplementedOverrideMessage);
170 }
171
172 void
173 GetJacobianOfSpatialHessian(const InputPointType &,
175 NonZeroJacobianIndicesType &) const override
176 {
177 itkExceptionMacro(<< unimplementedOverrideMessage);
178 }
179
180 void
181 GetJacobianOfSpatialHessian(const InputPointType &,
184 NonZeroJacobianIndicesType &) const override
185 {
186 itkExceptionMacro(<< unimplementedOverrideMessage);
187 }
188
189 using typename Superclass::TransformType;
190 itkSetObjectMacro(ExternalTransform, TransformType);
191
195 {
196 return m_ExternalTransform.GetPointer();
197 }
198
199protected:
202
204 ~AdvancedTransformAdapter() override = default;
205
207 void
208 PrintSelf(std::ostream & os, itk::Indent indent) const override
209 {
210 Superclass::PrintSelf(os, indent);
211
212 os << indent << "ExternalTransform: ";
213
214 if (m_ExternalTransform)
215 {
216 os << *m_ExternalTransform << std::endl;
217 }
218 else
219 {
220 os << indent << "null" << std::endl;
221 }
222 }
223
224private:
225 // Private using-declarations, to avoid `-Woverloaded-virtual` warnings from GCC (GCC 11.4).
226 using Superclass::TransformCovariantVector;
227 using Superclass::TransformVector;
228
229 static constexpr const char * unimplementedOverrideMessage = "Not implemented for AdvancedTransformAdapter";
230
231 itk::SmartPointer<TransformType> m_ExternalTransform{};
232};
233
234} // namespace elastix
235
236
237#endif /* itkAdvancedTransformAdapter_h */
Adapts the ITK transform that is specified by AdvancedTransformAdapter::SetExternalTransform to the e...
void PrintSelf(std::ostream &os, itk::Indent indent) const override
void GetJacobianOfSpatialHessian(const InputPointType &, JacobianOfSpatialHessianType &, NonZeroJacobianIndicesType &) const override
itk::SmartPointer< const Self > ConstPointer
void GetJacobianOfSpatialJacobian(const InputPointType &, SpatialJacobianType &, JacobianOfSpatialJacobianType &, NonZeroJacobianIndicesType &) const override
void GetSpatialJacobian(const InputPointType &, SpatialJacobianType &) const override
void SetParameters(const ParametersType &parameters) override
void GetJacobian(const InputPointType &, JacobianType &, NonZeroJacobianIndicesType &) const override
OutputPointType TransformPoint(const InputPointType &point) const override
void SetFixedParameters(const ParametersType &) override
ITK_DISALLOW_COPY_AND_MOVE(AdvancedTransformAdapter)
itkStaticConstMacro(InputSpaceDimension, unsigned int, Superclass::InputSpaceDimension)
OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override
void GetSpatialHessian(const InputPointType &, SpatialHessianType &) const override
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
const ParametersType & GetFixedParameters() const override
itkStaticConstMacro(OutputSpaceDimension, unsigned int, Superclass::OutputSpaceDimension)
OutputVectorType TransformVector(const InputVectorType &) const override
void GetJacobianOfSpatialHessian(const InputPointType &, SpatialHessianType &, JacobianOfSpatialHessianType &, NonZeroJacobianIndicesType &) const override
void GetJacobianOfSpatialJacobian(const InputPointType &, JacobianOfSpatialJacobianType &, NonZeroJacobianIndicesType &) const override
~AdvancedTransformAdapter() override=default
Transform maps points, vectors and covariant vectors from an input space to an output space.
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
Transform< TScalarType, NInputDimensions, NOutputDimensions > TransformType


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