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  * 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: itkKernelTransform2.h,v $
22 Language: C++
23 Date: $Date: 2006-11-28 14:22:18 $
24 Version: $Revision: 1.1 $
25 
26 Copyright (c) Insight Software Consortium. All rights reserved.
27 See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
28 
29 This software is distributed WITHOUT ANY WARRANTY; without even
30 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
31 PURPOSE. See the above copyright notices for more information.
32 
33 =========================================================================*/
34 #ifndef __itkKernelTransform2_h
35 #define __itkKernelTransform2_h
36 
37 #include "itkAdvancedTransform.h"
38 #include "itkPoint.h"
39 #include "itkVector.h"
40 #include "itkMatrix.h"
41 #include "itkPointSet.h"
42 #include <deque>
43 #include <math.h>
44 #include "vnl/vnl_matrix_fixed.h"
45 #include "vnl/vnl_matrix.h"
46 #include "vnl/vnl_vector.h"
47 #include "vnl/vnl_vector_fixed.h"
48 #include "vnl/vnl_sample.h"
49 #include "vnl/algo/vnl_svd.h"
50 #include "vnl/algo/vnl_qr.h"
51 
52 namespace itk
53 {
54 
94 template< class TScalarType, // probably only float and double make sense here
95 unsigned int NDimensions >
96 // Number of dimensions
98  public AdvancedTransform< TScalarType, NDimensions, NDimensions >
99 {
100 public:
101 
104  typedef AdvancedTransform<
105  TScalarType, NDimensions, NDimensions > Superclass;
106  typedef SmartPointer< Self > Pointer;
107  typedef SmartPointer< const Self > ConstPointer;
108 
111 
113  itkNewMacro( Self );
114 
116  itkStaticConstMacro( SpaceDimension, unsigned int, NDimensions );
117 
131 
133  typedef typename Superclass
136  typedef typename Superclass
139  typedef typename Superclass
142 
146  typedef DefaultStaticMeshTraits< TScalarType,
147  NDimensions, NDimensions, TScalarType, TScalarType > PointSetTraitsType;
148  typedef PointSet< InputPointType, NDimensions,
150  typedef typename PointSetType::Pointer PointSetPointer;
151  typedef typename PointSetType::PointsContainer PointsContainer;
152  typedef typename PointSetType::PointsContainerIterator PointsIterator;
153  typedef typename PointSetType::PointsContainerConstIterator PointsConstIterator;
154 
156  typedef VectorContainer< unsigned long, InputVectorType > VectorSetType;
157  typedef typename VectorSetType::Pointer VectorSetPointer;
158 
160  typedef vnl_matrix_fixed< TScalarType, NDimensions, NDimensions > IMatrixType;
161 
164  {
165  return ( this->m_SourceLandmarks->GetNumberOfPoints() * SpaceDimension );
166  }
167 
168 
171 
173  virtual void SetSourceLandmarks( PointSetType * );
174 
177 
179  virtual void SetTargetLandmarks( PointSetType * );
180 
185 
187  void ComputeWMatrix( void );
188 
190  void ComputeLInverse( void );
191 
193  OutputPointType TransformPoint( const InputPointType & thisPoint ) const override;
194 
197  {
198  itkExceptionMacro(
199  << "TransformVector(const InputVectorType &) is not implemented "
200  << "for KernelTransform" );
201  }
202 
203 
205  {
206  itkExceptionMacro(
207  << "TransformVector(const InputVnlVectorType &) is not implemented "
208  << "for KernelTransform" );
209  }
210 
211 
213  {
214  itkExceptionMacro(
215  << "TransformCovariantVector(const InputCovariantVectorType &) is not implemented "
216  << "for KernelTransform" );
217  }
218 
219 
222  const InputPointType &,
223  JacobianType &,
224  NonZeroJacobianIndicesType & ) const override;
225 
227  virtual void SetIdentity( void );
228 
234  void SetParameters( const ParametersType & ) override;
235 
241  void SetFixedParameters( const ParametersType & ) override;
242 
244  virtual void UpdateParameters( void );
245 
247  const ParametersType & GetParameters( void ) const override;
248 
250  const ParametersType & GetFixedParameters( void ) const override;
251 
262  virtual void SetStiffness( double stiffness )
263  {
264  this->m_Stiffness = stiffness > 0 ? stiffness : 0.0;
265  this->m_LMatrixComputed = false;
266  this->m_LInverseComputed = false;
267  this->m_WMatrixComputed = false;
268  }
269 
270 
271  itkGetMacro( Stiffness, double );
272 
279  virtual void SetAlpha( TScalarType itkNotUsed( Alpha ) ) {}
280  virtual TScalarType GetAlpha( void ) const { return -1.0; }
281 
288  itkSetMacro( PoissonRatio, TScalarType );
289  virtual const TScalarType GetPoissonRatio( void ) const
290  {
291  return this->m_PoissonRatio;
292  }
293 
294 
296  itkSetMacro( MatrixInversionMethod, std::string );
297  itkGetConstReferenceMacro( MatrixInversionMethod, std::string );
298 
301  const InputPointType & ipp, SpatialJacobianType & sj ) const override
302  {
303  itkExceptionMacro( << "Not implemented for KernelTransform2" );
304  }
305 
306 
308  const InputPointType & ipp, SpatialHessianType & sh ) const override
309  {
310  itkExceptionMacro( << "Not implemented for KernelTransform2" );
311  }
312 
313 
316  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const override
317  {
318  itkExceptionMacro( << "Not implemented for KernelTransform2" );
319  }
320 
321 
323  const InputPointType & ipp, SpatialJacobianType & sj,
325  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const override
326  {
327  itkExceptionMacro( << "Not implemented for KernelTransform2" );
328  }
329 
330 
332  const InputPointType & ipp, JacobianOfSpatialHessianType & jsh,
333  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const override
334  {
335  itkExceptionMacro( << "Not implemented for KernelTransform2" );
336  }
337 
338 
340  const InputPointType & ipp, SpatialHessianType & sh,
342  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const override
343  {
344  itkExceptionMacro( << "Not implemented for KernelTransform2" );
345  }
346 
347 
348 protected:
349 
351  ~KernelTransform2() override;
352  void PrintSelf( std::ostream & os, Indent indent ) const override;
353 
354 public:
355 
357  typedef vnl_matrix_fixed< TScalarType, NDimensions, NDimensions > GMatrixType;
358 
360  typedef vnl_matrix< TScalarType > LMatrixType;
361 
363  typedef vnl_matrix< TScalarType > KMatrixType;
364 
366  typedef vnl_matrix< TScalarType > PMatrixType;
367 
369  typedef vnl_matrix< TScalarType > YMatrixType;
370 
372  typedef vnl_matrix< TScalarType > WMatrixType;
373 
375  typedef vnl_matrix< TScalarType > DMatrixType;
376 
378  typedef vnl_matrix_fixed< TScalarType, NDimensions, NDimensions > AMatrixType;
379 
381  typedef vnl_vector_fixed< TScalarType, NDimensions > BMatrixType;
382 
384  typedef vnl_matrix_fixed< TScalarType, 1, NDimensions > RowMatrixType;
385 
387  typedef vnl_matrix_fixed< TScalarType, NDimensions, 1 > ColumnMatrixType;
388 
391 
394 
395 protected:
396 
404  virtual void ComputeG( const InputVectorType & landmarkVector,
405  GMatrixType & GMatrix ) const;
406 
414  virtual void ComputeReflexiveG( PointsIterator, GMatrixType & GMatrix ) const;
415 
420  const InputPointType & inputPoint,
421  OutputPointType & result ) const;
422 
424  void ComputeK( void );
425 
427  void ComputeL( void );
428 
430  void ComputeP( void );
431 
433  void ComputeY( void );
434 
436  void ComputeD( void );
437 
442  void ReorganizeW( void );
443 
445  double m_Stiffness;
446 
451 
454 
457 
460 
463 
466 
469 
476 
479 
482 
488  //GMatrixType m_GMatrix;
489 
498 
505  typedef vnl_svd< ScalarType > SVDDecompositionType;
506  typedef vnl_qr< ScalarType > QRDecompositionType;
507 
510 
513 
516 
519 
524 
525 private:
526 
527  KernelTransform2( const Self & ); // purposely not implemented
528  void operator=( const Self & ); // purposely not implemented
529 
530  TScalarType m_PoissonRatio;
531 
534 
535 };
536 
537 } // end namespace itk
538 
539 #ifndef ITK_MANUAL_INSTANTIATION
540 #include "itkKernelTransform2.hxx"
541 #endif
542 
543 #endif // __itkKernelTransform2_h
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
PointSetPointer m_TargetLandmarks
Superclass::OutputVectorType OutputVectorType
void SetParameters(const ParametersType &) override
virtual void UpdateParameters(void)
void GetJacobianOfSpatialHessian(const InputPointType &ipp, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
Superclass::ScalarType ScalarType
void GetJacobianOfSpatialHessian(const InputPointType &ipp, SpatialHessianType &sh, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
NonZeroJacobianIndicesType m_NonZeroJacobianIndicesTemp
void ComputeWMatrix(void)
PointSetType::PointsContainerConstIterator PointsConstIterator
virtual void ComputeG(const InputVectorType &landmarkVector, GMatrixType &GMatrix) const
Superclass::InputVnlVectorType InputVnlVectorType
Superclass::NumberOfParametersType NumberOfParametersType
Superclass::OutputCovariantVectorType OutputCovariantVectorType
virtual void SetAlpha(TScalarType)
virtual void SetStiffness(double stiffness)
AdvancedTransform< TScalarType, NDimensions, NDimensions > Superclass
Superclass::InternalMatrixType InternalMatrixType
Superclass::ParametersType ParametersType
VectorSetType::Pointer VectorSetPointer
SVDDecompositionType * m_LMatrixDecompositionSVD
vnl_matrix< TScalarType > DMatrixType
void GetJacobianOfSpatialJacobian(const InputPointType &ipp, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
OutputVnlVectorType TransformVector(const InputVnlVectorType &) const override
Superclass::InputPointType InputPointType
SmartPointer< Self > Pointer
vnl_vector_fixed< TScalarType, NDimensions > BMatrixType
virtual void SetIdentity(void)
itkGetModifiableObjectMacro(TargetLandmarks, PointSetType)
virtual void SetTargetLandmarks(PointSetType *)
NumberOfParametersType GetNumberOfParameters(void) const override
OutputPointType TransformPoint(const InputPointType &thisPoint) const override
const ParametersType & GetFixedParameters(void) const override
vnl_matrix_fixed< TScalarType, NDimensions, NDimensions > IMatrixType
Superclass ::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
void operator=(const Self &)
VectorContainer< unsigned long, InputVectorType > VectorSetType
SmartPointer< const Self > ConstPointer
virtual TScalarType GetAlpha(void) const
DefaultStaticMeshTraits< TScalarType, NDimensions, NDimensions, TScalarType, TScalarType > PointSetTraitsType
virtual const TScalarType GetPoissonRatio(void) const
itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions)
VectorSetPointer m_Displacements
itkGetModifiableObjectMacro(SourceLandmarks, PointSetType)
PointSet< InputPointType, NDimensions, PointSetTraitsType > PointSetType
Superclass::OutputPointType OutputPointType
void GetJacobianOfSpatialJacobian(const InputPointType &ipp, SpatialJacobianType &sj, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
const ParametersType & GetParameters(void) const override
void SetFixedParameters(const ParametersType &) override
KernelTransform2(const Self &)
vnl_qr< ScalarType > QRDecompositionType
void PrintSelf(std::ostream &os, Indent indent) const override
Superclass ::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType
PointSetType::Pointer PointSetPointer
vnl_matrix_fixed< TScalarType, NDimensions, 1 > ColumnMatrixType
Superclass ::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
~KernelTransform2() override
QRDecompositionType * m_LMatrixDecompositionQR
PointSetType::PointsContainerIterator PointsIterator
vnl_matrix< TScalarType > KMatrixType
vnl_matrix< TScalarType > PMatrixType
virtual void ComputeDeformationContribution(const InputPointType &inputPoint, OutputPointType &result) const
void ComputeLInverse(void)
vnl_matrix< TScalarType > WMatrixType
PointSetType::PointsContainer PointsContainer
vnl_matrix_fixed< TScalarType, NDimensions, NDimensions > AMatrixType
void GetSpatialJacobian(const InputPointType &ipp, SpatialJacobianType &sj) const override
virtual void SetSourceLandmarks(PointSetType *)
vnl_matrix_fixed< TScalarType, NDimensions, NDimensions > GMatrixType
PointSetPointer m_SourceLandmarks
NonZeroJacobianIndicesType m_NonZeroJacobianIndices
Superclass::OutputVnlVectorType OutputVnlVectorType
Superclass::SpatialJacobianType SpatialJacobianType
Superclass::InputCovariantVectorType InputCovariantVectorType
vnl_matrix< TScalarType > LMatrixType
Superclass::InputVectorType InputVectorType
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const override
itkGetModifiableObjectMacro(Displacements, VectorSetType)
virtual void ComputeReflexiveG(PointsIterator, GMatrixType &GMatrix) const
vnl_matrix_fixed< TScalarType, 1, NDimensions > RowMatrixType
Superclass::JacobianType JacobianType
void GetJacobian(const InputPointType &, JacobianType &, NonZeroJacobianIndicesType &) const override
Superclass::SpatialHessianType SpatialHessianType
vnl_svd< ScalarType > SVDDecompositionType
void GetSpatialHessian(const InputPointType &ipp, SpatialHessianType &sh) const override
vnl_matrix< TScalarType > YMatrixType
OutputVectorType TransformVector(const InputVectorType &) const override


Generated on 1667476801 for elastix by doxygen 1.9.1 elastix logo