Orfeo Toolbox  4.0
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 ) );
100 
104 
107 
110 
113 
115  typedef Vector<TScalar,
116  itkGetStaticConstMacro(InputSpaceDimension)> InputVectorType;
117  typedef Vector<TScalar,
118  itkGetStaticConstMacro(OutputSpaceDimension)> OutputVectorType;
120 
122  typedef CovariantVector<TScalar,
123  itkGetStaticConstMacro(InputSpaceDimension)>
125  typedef CovariantVector<TScalar,
126  itkGetStaticConstMacro(OutputSpaceDimension)>
128 
131 
137 
143 
146 
148  typedef vnl_vector_fixed<TScalar,
149  itkGetStaticConstMacro(InputSpaceDimension)>
151  typedef vnl_vector_fixed<TScalar,
152  itkGetStaticConstMacro(OutputSpaceDimension)>
154 
156  typedef Point<TScalar,
157  itkGetStaticConstMacro(InputSpaceDimension)>
160  typedef Point<TScalar,
161  itkGetStaticConstMacro(OutputSpaceDimension)>
164 
166  typedef Matrix<TScalar, itkGetStaticConstMacro(OutputSpaceDimension),
167  itkGetStaticConstMacro(InputSpaceDimension)>
170 
172  typedef Matrix<TScalar, itkGetStaticConstMacro(InputSpaceDimension),
173  itkGetStaticConstMacro(OutputSpaceDimension)>
175 
177 
180 
182 
184 
189 
193  virtual void SetIdentity(void);
194 
199  {
200  return Self::Linear;
201  }
202 
214  virtual void SetMatrix(const MatrixType & matrix)
215  {
216  m_Matrix = matrix; this->ComputeOffset();
217  this->ComputeMatrixParameters();
218  m_MatrixMTime.Modified(); this->Modified(); return;
219  }
220 
228  virtual const MatrixType & GetMatrix() const
229  {
230  return m_Matrix;
231  }
232 
241  void SetOffset(const OutputVectorType & offset)
242  {
243  m_Offset = offset; this->ComputeTranslation();
244  this->Modified(); return;
245  }
246 
252  const OutputVectorType & GetOffset(void) const
253  {
254  return m_Offset;
255  }
256 
279  void SetCenter(const InputPointType & center)
280  {
281  m_Center = center; this->ComputeOffset();
282  this->Modified(); return;
283  }
284 
291  const InputPointType & GetCenter() const
292  {
293  return m_Center;
294  }
295 
302  void SetTranslation(const OutputVectorType & translation)
303  {
304  m_Translation = translation; this->ComputeOffset();
305  this->Modified(); return;
306  }
307 
314  const OutputVectorType & GetTranslation(void) const
315  {
316  return m_Translation;
317  }
318 
323  void SetParameters(const ParametersType & parameters);
324 
326  const ParametersType & GetParameters(void) const;
327 
329  virtual void SetFixedParameters(const ParametersType &);
330 
332  virtual const ParametersType & GetFixedParameters(void) const;
333 
345  void Compose(const Self *other, bool pre = 0);
346 
355  OutputPointType TransformPoint(const InputPointType & point) const;
356 
358 
359  OutputVectorType TransformVector(const InputVectorType & vector) const;
360 
362 
364 
366 
368 
370 
372 
374 
376 
379 
381 
391  virtual void ComputeJacobianWithRespectToParameters(const InputPointType & x, JacobianType & j) const;
392 
396  virtual void ComputeJacobianWithRespectToPosition(const InputPointType & x, JacobianType & jac) const;
397 
401  virtual void ComputeInverseJacobianWithRespectToPosition(const InputPointType & x, JacobianType & jac) const;
402 
421  bool GetInverse(Self *inverse) const;
422 
425 
431  virtual bool IsLinear() const
432  {
433  return true;
434  }
435 
436 #if !defined(ITK_LEGACY_REMOVE)
437 
438 public:
439 #else
440 
441 protected:
442 #endif
443 
445  const InverseMatrixType & GetInverseMatrix(void) const;
446 
447 protected:
455  MatrixOffsetTransformBase(const MatrixType & matrix, const OutputVectorType & offset);
456  MatrixOffsetTransformBase(unsigned int paramDims);
458 
460  virtual ~MatrixOffsetTransformBase();
461 
463  void PrintSelf(std::ostream & s, Indent indent) const;
464 
466  {
467  return m_InverseMatrix;
468  }
469  void SetVarInverseMatrix(const InverseMatrixType & matrix) const
470  {
472  }
473  bool InverseMatrixIsOld(void) const
474  {
476  {
477  return true;
478  }
479  else
480  {
481  return false;
482  }
483  }
484 
485  virtual void ComputeMatrixParameters(void);
486 
487  virtual void ComputeMatrix(void);
488 
489  void SetVarMatrix(const MatrixType & matrix)
490  {
491  m_Matrix = matrix; m_MatrixMTime.Modified();
492  }
493 
494  virtual void ComputeTranslation(void);
495 
496  void SetVarTranslation(const OutputVectorType & translation)
497  {
498  m_Translation = translation;
499  }
500 
501  virtual void ComputeOffset(void);
502 
503  void SetVarOffset(const OutputVectorType & offset)
504  {
505  m_Offset = offset;
506  }
507 
508  void SetVarCenter(const InputPointType & center)
509  {
510  m_Center = center;
511  }
512 
513 private:
514 
515  MatrixOffsetTransformBase(const Self & other);
516  const Self & operator=(const Self &);
517 
518  MatrixType m_Matrix; // Matrix of the transformation
519  OutputVectorType m_Offset; // Offset of the transformation
520  mutable InverseMatrixType m_InverseMatrix; // Inverse of the matrix
521  mutable bool m_Singular; // Is m_Inverse singular?
522 
525 
529 }; // class MatrixOffsetTransformBase
530 } // namespace itk
531 
532 #ifndef ITK_MANUAL_INSTANTIATION
534 #endif
535 
536 #endif /* __itkMatrixOffsetTransformBase_h */

Generated at Sat Mar 8 2014 15:11:23 for Orfeo Toolbox with doxygen 1.8.3.1