KWStyle - itkIdentityTransform.h
 
Matrix View
Description

1 /*=========================================================================
2
3   Program:   Insight Segmentation & Registration Toolkit
4   Module:    $RCSfile: itkIdentityTransform.h.html,v $
5   Language:  C++
6   Date:      $Date: 2006/01/17 19:15:36 $
7   Version:   $Revision: 1.4 $
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 __itkIdentityTransform_h
18 #define __itkIdentityTransform_h
19
20 #include "itkObject.h"
21 #include "itkPoint.h"
22 #include "itkVector.h"
23 #include "itkCovariantVector.h"
24 #include "vnl/vnl_vector_fixed.h"
25 #include "itkArray.h"
26 #include "itkArray2D.h"
27 #include "itkTransform.h"
28
29 #include "itkObjectFactory.h"
30
31
32 namespace itk
33 {
34   
35 /** \class IdentityTransform
36  * \brief Implementation of an Identity Transform.
37  *
38  * This class defines the generic interface for an Identity Transform.
39  * 
40  * It will map every point to itself, every vector to itself and
41  * every covariant vector to itself.
42  * 
43  * This class is intended to be used primarily as a default Transform
44  * for initializing those classes supporting a generic Transform.
45  *
46  * This class is templated over the Representation type for coordinates
47  * (that is the type used for representing the components of points and
48  * vectors) and over the dimension of the space. In this case the Input
49  * and Output spaces are the same so only one dimension is required.
50  *
51  * \ingroup Transforms
52  *
53  */
54 template <class TScalarType,
55           unsigned int NDimensions=3>
56 LEN class ITK_EXPORT  IdentityTransform  : public Transform<TScalarType,NDimensions,NDimensions>
57 {
58 public:
59   /** Standard class typedefs. */
60   typedef IdentityTransform  Self;
61 TDA   typedef Transform<TScalarType,NDimensions,NDimensions> Superclass;
62 TDA   typedef SmartPointer< Self >   Pointer;
63 TDA   typedef SmartPointer< const Self >  ConstPointer;
64   
65   /** New method for creating an object using a factory. */
66   itkNewMacro(Self);
67
68   /** Run-time type information (and related methods). */
69   itkTypeMacro( IdentityTransform, Transform );
70
71   /** Dimension of the domain space. */
72   itkStaticConstMacro(InputSpaceDimension, unsigned int, NDimensions);
73   itkStaticConstMacro(OutputSpaceDimension, unsigned int, NDimensions);
74   
75   /** Type of the input parameters. */
76   typedef  TScalarType     ScalarType;
77
78   /** Type of the input parameters. */
79   typedef  typename Superclass::ParametersType                 ParametersType;
80
81   /** Type of the Jacobian matrix. */
82   typedef  typename Superclass::JacobianType                   JacobianType;
83
84   /** Standard vector type for this class. */
85   typedef Vector<TScalarType,
86                 itkGetStaticConstMacro(InputSpaceDimension)>  InputVectorType;
87   typedef Vector<TScalarType,
88                 itkGetStaticConstMacro(OutputSpaceDimension)> OutputVectorType;
89   
90   /** Standard covariant vector type for this class */
91   typedef CovariantVector<TScalarType,
92 LEN                           itkGetStaticConstMacro(InputSpaceDimension)>  InputCovariantVectorType;
93   typedef CovariantVector<TScalarType,
94 LEN                           itkGetStaticConstMacro(OutputSpaceDimension)> OutputCovariantVectorType;
95   
96   /** Standard vnl_vector type for this class. */
97   typedef vnl_vector_fixed<TScalarType,
98 LEN                            itkGetStaticConstMacro(InputSpaceDimension)>  InputVnlVectorType;
99   typedef vnl_vector_fixed<TScalarType,
100 LEN                            itkGetStaticConstMacro(OutputSpaceDimension)> OutputVnlVectorType;
101   
102   /** Standard coordinate point type for this class */
103   typedef Point<TScalarType,
104                 itkGetStaticConstMacro(InputSpaceDimension)> InputPointType;
105   typedef Point<TScalarType,
106 TDA                 itkGetStaticConstMacro(OutputSpaceDimension)> OutputPointType;
107   
108   /**  Method to transform a point. */
109   virtual OutputPointType TransformPoint(const InputPointType  &point ) const
110     { return point; }
111
112   /**  Method to transform a vector. */
113   virtual OutputVectorType TransformVector(const InputVectorType &vector) const
114     { return vector; }
115
116   /**  Method to transform a vnl_vector. */
117 LEN   virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const
118     { return vector; }
119
120   /**  Method to transform a CovariantVector. */
121   virtual OutputCovariantVectorType TransformCovariantVector(
122     const InputCovariantVectorType &vector) const
123     { return vector; }
124
125   /** Set the transformation to an Identity
126    *
127    * This is a NULL operation in the case of this particular transform.
128 LEN,IND *****The method is provided only to comply with the interface of other transforms. */
129   void SetIdentity( void ) { }
130
131
132   /** Set the Transformation Parameters
133    * and update the internal transformation. */
134   virtual void SetParameters(const ParametersType &) {};
135
136   /** Compute the Jacobian of the transformation
137 IND ****
138 IND **** This method computes the Jacobian matrix of the transformation.
139 IND **** given point or vector, returning the transformed point or
140 IND **** vector. The rank of the Jacobian will also indicate if the transform
141 IND **** is invertible at this point.
142 IND ****
143 IND **** The Jacobian can be expressed as a set of partial derivatives of the
144 IND **** output point components with respect to the parameters that defined
145 IND **** the transform:
146 IND ****
147 IND **** \f[
148 IND ****
149 IND ******J=\left[ \begin{array}{cccc}
150 IND ******\frac{\partial x_{1}}{\partial p_{1}} & 
151 IND ******\frac{\partial x_{2}}{\partial p_{1}} & 
152 IND ******\cdots  & \frac{\partial x_{n}}{\partial p_{1}}\\
153 IND ******\frac{\partial x_{1}}{\partial p_{2}} & 
154 IND ******\frac{\partial x_{2}}{\partial p_{2}} & 
155 IND ******\cdots  & \frac{\partial x_{n}}{\partial p_{2}}\\
156 IND ******\vdots  & \vdots  & \ddots  & \vdots \\
157 IND ******\frac{\partial x_{1}}{\partial p_{m}} & 
158 IND ******\frac{\partial x_{2}}{\partial p_{m}} & 
159 IND ******\cdots  & \frac{\partial x_{n}}{\partial p_{m}}
160 IND ******\end{array}\right] 
161 IND ****
162 IND **** \f]
163 IND **** **/
164   virtual const JacobianType & GetJacobian(const InputPointType  & ) const
165     { 
166     this->m_Jacobian = JacobianType(NDimensions,1); 
167     this->m_Jacobian.Fill(0.0); 
168     return this->m_Jacobian;
169     }
170
171
172 EML
173 protected:
174 LEN   IdentityTransform():Transform<TScalarType,NDimensions,NDimensions>(NDimensions,1) {}; 
175   virtual ~IdentityTransform() {};
176
177
178 private:
179   IdentityTransform(const Self&); //purposely not implemented
180   void operator=(const Self&); //purposely not implemented
181
182
183 };
184
185 // end namespace itk
186
187
188 #endif
189
190 EOF
191 EOF,EML
192 EOF,EML

Generated by KWStyle 1.0b on Tuesday January,17 at 02:14:12PM
© Kitware Inc.