go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkKernelTransform2.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Insight Segmentation & Registration Toolkit
4 Module: $RCSfile: itkKernelTransform2.h,v $
5 Language: C++
6 Date: $Date: 2006-11-28 14:22:18 $
7 Version: $Revision: 1.1 $
8 
9 Copyright (c) Insight Software Consortium. All rights reserved.
10 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12 This software is distributed WITHOUT ANY WARRANTY; without even
13 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14 PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 #ifndef __itkKernelTransform2_h
18 #define __itkKernelTransform2_h
19 
20 #include "itkAdvancedTransform.h"
21 #include "itkPoint.h"
22 #include "itkVector.h"
23 #include "itkMatrix.h"
24 #include "itkPointSet.h"
25 #include <deque>
26 #include <math.h>
27 #include "vnl/vnl_matrix_fixed.h"
28 #include "vnl/vnl_matrix.h"
29 #include "vnl/vnl_vector.h"
30 #include "vnl/vnl_vector_fixed.h"
31 #include "vnl/vnl_sample.h"
32 #include "vnl/algo/vnl_svd.h"
33 #include "vnl/algo/vnl_qr.h"
34 
35 namespace itk
36 {
37 
77 template< class TScalarType, // probably only float and double make sense here
78 unsigned int NDimensions >
79 // Number of dimensions
81  public AdvancedTransform< TScalarType, NDimensions, NDimensions >
82 {
83 public:
84 
87  typedef AdvancedTransform<
88  TScalarType, NDimensions, NDimensions > Superclass;
89  typedef SmartPointer< Self > Pointer;
90  typedef SmartPointer< const Self > ConstPointer;
91 
93  itkTypeMacro( KernelTransform2, AdvancedTransform );
94 
96  itkNewMacro( Self );
97 
99  itkStaticConstMacro( SpaceDimension, unsigned int, NDimensions );
100 
114 
116  typedef typename Superclass
119  typedef typename Superclass
122  typedef typename Superclass
125 
129  typedef DefaultStaticMeshTraits< TScalarType,
130  NDimensions, NDimensions, TScalarType, TScalarType > PointSetTraitsType;
131  typedef PointSet< InputPointType, NDimensions,
133  typedef typename PointSetType::Pointer PointSetPointer;
134  typedef typename PointSetType::PointsContainer PointsContainer;
135  typedef typename PointSetType::PointsContainerIterator PointsIterator;
136  typedef typename PointSetType::PointsContainerConstIterator PointsConstIterator;
137 
139  typedef VectorContainer< unsigned long, InputVectorType > VectorSetType;
140  typedef typename VectorSetType::Pointer VectorSetPointer;
141 
143  typedef vnl_matrix_fixed< TScalarType, NDimensions, NDimensions > IMatrixType;
144 
147  {
148  return ( this->m_SourceLandmarks->GetNumberOfPoints() * SpaceDimension );
149  }
150 
151 
153  itkGetObjectMacro( SourceLandmarks, PointSetType );
154 
156  virtual void SetSourceLandmarks( PointSetType * );
157 
159  itkGetObjectMacro( TargetLandmarks, PointSetType );
160 
162  virtual void SetTargetLandmarks( PointSetType * );
163 
167  itkGetObjectMacro( Displacements, VectorSetType );
168 
170  void ComputeWMatrix( void );
171 
173  void ComputeLInverse( void );
174 
176  virtual OutputPointType TransformPoint( const InputPointType & thisPoint ) const;
177 
180  {
181  itkExceptionMacro(
182  << "TransformVector(const InputVectorType &) is not implemented "
183  << "for KernelTransform" );
184  }
185 
186 
188  {
189  itkExceptionMacro(
190  << "TransformVector(const InputVnlVectorType &) is not implemented "
191  << "for KernelTransform" );
192  }
193 
194 
196  {
197  itkExceptionMacro(
198  << "TransformCovariantVector(const InputCovariantVectorType &) is not implemented "
199  << "for KernelTransform" );
200  }
201 
202 
204  virtual void GetJacobian(
205  const InputPointType &,
206  JacobianType &,
207  NonZeroJacobianIndicesType & ) const;
208 
210  virtual void SetIdentity( void );
211 
217  virtual void SetParameters( const ParametersType & );
218 
224  virtual void SetFixedParameters( const ParametersType & );
225 
227  virtual void UpdateParameters( void );
228 
230  virtual const ParametersType & GetParameters( void ) const;
231 
233  virtual const ParametersType & GetFixedParameters( void ) const;
234 
245  virtual void SetStiffness( double stiffness )
246  {
247  this->m_Stiffness = stiffness > 0 ? stiffness : 0.0;
248  this->m_LMatrixComputed = false;
249  this->m_LInverseComputed = false;
250  this->m_WMatrixComputed = false;
251  }
252 
253 
254  itkGetMacro( Stiffness, double );
255 
262  virtual void SetAlpha( TScalarType itkNotUsed( Alpha ) ) {}
263  virtual TScalarType GetAlpha( void ) const { return -1.0; }
264 
271  itkSetMacro( PoissonRatio, TScalarType );
272  virtual const TScalarType GetPoissonRatio( void ) const
273  {
274  return this->m_PoissonRatio;
275  }
276 
277 
279  itkSetMacro( MatrixInversionMethod, std::string );
280  itkGetConstReferenceMacro( MatrixInversionMethod, std::string );
281 
283  virtual void GetSpatialJacobian(
284  const InputPointType & ipp, SpatialJacobianType & sj ) const
285  {
286  itkExceptionMacro( << "Not implemented for KernelTransform2" );
287  }
288 
289 
290  virtual void GetSpatialHessian(
291  const InputPointType & ipp, SpatialHessianType & sh ) const
292  {
293  itkExceptionMacro( << "Not implemented for KernelTransform2" );
294  }
295 
296 
299  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
300  {
301  itkExceptionMacro( << "Not implemented for KernelTransform2" );
302  }
303 
304 
306  const InputPointType & ipp, SpatialJacobianType & sj,
308  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
309  {
310  itkExceptionMacro( << "Not implemented for KernelTransform2" );
311  }
312 
313 
315  const InputPointType & ipp, JacobianOfSpatialHessianType & jsh,
316  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
317  {
318  itkExceptionMacro( << "Not implemented for KernelTransform2" );
319  }
320 
321 
323  const InputPointType & ipp, SpatialHessianType & sh,
325  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
326  {
327  itkExceptionMacro( << "Not implemented for KernelTransform2" );
328  }
329 
330 
331 protected:
332 
334  virtual ~KernelTransform2();
335  void PrintSelf( std::ostream & os, Indent indent ) const;
336 
337 public:
338 
340  typedef vnl_matrix_fixed< TScalarType, NDimensions, NDimensions > GMatrixType;
341 
343  typedef vnl_matrix< TScalarType > LMatrixType;
344 
346  typedef vnl_matrix< TScalarType > KMatrixType;
347 
349  typedef vnl_matrix< TScalarType > PMatrixType;
350 
352  typedef vnl_matrix< TScalarType > YMatrixType;
353 
355  typedef vnl_matrix< TScalarType > WMatrixType;
356 
358  typedef vnl_matrix< TScalarType > DMatrixType;
359 
361  typedef vnl_matrix_fixed< TScalarType, NDimensions, NDimensions > AMatrixType;
362 
364  typedef vnl_vector_fixed< TScalarType, NDimensions > BMatrixType;
365 
367  typedef vnl_matrix_fixed< TScalarType, 1, NDimensions > RowMatrixType;
368 
370  typedef vnl_matrix_fixed< TScalarType, NDimensions, 1 > ColumnMatrixType;
371 
374 
377 
378 protected:
379 
387  virtual void ComputeG( const InputVectorType & landmarkVector,
388  GMatrixType & GMatrix ) const;
389 
397  virtual void ComputeReflexiveG( PointsIterator, GMatrixType & GMatrix ) const;
398 
402  virtual void ComputeDeformationContribution(
403  const InputPointType & inputPoint,
404  OutputPointType & result ) const;
405 
407  void ComputeK( void );
408 
410  void ComputeL( void );
411 
413  void ComputeP( void );
414 
416  void ComputeY( void );
417 
419  void ComputeD( void );
420 
425  void ReorganizeW( void );
426 
428  double m_Stiffness;
429 
434 
437 
440 
443 
446 
449 
452 
459 
462 
465 
471  //GMatrixType m_GMatrix;
472 
481 
488  typedef vnl_svd< ScalarType > SVDDecompositionType;
489  typedef vnl_qr< ScalarType > QRDecompositionType;
490 
493 
496 
499 
502 
507 
508 private:
509 
510  KernelTransform2( const Self & ); // purposely not implemented
511  void operator=( const Self & ); // purposely not implemented
512 
513  TScalarType m_PoissonRatio;
514 
517 
518 };
519 
520 } // end namespace itk
521 
522 #ifndef ITK_MANUAL_INSTANTIATION
523 #include "itkKernelTransform2.hxx"
524 #endif
525 
526 #endif // __itkKernelTransform2_h
Superclass::OutputPointType OutputPointType
AdvancedTransform< TScalarType, NDimensions, NDimensions > Superclass
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
vnl_matrix_fixed< TScalarType, 1, NDimensions > RowMatrixType
virtual ~KernelTransform2()
NonZeroJacobianIndicesType m_NonZeroJacobianIndices
virtual void ComputeReflexiveG(PointsIterator, GMatrixType &GMatrix) const
Superclass::OutputCovariantVectorType OutputCovariantVectorType
virtual void SetAlpha(TScalarType)
virtual void GetJacobianOfSpatialJacobian(const InputPointType &ipp, SpatialJacobianType &sj, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions)
PointSetPointer m_TargetLandmarks
vnl_matrix< TScalarType > LMatrixType
virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
void ComputeWMatrix(void)
NonZeroJacobianIndicesType m_NonZeroJacobianIndicesTemp
virtual void GetJacobianOfSpatialHessian(const InputPointType &ipp, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
virtual void GetJacobian(const InputPointType &, JacobianType &, NonZeroJacobianIndicesType &) const
virtual const ParametersType & GetParameters(void) const
Superclass::SpatialHessianType SpatialHessianType
PointSetPointer m_SourceLandmarks
vnl_svd< ScalarType > SVDDecompositionType
Superclass::InputVectorType InputVectorType
PointSetType::PointsContainerConstIterator PointsConstIterator
virtual void ComputeG(const InputVectorType &landmarkVector, GMatrixType &GMatrix) const
vnl_matrix< TScalarType > WMatrixType
vnl_matrix_fixed< TScalarType, NDimensions, NDimensions > GMatrixType
virtual void UpdateParameters(void)
virtual void GetSpatialJacobian(const InputPointType &ipp, SpatialJacobianType &sj) const
Superclass::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType
Superclass::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
DefaultStaticMeshTraits< TScalarType, NDimensions, NDimensions, TScalarType, TScalarType > PointSetTraitsType
virtual void SetStiffness(double stiffness)
virtual void GetJacobianOfSpatialJacobian(const InputPointType &ipp, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
void PrintSelf(std::ostream &os, Indent indent) const
virtual void SetFixedParameters(const ParametersType &)
Transform maps points, vectors and covariant vectors from an input space to an output space...
virtual void SetTargetLandmarks(PointSetType *)
vnl_matrix< TScalarType > KMatrixType
Superclass::OutputVectorType OutputVectorType
vnl_matrix_fixed< TScalarType, NDimensions, 1 > ColumnMatrixType
virtual void SetSourceLandmarks(PointSetType *)
virtual void SetParameters(const ParametersType &)
Superclass::NumberOfParametersType NumberOfParametersType
Superclass::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
Superclass::SpatialJacobianType SpatialJacobianType
vnl_matrix< TScalarType > PMatrixType
vnl_matrix< TScalarType > DMatrixType
Superclass::InputPointType InputPointType
virtual const TScalarType GetPoissonRatio(void) const
PointSetType::PointsContainer PointsContainer
vnl_matrix_fixed< TScalarType, NDimensions, NDimensions > AMatrixType
Superclass::InternalMatrixType InternalMatrixType
Superclass::OutputVnlVectorType OutputVnlVectorType
VectorSetType::Pointer VectorSetPointer
virtual NumberOfParametersType GetNumberOfParameters(void) const
Superclass::ParametersType ParametersType
PointSetType::PointsContainerIterator PointsIterator
virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
SmartPointer< Self > Pointer
Superclass::ScalarType ScalarType
vnl_matrix< TScalarType > YMatrixType
virtual void ComputeDeformationContribution(const InputPointType &inputPoint, OutputPointType &result) const
SmartPointer< const Self > ConstPointer
QRDecompositionType * m_LMatrixDecompositionQR
virtual void GetJacobianOfSpatialHessian(const InputPointType &ipp, SpatialHessianType &sh, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
Superclass::InputVnlVectorType InputVnlVectorType
Superclass::InputCovariantVectorType InputCovariantVectorType
virtual void GetSpatialHessian(const InputPointType &ipp, SpatialHessianType &sh) const
Superclass::JacobianType JacobianType
virtual TScalarType GetAlpha(void) const
vnl_matrix_fixed< TScalarType, NDimensions, NDimensions > IMatrixType
void ComputeLInverse(void)
VectorSetPointer m_Displacements
SVDDecompositionType * m_LMatrixDecompositionSVD
virtual OutputVectorType TransformVector(const InputVectorType &) const
VectorContainer< unsigned long, InputVectorType > VectorSetType
PointSetType::Pointer PointSetPointer
void operator=(const Self &)
vnl_qr< ScalarType > QRDecompositionType
PointSet< InputPointType, NDimensions, PointSetTraitsType > PointSetType
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
vnl_vector_fixed< TScalarType, NDimensions > BMatrixType
virtual OutputPointType TransformPoint(const InputPointType &thisPoint) const
virtual void SetIdentity(void)
virtual const ParametersType & GetFixedParameters(void) const


Generated on 27-04-2014 for elastix by doxygen 1.8.6 elastix logo