ITK  4.6.0
Insight Segmentation and Registration Toolkit
itkMatrixOffsetTransformBase.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 __itkMatrixOffsetTransformBase_h
19 #define __itkMatrixOffsetTransformBase_h
20 
21 
22 #include "itkMacro.h"
23 #include "itkMatrix.h"
24 #include "itkTransform.h"
25 
26 #include <iostream>
27 
28 namespace itk
29 {
71 template <
72  typename TScalar = double, // Data type for scalars
73  unsigned int NInputDimensions = 3, // Number of dimensions in the input space
74  unsigned int NOutputDimensions = 3>
75 // Number of dimensions in the output space
77  public Transform<TScalar, NInputDimensions, NOutputDimensions>
78 {
79 public:
82  typedef Transform<TScalar,
83  NInputDimensions,
84  NOutputDimensions> Superclass;
85 
88 
90  itkTypeMacro(MatrixOffsetTransformBase, Transform);
91 
93  itkNewMacro(Self);
94 
96  itkStaticConstMacro(InputSpaceDimension, unsigned int, NInputDimensions);
97  itkStaticConstMacro(OutputSpaceDimension, unsigned int, NOutputDimensions);
98  itkStaticConstMacro( ParametersDimension, unsigned int,
99  NOutputDimensions * ( NInputDimensions + 1 ) );
101 
105 
108 
111 
114 
116  typedef Vector<TScalar,
117  itkGetStaticConstMacro(InputSpaceDimension)> InputVectorType;
118  typedef Vector<TScalar,
119  itkGetStaticConstMacro(OutputSpaceDimension)> OutputVectorType;
122 
124  typedef CovariantVector<TScalar,
125  itkGetStaticConstMacro(InputSpaceDimension)>
127  typedef CovariantVector<TScalar,
128  itkGetStaticConstMacro(OutputSpaceDimension)>
131 
134 
140 
146 
149 
151  typedef vnl_vector_fixed<TScalar,
152  itkGetStaticConstMacro(InputSpaceDimension)>
154  typedef vnl_vector_fixed<TScalar,
155  itkGetStaticConstMacro(OutputSpaceDimension)>
158 
160  typedef Point<TScalar,
161  itkGetStaticConstMacro(InputSpaceDimension)>
164  typedef Point<TScalar,
165  itkGetStaticConstMacro(OutputSpaceDimension)>
169 
171  typedef Matrix<TScalar, itkGetStaticConstMacro(OutputSpaceDimension),
172  itkGetStaticConstMacro(InputSpaceDimension)>
176 
178  typedef Matrix<TScalar, itkGetStaticConstMacro(InputSpaceDimension),
179  itkGetStaticConstMacro(OutputSpaceDimension)>
181 
183 
186 
188 
190 
195 
199  virtual void SetIdentity(void);
200 
205  {
206  return Self::Linear;
207  }
208 
220  virtual void SetMatrix(const MatrixType & matrix)
221  {
222  m_Matrix = matrix; this->ComputeOffset();
223  this->ComputeMatrixParameters();
224  m_MatrixMTime.Modified(); this->Modified(); return;
225  }
227 
235  virtual const MatrixType & GetMatrix() const
236  {
237  return m_Matrix;
238  }
239 
248  void SetOffset(const OutputVectorType & offset)
249  {
250  m_Offset = offset; this->ComputeTranslation();
251  this->Modified(); return;
252  }
254 
260  const OutputVectorType & GetOffset(void) const
261  {
262  return m_Offset;
263  }
264 
287  void SetCenter(const InputPointType & center)
288  {
289  m_Center = center; this->ComputeOffset();
290  this->Modified(); return;
291  }
293 
300  const InputPointType & GetCenter() const
301  {
302  return m_Center;
303  }
304 
311  void SetTranslation(const OutputVectorType & translation)
312  {
313  m_Translation = translation; this->ComputeOffset();
314  this->Modified(); return;
315  }
317 
324  const OutputVectorType & GetTranslation(void) const
325  {
326  return m_Translation;
327  }
328 
333  void SetParameters(const ParametersType & parameters);
334 
336  const ParametersType & GetParameters(void) const;
337 
339  virtual void SetFixedParameters(const ParametersType &);
340 
342  virtual const ParametersType & GetFixedParameters(void) const;
343 
355  void Compose(const Self *other, bool pre = 0);
356 
365  OutputPointType TransformPoint(const InputPointType & point) const;
366 
368 
369  OutputVectorType TransformVector(const InputVectorType & vector) const;
370 
372 
374 
376 
378 
380 
382 
384 
386 
389 
391 
401  virtual void ComputeJacobianWithRespectToParameters(const InputPointType & x, JacobianType & j) const;
402 
406  virtual void ComputeJacobianWithRespectToPosition(const InputPointType & x, JacobianType & jac) const;
407 
411  virtual void ComputeInverseJacobianWithRespectToPosition(const InputPointType & x, JacobianType & jac) const;
412 
431  bool GetInverse(Self *inverse) const;
433 
436 
442  virtual bool IsLinear() const
443  {
444  return true;
445  }
446 
447 #if !defined(ITK_LEGACY_REMOVE)
448 
449 public:
450 #else
451 
452 protected:
453 #endif
454 
456  const InverseMatrixType & GetInverseMatrix(void) const;
457 
458 protected:
466  MatrixOffsetTransformBase(const MatrixType & matrix, const OutputVectorType & offset);
467  MatrixOffsetTransformBase(unsigned int paramDims);
470 
472  virtual ~MatrixOffsetTransformBase();
473 
475  void PrintSelf(std::ostream & s, Indent indent) const;
476 
478  {
479  return m_InverseMatrix;
480  }
481  void SetVarInverseMatrix(const InverseMatrixType & matrix) const
482  {
484  }
485  bool InverseMatrixIsOld(void) const
486  {
488  {
489  return true;
490  }
491  else
492  {
493  return false;
494  }
495  }
496 
497  virtual void ComputeMatrixParameters(void);
498 
499  virtual void ComputeMatrix(void);
500 
501  void SetVarMatrix(const MatrixType & matrix)
502  {
503  m_Matrix = matrix; m_MatrixMTime.Modified();
504  }
505 
506  virtual void ComputeTranslation(void);
507 
508  void SetVarTranslation(const OutputVectorType & translation)
509  {
510  m_Translation = translation;
511  }
512 
513  virtual void ComputeOffset(void);
514 
515  void SetVarOffset(const OutputVectorType & offset)
516  {
517  m_Offset = offset;
518  }
519 
520  void SetVarCenter(const InputPointType & center)
521  {
522  m_Center = center;
523  }
524 
525 private:
526 
527  MatrixOffsetTransformBase(const Self & other);
528  const Self & operator=(const Self &);
529 
530  MatrixType m_Matrix; // Matrix of the transformation
531  OutputVectorType m_Offset; // Offset of the transformation
532  mutable InverseMatrixType m_InverseMatrix; // Inverse of the matrix
533  mutable bool m_Singular; // Is m_Inverse singular?
534 
537 
541 }; // class MatrixOffsetTransformBase
542 } // namespace itk
543 
544 #ifndef ITK_MANUAL_INSTANTIATION
545 #include "itkMatrixOffsetTransformBase.hxx"
546 #endif
547 
548 #endif /* __itkMatrixOffsetTransformBase_h */
virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &) const
Definition: itkTransform.h:238
Superclass::OutputVectorPixelType OutputVectorPixelType
TCoordRep ValueType
Definition: itkPoint.h:60
A templated class holding a M x N size Matrix.
Definition: itkMatrix.h:46
Superclass::InverseTransformBaseType InverseTransformBaseType
void Compose(const Self *other, bool pre=0)
DiffusionTensor3D< TScalar > OutputDiffusionTensor3DType
Definition: itkTransform.h:142
OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &vector) const
Light weight base class for most itk classes.
Transform< TScalar, NInputDimensions, NOutputDimensions > Superclass
void PrintSelf(std::ostream &s, Indent indent) const
Array2D< ParametersValueType > JacobianType
Definition: itkTransform.h:123
Vector< TScalar, itkGetStaticConstMacro(InputSpaceDimension)> InputVectorType
InputPointType::ValueType InputPointValueType
OutputPointType TransformPoint(const InputPointType &point) const
virtual TransformCategoryType GetTransformCategory() const
SymmetricSecondRankTensor< TScalar, NOutputDimensions > OutputSymmetricSecondRankTensorType
Definition: itkTransform.h:138
virtual OutputSymmetricSecondRankTensorType TransformSymmetricSecondRankTensor(const InputSymmetricSecondRankTensorType &tensor, const InputPointType &point) const
Matrix and Offset transformation of a vector space (e.g. space coordinates)
Transform< TScalar, NOutputDimensions, NInputDimensions > InverseTransformBaseType
Definition: itkTransform.h:161
vnl_vector_fixed< TScalar, itkGetStaticConstMacro(OutputSpaceDimension)> OutputVnlVectorType
virtual void ComputeTranslation(void)
virtual void ComputeJacobianWithRespectToParameters(const InputPointType &x, JacobianType &j) const
static const unsigned int InputSpaceDimension
void SetVarInverseMatrix(const InverseMatrixType &matrix) const
Matrix< TScalar, itkGetStaticConstMacro(OutputSpaceDimension), itkGetStaticConstMacro(InputSpaceDimension)> MatrixType
OutputSymmetricSecondRankTensorType TransformSymmetricSecondRankTensor(const InputSymmetricSecondRankTensorType &tensor) const
Superclass::ParametersType ParametersType
Definition: itkTransform.h:118
static const unsigned int OutputSpaceDimension
Vector< TScalar, itkGetStaticConstMacro(OutputSpaceDimension)> OutputVectorType
virtual InverseTransformBasePointer GetInverseTransform() const
OutputDiffusionTensor3DType TransformDiffusionTensor3D(const InputDiffusionTensor3DType &tensor) const
void SetOffset(const OutputVectorType &offset)
VariableLengthVector< TScalar > InputVectorPixelType
Definition: itkTransform.h:131
VariableLengthVector< TScalar > OutputVectorPixelType
Definition: itkTransform.h:132
void SetVarTranslation(const OutputVectorType &translation)
DiffusionTensor3D< TScalar > InputDiffusionTensor3DType
Definition: itkTransform.h:141
virtual void ComputeOffset(void)
virtual void ComputeMatrix(void)
void SetVarCenter(const InputPointType &center)
Matrix< TScalar, itkGetStaticConstMacro(InputSpaceDimension), itkGetStaticConstMacro(OutputSpaceDimension)> InverseMatrixType
vnl_vector_fixed< TScalar, itkGetStaticConstMacro(InputSpaceDimension)> InputVnlVectorType
bool GetInverse(Self *inverse) const
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
Point< TScalar, itkGetStaticConstMacro(InputSpaceDimension)> InputPointType
A templated class holding a n-Dimensional vector.
Definition: itkVector.h:62
CovariantVector< TScalar, itkGetStaticConstMacro(OutputSpaceDimension)> OutputCovariantVectorType
Superclass::ParametersValueType ParametersValueType
Definition: itkTransform.h:119
const OutputVectorType & GetOffset(void) const
void SetCenter(const InputPointType &center)
OutputVectorType TransformVector(const InputVectorType &vector) const
SymmetricSecondRankTensor< TScalar, NInputDimensions > InputSymmetricSecondRankTensorType
Definition: itkTransform.h:136
Superclass::InputSymmetricSecondRankTensorType InputSymmetricSecondRankTensorType
const InverseMatrixType & GetVarInverseMatrix(void) const
InverseTransformBaseType::Pointer InverseTransformBasePointer
Superclass::OutputSymmetricSecondRankTensorType OutputSymmetricSecondRankTensorType
OutputPointType::ValueType OutputPointValueType
Generate a unique, increasing time value.
Definition: itkTimeStamp.h:58
Superclass::InputVectorPixelType InputVectorPixelType
const Self & operator=(const Self &)
Point< TScalar, itkGetStaticConstMacro(OutputSpaceDimension)> OutputPointType
static const unsigned int ParametersDimension
virtual void Modified() const
virtual const ParametersType & GetFixedParameters(void) const
virtual void SetIdentity(void)
virtual OutputVectorType TransformVector(const InputVectorType &) const
Definition: itkTransform.h:192
OutputVectorType::ValueType OutputVectorValueType
void SetVarMatrix(const MatrixType &matrix)
virtual const MatrixType & GetMatrix() const
virtual void ComputeMatrixParameters(void)
Superclass::TransformCategoryType TransformCategoryType
CovariantVector< TScalar, itkGetStaticConstMacro(InputSpaceDimension)> InputCovariantVectorType
Superclass::OutputDiffusionTensor3DType OutputDiffusionTensor3DType
Superclass::ParametersValueType ParametersValueType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void ComputeInverseJacobianWithRespectToPosition(const InputPointType &x, JacobianType &jac) const
const OutputVectorType & GetTranslation(void) const
Superclass::InputDiffusionTensor3DType InputDiffusionTensor3DType
Superclass::TransformCategoryType TransformCategoryType
Definition: itkTransform.h:431
CovariantVector< TScalar, InputDiffusionTensor3DType::Dimension > InputTensorEigenVectorType
void SetParameters(const ParametersType &parameters)
virtual void ComputeJacobianWithRespectToPosition(const InputPointType &x, JacobianType &jac) const
void SetVarOffset(const OutputVectorType &offset)
TranslationType::ValueType TranslationValueType
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:51
TScalar ScalarType
Definition: itkTransform.h:115
virtual void SetFixedParameters(const ParametersType &)
const ParametersType & GetParameters(void) const
A templated class holding a n-Dimensional covariant vector.
void SetTranslation(const OutputVectorType &translation)
const InverseMatrixType & GetInverseMatrix(void) const
virtual void SetMatrix(const MatrixType &matrix)
const InputPointType & GetCenter() const
virtual OutputDiffusionTensor3DType TransformDiffusionTensor3D(const InputDiffusionTensor3DType &) const
Definition: itkTransform.h:272