go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkAdvancedMatrixOffsetTransformBase.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 
21  Program: Insight Segmentation & Registration Toolkit
22  Module: $RCSfile: itkAdvancedMatrixOffsetTransformBase.h,v $
23  Language: C++
24  Date: $Date: 2008-06-29 12:58:58 $
25  Version: $Revision: 1.20 $
26 
27  Copyright (c) Insight Software Consortium. All rights reserved.
28  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
29 
30  This software is distributed WITHOUT ANY WARRANTY; without even
31  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
32  PURPOSE. See the above copyright notices for more information.
33 
34 =========================================================================*/
35 #ifndef __itkAdvancedMatrixOffsetTransformBase_h
36 #define __itkAdvancedMatrixOffsetTransformBase_h
37 
38 #include <iostream>
39 
40 #include "itkMatrix.h"
41 #include "itkAdvancedTransform.h"
42 #include "itkMacro.h"
43 #include "itkMacro.h"
44 
45 namespace itk
46 {
47 
92 template<
93 class TScalarType = double, // Data type for scalars
94 unsigned int NInputDimensions = 3, // Number of dimensions in the input space
95 unsigned int NOutputDimensions = 3 >
96 // Number of dimensions in the output space
98  public AdvancedTransform< TScalarType, NInputDimensions, NOutputDimensions >
99 {
100 public:
101 
104  typedef AdvancedTransform< TScalarType,
105  NInputDimensions, NOutputDimensions > Superclass;
106  typedef SmartPointer< Self > Pointer;
107  typedef SmartPointer< const Self > ConstPointer;
108 
111 
113  itkNewMacro( Self );
114 
116  itkStaticConstMacro( InputSpaceDimension, unsigned int, NInputDimensions );
117  itkStaticConstMacro( OutputSpaceDimension, unsigned int, NOutputDimensions );
118  itkStaticConstMacro( ParametersDimension, unsigned int,
119  NOutputDimensions * ( NInputDimensions + 1 ) );
120 
125 
130  typedef typename Superclass
132  typedef typename Superclass
138  typedef typename Superclass::TransformCategoryEnum TransformCategoryEnum;
139 
140  typedef typename Superclass
143  typedef typename Superclass
146  typedef typename Superclass
149 
151  typedef Matrix< TScalarType,
152  itkGetStaticConstMacro( OutputSpaceDimension ),
153  itkGetStaticConstMacro( InputSpaceDimension ) > MatrixType;
154 
156  typedef Matrix< TScalarType,
157  itkGetStaticConstMacro( InputSpaceDimension ),
158  itkGetStaticConstMacro( OutputSpaceDimension ) > InverseMatrixType;
159 
164 
168  virtual void SetIdentity( void );
169 
182  virtual void SetMatrix( const MatrixType & matrix )
183  {
184  this->m_Matrix = matrix;
185  this->ComputeOffset();
186  this->ComputeMatrixParameters();
187  this->m_MatrixMTime.Modified();
188  this->Modified();
189  }
190 
191 
199  const MatrixType & GetMatrix( void ) const
200  {
201  return this->m_Matrix;
202  }
203 
204 
214  void SetOffset( const OutputVectorType & offset )
215  {
216  this->m_Offset = offset;
217  this->ComputeTranslation();
218  this->Modified();
219  }
220 
221 
228  const OutputVectorType & GetOffset( void ) const
229  {
230  return this->m_Offset;
231  }
232 
233 
257  void SetCenter( const InputPointType & center )
258  {
259  this->m_Center = center;
260  this->ComputeOffset();
261  this->Modified();
262  }
263 
264 
272  const InputPointType & GetCenter( void ) const
273  {
274  return this->m_Center;
275  }
276 
277 
285  void SetTranslation( const OutputVectorType & translation )
286  {
287  this->m_Translation = translation;
288  this->ComputeOffset();
289  this->Modified();
290  }
291 
292 
300  const OutputVectorType & GetTranslation( void ) const
301  {
302  return this->m_Translation;
303  }
304 
305 
311  void SetParameters( const ParametersType & parameters ) override;
312 
314  const ParametersType & GetParameters( void ) const override;
315 
317  void SetFixedParameters( const FixedParametersType & ) override;
318 
320  const FixedParametersType & GetFixedParameters( void ) const override;
321 
334  void Compose( const Self * other, bool pre = 0 );
335 
344  OutputPointType TransformPoint( const InputPointType & point ) const override;
345 
346  OutputVectorType TransformVector( const InputVectorType & vector ) const override;
347 
348  OutputVnlVectorType TransformVector( const InputVnlVectorType & vector ) const override;
349 
351  const InputCovariantVectorType & vector ) const override;
352 
370  bool GetInverse( Self * inverse ) const;
371 
375  const InverseMatrixType & GetInverseMatrix( void ) const;
376 
382  bool IsLinear( void ) const override
383  {
384  return true;
385  }
386 
387 
392  {
393  return TransformCategoryEnum::Linear;
394  }
395 
396 
399  const InputPointType &,
400  JacobianType &,
401  NonZeroJacobianIndicesType & ) const override;
402 
405  const InputPointType &,
406  SpatialJacobianType & ) const override;
407 
410  const InputPointType &,
411  SpatialHessianType & ) const override;
412 
415  const InputPointType &,
417  NonZeroJacobianIndicesType & ) const override;
418 
421  const InputPointType &,
424  NonZeroJacobianIndicesType & ) const override;
425 
428  const InputPointType &,
430  NonZeroJacobianIndicesType & ) const override;
431 
435  const InputPointType & ipp,
436  SpatialHessianType & sh,
438  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const override;
439 
440 protected:
441 
451  const OutputVectorType & offset );
452  AdvancedMatrixOffsetTransformBase( unsigned int paramDims );
454 
456  virtual void PrecomputeJacobians( unsigned int paramDims );
457 
460 
462  void PrintSelf( std::ostream & s, Indent indent ) const override;
463 
465  {
466  return this->m_InverseMatrix;
467  }
468 
469 
470  void SetVarInverseMatrix( const InverseMatrixType & matrix ) const
471  {
472  this->m_InverseMatrix = matrix;
473  this->m_InverseMatrixMTime.Modified();
474  }
475 
476 
477  bool InverseMatrixIsOld( void ) const
478  {
479  if( this->m_MatrixMTime != this->m_InverseMatrixMTime )
480  {
481  return true;
482  }
483  else
484  {
485  return false;
486  }
487  }
488 
489 
490  virtual void ComputeMatrixParameters( void );
491 
492  virtual void ComputeMatrix( void );
493 
494  void SetVarMatrix( const MatrixType & matrix )
495  {
496  this->m_Matrix = matrix;
497  this->m_MatrixMTime.Modified();
498  }
499 
500 
501  virtual void ComputeTranslation( void );
502 
503  void SetVarTranslation( const OutputVectorType & translation )
504  {
505  this->m_Translation = translation;
506  }
507 
508 
509  virtual void ComputeOffset( void );
510 
511  void SetVarOffset( const OutputVectorType & offset )
512  {
513  this->m_Offset = offset;
514  }
515 
516 
517  void SetVarCenter( const InputPointType & center )
518  {
519  this->m_Center = center;
520  }
521 
522 
530 
531 private:
532 
534  const Self & operator=( const Self & );
535 
537  MatrixType m_Matrix; // Matrix of the transformation
538  OutputVectorType m_Offset; // Offset of the transformation
539  mutable InverseMatrixType m_InverseMatrix; // Inverse of the matrix
540  mutable bool m_Singular; // Is m_Inverse singular?
541 
544 
546  TimeStamp m_MatrixMTime;
547  mutable TimeStamp m_InverseMatrixMTime;
548 
552 
553 };
554 
555 } // namespace itk
556 
557 #ifndef ITK_MANUAL_INSTANTIATION
558 #include "itkAdvancedMatrixOffsetTransformBase.hxx"
559 #endif
560 
561 #endif /* __itkAdvancedMatrixOffsetTransformBase_h */
OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const override
void GetJacobian(const InputPointType &, JacobianType &, NonZeroJacobianIndicesType &) const override
void SetVarInverseMatrix(const InverseMatrixType &matrix) const
itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions)
void Compose(const Self *other, bool pre=0)
virtual void ComputeMatrixParameters(void)
Matrix< TScalarType, itkGetStaticConstMacro(InputSpaceDimension), itkGetStaticConstMacro(OutputSpaceDimension) > InverseMatrixType
const InverseMatrixType & GetVarInverseMatrix(void) const
void SetFixedParameters(const FixedParametersType &) override
const ParametersType & GetParameters(void) const override
virtual void PrecomputeJacobians(unsigned int paramDims)
void GetJacobianOfSpatialHessian(const InputPointType &, JacobianOfSpatialHessianType &, NonZeroJacobianIndicesType &) const override
TransformCategoryEnum GetTransformCategory() const override
OutputPointType TransformPoint(const InputPointType &point) const override
AdvancedMatrixOffsetTransformBase(const Self &other)
void GetSpatialJacobian(const InputPointType &, SpatialJacobianType &) const override
void GetSpatialHessian(const InputPointType &, SpatialHessianType &) const override
void GetJacobianOfSpatialHessian(const InputPointType &ipp, SpatialHessianType &sh, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const override
OutputVectorType TransformVector(const InputVectorType &vector) const override
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &vector) const override
Superclass ::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
void PrintSelf(std::ostream &s, Indent indent) const override
void GetJacobianOfSpatialJacobian(const InputPointType &, SpatialJacobianType &, JacobianOfSpatialJacobianType &, NonZeroJacobianIndicesType &) const override
void GetJacobianOfSpatialJacobian(const InputPointType &, JacobianOfSpatialJacobianType &, NonZeroJacobianIndicesType &) const override
AdvancedMatrixOffsetTransformBase(const MatrixType &matrix, const OutputVectorType &offset)
const InverseMatrixType & GetInverseMatrix(void) const
const FixedParametersType & GetFixedParameters(void) const override
void SetTranslation(const OutputVectorType &translation)
Superclass ::OutputCovariantVectorType OutputCovariantVectorType
Superclass ::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType
Superclass ::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
const Self & operator=(const Self &)
Matrix< TScalarType, itkGetStaticConstMacro(OutputSpaceDimension), itkGetStaticConstMacro(InputSpaceDimension) > MatrixType
void SetVarTranslation(const OutputVectorType &translation)
void SetParameters(const ParametersType &parameters) override
AdvancedMatrixOffsetTransformBase(unsigned int paramDims)
AdvancedTransform< TScalarType, NInputDimensions, NOutputDimensions > Superclass
Superclass ::InputCovariantVectorType InputCovariantVectorType
itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions)
itkStaticConstMacro(ParametersDimension, unsigned int, NOutputDimensions *(NInputDimensions+1))
bool GetInverse(Self *inverse) const
Transform maps points, vectors and covariant vectors from an input space to an output space.
Superclass::OutputVectorType OutputVectorType
Superclass::ParametersType ParametersType
SpatialJacobianType::InternalMatrixType InternalMatrixType
std::vector< SpatialHessianType > JacobianOfSpatialHessianType
Superclass::OutputVnlVectorType OutputVnlVectorType
Superclass::NumberOfParametersType NumberOfParametersType
Superclass::InputVectorType InputVectorType
std::vector< SpatialJacobianType > JacobianOfSpatialJacobianType
Superclass::FixedParametersType FixedParametersType
Superclass::OutputPointType OutputPointType
Superclass::JacobianType JacobianType
Superclass ::OutputCovariantVectorType OutputCovariantVectorType
Superclass::InputPointType InputPointType
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
Superclass ::InputCovariantVectorType InputCovariantVectorType
Superclass::ScalarType ScalarType
Superclass::InputVnlVectorType InputVnlVectorType
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
std::vector< unsigned long > NonZeroJacobianIndicesType


Generated on 1667476801 for elastix by doxygen 1.9.1 elastix logo