go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkAdvancedIdentityTransform.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: itkIdentityTransform.h,v $
22  Language: C++
23  Date: $Date: 2009-06-28 14:41:47 $
24  Version: $Revision: 1.19 $
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 __itkAdvancedIdentityTransform_h
35 #define __itkAdvancedIdentityTransform_h
36 
37 #include "itkObject.h"
38 #include "itkPoint.h"
39 #include "itkVector.h"
40 #include "itkCovariantVector.h"
41 #include "vnl/vnl_vector_fixed.h"
42 #include "itkArray.h"
43 #include "itkArray2D.h"
44 #include "itkAdvancedTransform.h"
45 
46 #include "itkObjectFactory.h"
47 
48 namespace itk
49 {
50 
70 template< class TScalarType,
71 unsigned int NDimensions = 3 >
73  public AdvancedTransform< TScalarType, NDimensions, NDimensions >
74 {
75 public:
76 
79  typedef AdvancedTransform<
80  TScalarType, NDimensions, NDimensions > Superclass;
82  typedef SmartPointer< const Self > ConstPointer;
83 
85  itkNewMacro( Self );
86 
89 
91  itkStaticConstMacro( InputSpaceDimension, unsigned int, NDimensions );
92  itkStaticConstMacro( OutputSpaceDimension, unsigned int, NDimensions );
93  itkStaticConstMacro( ParametersDimension, unsigned int, 1 );
94 
96  typedef TScalarType ScalarType;
97 
101  typedef typename Superclass::TransformCategoryType TransformCategoryType;
102 
105 
107  typedef Vector< TScalarType,
108  itkGetStaticConstMacro( InputSpaceDimension ) > InputVectorType;
109  typedef Vector< TScalarType,
110  itkGetStaticConstMacro( OutputSpaceDimension ) > OutputVectorType;
111 
113  typedef CovariantVector< TScalarType,
114  itkGetStaticConstMacro( InputSpaceDimension ) > InputCovariantVectorType;
115  typedef CovariantVector< TScalarType,
116  itkGetStaticConstMacro( OutputSpaceDimension ) > OutputCovariantVectorType;
117 
119  typedef vnl_vector_fixed< TScalarType,
120  itkGetStaticConstMacro( InputSpaceDimension ) > InputVnlVectorType;
121  typedef vnl_vector_fixed< TScalarType,
122  itkGetStaticConstMacro( OutputSpaceDimension ) > OutputVnlVectorType;
123 
125  typedef Point< TScalarType,
126  itkGetStaticConstMacro( InputSpaceDimension ) > InputPointType;
127  typedef Point< TScalarType,
128  itkGetStaticConstMacro( OutputSpaceDimension ) > OutputPointType;
129 
133  typedef typename InverseTransformBaseType::Pointer InverseTransformBasePointer;
134 
136  typedef typename Superclass
139  typedef typename Superclass
142  typedef typename Superclass
145 
147  virtual OutputPointType TransformPoint( const InputPointType & point ) const
148  { return point; }
149 
151  virtual OutputVectorType TransformVector( const InputVectorType & vector ) const
152  { return vector; }
153 
156  { return vector; }
157 
160  const InputCovariantVectorType & vector ) const
161  { return vector; }
162 
167  void SetIdentity( void ) {}
168 
170  virtual InverseTransformBasePointer GetInverseTransform( void ) const
171  {
172  return this->New().GetPointer();
173  }
174 
175 
181  virtual bool IsLinear() const { return true; }
182 
186  virtual TransformCategoryType GetTransformCategory() const
187  {
188  return Self::Linear;
189  }
190 
191 
193  virtual const ParametersType & GetFixedParameters( void ) const
194  {
195  return this->m_FixedParameters;
196  }
197 
198 
200  virtual void SetFixedParameters( const ParametersType & ) {}
201 
203  virtual const ParametersType & GetParameters( void ) const
204  {
205  return this->m_Parameters;
206  }
207 
208 
210  virtual void SetParameters( const ParametersType & ) {}
211 
213  virtual void GetJacobian(
214  const InputPointType &,
215  JacobianType & j,
216  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
217  {
218  j = this->m_LocalJacobian;
219  nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
220  }
221 
222 
224  virtual void GetSpatialJacobian(
225  const InputPointType &,
226  SpatialJacobianType & sj ) const
227  {
228  sj = this->m_SpatialJacobian;
229  }
230 
231 
233  virtual void GetSpatialHessian(
234  const InputPointType &,
235  SpatialHessianType & sh ) const
236  {
237  sh = this->m_SpatialHessian;
238  }
239 
240 
243  const InputPointType &,
244  JacobianOfSpatialJacobianType & jsj,
245  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
246  {
247  jsj = this->m_JacobianOfSpatialJacobian;
248  nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
249  }
250 
251 
254  const InputPointType &,
255  SpatialJacobianType & sj,
256  JacobianOfSpatialJacobianType & jsj,
257  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
258  {
259  sj = this->m_SpatialJacobian;
260  jsj = this->m_JacobianOfSpatialJacobian;
261  nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
262  }
263 
264 
267  const InputPointType &,
268  JacobianOfSpatialHessianType & jsh,
269  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
270  {
271  jsh = this->m_JacobianOfSpatialHessian;
272  nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
273  }
274 
275 
280  const InputPointType &,
281  SpatialHessianType & sh,
282  JacobianOfSpatialHessianType & jsh,
283  NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
284  {
285  sh = this->m_SpatialHessian;
286  jsh = this->m_JacobianOfSpatialHessian;
287  nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
288  }
289 
290 
291 protected:
292 
294  AdvancedTransform< TScalarType, NDimensions, NDimensions >( NDimensions )
295  {
296  // The Jacobian is constant, therefore it can be initialized in the constructor.
297  this->m_LocalJacobian = JacobianType( NDimensions, 1 );
298  this->m_LocalJacobian.Fill( 0.0 );
299 
301  this->m_SpatialJacobian.SetIdentity();
302 
304  this->m_NonZeroJacobianIndices.resize( ParametersDimension );
305  for( unsigned int i = 0; i < ParametersDimension; ++i )
306  {
307  this->m_NonZeroJacobianIndices[ i ] = i;
308  }
309 
311  this->m_HasNonZeroSpatialHessian = false;
313  this->m_JacobianOfSpatialJacobian.resize( ParametersDimension );
314  this->m_JacobianOfSpatialHessian.resize( ParametersDimension );
315 
317  }
318 
319 
321 
322 private:
323 
324  AdvancedIdentityTransform( const Self & ); // purposely not implemented
325  void operator=( const Self & ); // purposely not implemented
326 
327  JacobianType m_LocalJacobian;
328  SpatialJacobianType m_SpatialJacobian;
329  SpatialHessianType m_SpatialHessian;
330  NonZeroJacobianIndicesType m_NonZeroJacobianIndices;
331  JacobianOfSpatialJacobianType m_JacobianOfSpatialJacobian;
332  JacobianOfSpatialHessianType m_JacobianOfSpatialHessian;
333 
334 };
335 
336 } // end namespace itk
337 
338 #endif
Matrix< ScalarType, OutputSpaceDimension, InputSpaceDimension > SpatialJacobianType
JacobianOfSpatialHessianType m_JacobianOfSpatialHessian
Superclass::ParametersType ParametersType
CovariantVector< TScalarType, itkGetStaticConstMacro(InputSpaceDimension) > InputCovariantVectorType
NonZeroJacobianIndicesType m_NonZeroJacobianIndices
virtual const ParametersType & GetParameters(void) const
virtual void GetJacobianOfSpatialJacobian(const InputPointType &, SpatialJacobianType &sj, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
Superclass::JacobianOfSpatialHessianType JacobianOfSpatialHessianType
vnl_vector_fixed< TScalarType, itkGetStaticConstMacro(InputSpaceDimension) > InputVnlVectorType
virtual OutputPointType TransformPoint(const InputPointType &point) const
virtual InverseTransformBasePointer GetInverseTransform(void) const
vnl_vector_fixed< TScalarType, itkGetStaticConstMacro(OutputSpaceDimension) > OutputVnlVectorType
Superclass::InverseTransformBaseType InverseTransformBaseType
virtual void GetJacobianOfSpatialHessian(const InputPointType &, SpatialHessianType &sh, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
virtual const ParametersType & GetFixedParameters(void) const
virtual void GetSpatialJacobian(const InputPointType &, SpatialJacobianType &sj) const
JacobianOfSpatialJacobianType m_JacobianOfSpatialJacobian
virtual void GetSpatialHessian(const InputPointType &, SpatialHessianType &sh) const
virtual OutputCovariantVectorType TransformCovariantVector(const InputCovariantVectorType &vector) const
Superclass::SpatialJacobianType SpatialJacobianType
InverseTransformBaseType::Pointer InverseTransformBasePointer
Transform maps points, vectors and covariant vectors from an input space to an output space...
virtual void GetJacobianOfSpatialJacobian(const InputPointType &, JacobianOfSpatialJacobianType &jsj, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
virtual void SetParameters(const ParametersType &)
AdvancedTransform< TScalarType, NDimensions, NDimensions > Superclass
itkStaticConstMacro(InputSpaceDimension, unsigned int, NDimensions)
virtual void SetFixedParameters(const ParametersType &)
Superclass::InternalMatrixType InternalMatrixType
CovariantVector< TScalarType, itkGetStaticConstMacro(OutputSpaceDimension) > OutputCovariantVectorType
Superclass::NonZeroJacobianIndicesType NonZeroJacobianIndicesType
void operator=(const Self &)
Point< TScalarType, itkGetStaticConstMacro(OutputSpaceDimension) > OutputPointType
Superclass::TransformCategoryType TransformCategoryType
Superclass::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType
virtual OutputVectorType TransformVector(const InputVectorType &vector) const
virtual TransformCategoryType GetTransformCategory() const
Superclass::SpatialHessianType SpatialHessianType
Vector< TScalarType, itkGetStaticConstMacro(OutputSpaceDimension) > OutputVectorType
Point< TScalarType, itkGetStaticConstMacro(InputSpaceDimension) > InputPointType
Vector< TScalarType, itkGetStaticConstMacro(InputSpaceDimension) > InputVectorType
virtual void GetJacobian(const InputPointType &, JacobianType &j, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const
FixedArray< Matrix< ScalarType, InputSpaceDimension, InputSpaceDimension >, OutputSpaceDimension > SpatialHessianType
Implementation of an Identity Transform.
Superclass::NumberOfParametersType NumberOfParametersType
virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const
virtual void GetJacobianOfSpatialHessian(const InputPointType &, JacobianOfSpatialHessianType &jsh, NonZeroJacobianIndicesType &nonZeroJacobianIndices) const


Generated on 04-09-2015 for elastix by doxygen 1.8.9.1 elastix logo