Orfeo Toolbox  4.2
itkKernelTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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 __itkKernelTransform_h
19 #define __itkKernelTransform_h
20 
21 #include "itkTransform.h"
22 #include "itkMatrix.h"
23 #include "itkPointSet.h"
24 #include <deque>
25 #include <cmath>
26 #include "vnl/vnl_matrix_fixed.h"
27 #include "vnl/vnl_matrix.h"
28 #include "vnl/vnl_vector.h"
29 #include "vnl/vnl_vector_fixed.h"
30 #include "vnl/algo/vnl_svd.h"
31 #include "vnl/vnl_sample.h"
32 
33 namespace itk
34 {
60 template< typename TScalar, // probably only float and double make sense here
61  unsigned int NDimensions >
62 // Number of dimensions
64  public Transform< TScalar, NDimensions, NDimensions >
65 {
66 public:
72 
74  itkTypeMacro(KernelTransform, Transform);
75 
77  itkNewMacro(Self);
78 
80  itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions);
81 
84 
87 
90 
93 
97 
101 
105 
109 
114 
120 
124 
126  itkGetModifiableObjectMacro(SourceLandmarks, PointSetType); //NOTE: This is used to circumvent the SetTargetLandmarks
127  virtual void SetSourceLandmarks(PointSetType *);
128 
130  itkGetModifiableObjectMacro(TargetLandmarks, PointSetType); //NOTE: This is used to circumvent the SetTargetLandmarks
131  virtual void SetTargetLandmarks(PointSetType *);
132 
136 
138  void ComputeWMatrix(void);
139 
141  virtual OutputPointType TransformPoint(const InputPointType & thisPoint) const;
142 
146  { \
147  itkExceptionMacro( \
148  << "TransformVector(const InputVectorType &) is not implemented for KernelTransform"); \
149  }
150 
152  { \
153  itkExceptionMacro( \
154  << "TransformVector(const InputVnlVectorType &) is not implemented for KernelTransform"); \
155  }
156 
160  { \
161  itkExceptionMacro( \
162  << "TransformCovariantVector(const InputCovariantVectorType &) is not implemented for KernelTransform"); \
163  }
164 
166  typedef vnl_matrix_fixed<TScalar, NDimensions, NDimensions> IMatrixType;
167 
169  virtual void ComputeJacobianWithRespectToParameters( const InputPointType & p, JacobianType & jacobian) const;
170 
172  JacobianType &) const \
173  { \
174  itkExceptionMacro( "ComputeJacobianWithRespectToPosition not yet implemented " \
175  "for " << this->GetNameOfClass() ); \
176  }
177 
182  virtual void SetParameters(const ParametersType &);
183 
189  virtual void SetFixedParameters(const ParametersType &);
190 
192  virtual void UpdateParameters(void) const;
193 
195  virtual const ParametersType & GetParameters(void) const;
196 
198  virtual const ParametersType & GetFixedParameters(void) const;
199 
204  {
205  return Self::Spline;
206  }
207 
218  itkSetClampMacro( Stiffness, double, 0.0, NumericTraits<double>::max() );
219  itkGetConstMacro(Stiffness, double);
220 
221 protected:
222  KernelTransform();
223  virtual ~KernelTransform();
224  void PrintSelf(std::ostream & os, Indent indent) const;
225 
226 public:
228  typedef vnl_matrix_fixed<TScalar, NDimensions, NDimensions> GMatrixType;
229 
231  typedef vnl_matrix<TScalar> LMatrixType;
232 
234  typedef vnl_matrix<TScalar> KMatrixType;
235 
237  typedef vnl_matrix<TScalar> PMatrixType;
238 
240  typedef vnl_matrix<TScalar> YMatrixType;
241 
243  typedef vnl_matrix<TScalar> WMatrixType;
244 
246  typedef vnl_matrix<TScalar> DMatrixType;
247 
249  typedef vnl_matrix_fixed<TScalar, NDimensions, NDimensions> AMatrixType;
250 
252  typedef vnl_vector_fixed<TScalar, NDimensions> BMatrixType;
253 
255  typedef vnl_matrix_fixed<TScalar, 1, NDimensions> RowMatrixType;
256 
258  typedef vnl_matrix_fixed<TScalar, NDimensions, 1> ColumnMatrixType;
259 
260 protected:
267  virtual void ComputeG(const InputVectorType & landmarkVector, GMatrixType & gmatrix) const;
268 
278  virtual const GMatrixType & ComputeReflexiveG(PointsIterator) const;
279 
282  virtual void ComputeDeformationContribution(const InputPointType & inputPoint, OutputPointType & result) const;
283 
285  void ComputeK();
286 
288  void ComputeL();
289 
291  void ComputeP();
292 
294  void ComputeY();
295 
297  void ComputeD();
298 
303  void ReorganizeW(void);
304 
306  double m_Stiffness;
307 
311 
314 
317 
320 
323 
326 
333 
336 
339 
344 
347 
350 
353 
356 
357 private:
358 
359  KernelTransform(const Self &); // purposely not implemented
360  void operator=(const Self &); // purposely not implemented
361 
362 };
363 } // end namespace itk
364 
365 #ifndef ITK_MANUAL_INSTANTIATION
366 #include "itkKernelTransform.hxx"
367 #endif
368 
369 #endif // __itkKernelTransform_h

Generated at Sat Aug 30 2014 15:02:47 for Orfeo Toolbox with doxygen 1.8.3.1