Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017 #ifndef __itkAdvancedIdentityTransform_h
00018 #define __itkAdvancedIdentityTransform_h
00019
00020 #include "itkObject.h"
00021 #include "itkPoint.h"
00022 #include "itkVector.h"
00023 #include "itkCovariantVector.h"
00024 #include "vnl/vnl_vector_fixed.h"
00025 #include "itkArray.h"
00026 #include "itkArray2D.h"
00027 #include "itkAdvancedTransform.h"
00028
00029 #include "itkObjectFactory.h"
00030
00031
00032 namespace itk
00033 {
00034
00054 template <class TScalarType,
00055 unsigned int NDimensions=3>
00056 class ITK_EXPORT AdvancedIdentityTransform
00057 : public AdvancedTransform<TScalarType,NDimensions,NDimensions>
00058 {
00059 public:
00061 typedef AdvancedIdentityTransform Self;
00062 typedef AdvancedTransform<
00063 TScalarType,NDimensions,NDimensions> Superclass;
00064 typedef SmartPointer< Self > Pointer;
00065 typedef SmartPointer< const Self > ConstPointer;
00066
00068 itkNewMacro( Self );
00069
00071 itkTypeMacro( AdvancedIdentityTransform, AdvancedTransform );
00072
00074 itkStaticConstMacro( InputSpaceDimension, unsigned int, NDimensions );
00075 itkStaticConstMacro( OutputSpaceDimension, unsigned int, NDimensions );
00076 itkStaticConstMacro( ParametersDimension, unsigned int, 1 );
00077
00079 typedef TScalarType ScalarType;
00080
00082 typedef typename Superclass::ParametersType ParametersType;
00083
00085 typedef typename Superclass::JacobianType JacobianType;
00086
00088 typedef Vector<TScalarType,
00089 itkGetStaticConstMacro(InputSpaceDimension)> InputVectorType;
00090 typedef Vector<TScalarType,
00091 itkGetStaticConstMacro(OutputSpaceDimension)> OutputVectorType;
00092
00094 typedef CovariantVector<TScalarType,
00095 itkGetStaticConstMacro(InputSpaceDimension)> InputCovariantVectorType;
00096 typedef CovariantVector<TScalarType,
00097 itkGetStaticConstMacro(OutputSpaceDimension)> OutputCovariantVectorType;
00098
00100 typedef vnl_vector_fixed<TScalarType,
00101 itkGetStaticConstMacro(InputSpaceDimension)> InputVnlVectorType;
00102 typedef vnl_vector_fixed<TScalarType,
00103 itkGetStaticConstMacro(OutputSpaceDimension)> OutputVnlVectorType;
00104
00106 typedef Point<TScalarType,
00107 itkGetStaticConstMacro(InputSpaceDimension)> InputPointType;
00108 typedef Point<TScalarType,
00109 itkGetStaticConstMacro(OutputSpaceDimension)> OutputPointType;
00110
00113 typedef typename Superclass::InverseTransformBaseType InverseTransformBaseType;
00114 typedef typename InverseTransformBaseType::Pointer InverseTransformBasePointer;
00115
00117 typedef typename Superclass
00118 ::NonZeroJacobianIndicesType NonZeroJacobianIndicesType;
00119 typedef typename Superclass::SpatialJacobianType SpatialJacobianType;
00120 typedef typename Superclass
00121 ::JacobianOfSpatialJacobianType JacobianOfSpatialJacobianType;
00122 typedef typename Superclass::SpatialHessianType SpatialHessianType;
00123 typedef typename Superclass
00124 ::JacobianOfSpatialHessianType JacobianOfSpatialHessianType;
00125 typedef typename Superclass::InternalMatrixType InternalMatrixType;
00126
00128 virtual OutputPointType TransformPoint( const InputPointType &point ) const
00129 { return point; }
00130
00132 virtual OutputVectorType TransformVector( const InputVectorType &vector ) const
00133 { return vector; }
00134
00136 virtual OutputVnlVectorType TransformVector( const InputVnlVectorType &vector ) const
00137 { return vector; }
00138
00140 virtual OutputCovariantVectorType TransformCovariantVector(
00141 const InputCovariantVectorType &vector ) const
00142 { return vector; }
00143
00148 void SetIdentity( void ) { }
00149
00178 virtual const JacobianType & GetJacobian( const InputPointType & ) const
00179 {
00180 return this->m_Jacobian;
00181 }
00182
00184 virtual InverseTransformBasePointer GetInverseTransform( void ) const
00185 {
00186 return this->New().GetPointer();
00187 }
00188
00194 virtual bool IsLinear() const { return true; }
00195
00197 virtual const ParametersType& GetFixedParameters( void ) const
00198 {
00199 return this->m_FixedParameters;
00200 }
00201
00203 virtual void SetFixedParameters( const ParametersType & ) {}
00204
00206 virtual const ParametersType& GetParameters( void ) const
00207 {
00208 return this->m_Parameters;
00209 }
00210
00212 virtual void SetParameters( const ParametersType & ) {}
00213
00215 virtual void GetJacobian(
00216 const InputPointType &,
00217 JacobianType & j,
00218 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
00219 {
00220 j = this->m_Jacobian;
00221 nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
00222 }
00223
00224
00226 virtual void GetSpatialJacobian(
00227 const InputPointType &,
00228 SpatialJacobianType & sj ) const
00229 {
00230 sj = this->m_SpatialJacobian;
00231 }
00232
00234 virtual void GetSpatialHessian(
00235 const InputPointType &,
00236 SpatialHessianType & sh ) const
00237 {
00238 sh = this->m_SpatialHessian;
00239 }
00240
00242 virtual void GetJacobianOfSpatialJacobian(
00243 const InputPointType &,
00244 JacobianOfSpatialJacobianType & jsj,
00245 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
00246 {
00247 jsj = this->m_JacobianOfSpatialJacobian;
00248 nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
00249 }
00250
00252 virtual void GetJacobianOfSpatialJacobian(
00253 const InputPointType &,
00254 SpatialJacobianType & sj,
00255 JacobianOfSpatialJacobianType & jsj,
00256 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
00257 {
00258 sj = this->m_SpatialJacobian;
00259 jsj = this->m_JacobianOfSpatialJacobian;
00260 nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
00261 }
00262
00264 virtual void GetJacobianOfSpatialHessian(
00265 const InputPointType &,
00266 JacobianOfSpatialHessianType & jsh,
00267 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
00268 {
00269 jsh = this->m_JacobianOfSpatialHessian;
00270 nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
00271 }
00272
00276 virtual void GetJacobianOfSpatialHessian(
00277 const InputPointType &,
00278 SpatialHessianType & sh,
00279 JacobianOfSpatialHessianType & jsh,
00280 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const
00281 {
00282 sh = this->m_SpatialHessian;
00283 jsh = this->m_JacobianOfSpatialHessian;
00284 nonZeroJacobianIndices = this->m_NonZeroJacobianIndices;
00285 }
00286
00287 protected:
00288 AdvancedIdentityTransform()
00289 : AdvancedTransform<TScalarType,NDimensions,NDimensions>( NDimensions, 1 )
00290 {
00291
00292 this->m_Jacobian = JacobianType( NDimensions, 1 );
00293 this->m_Jacobian.Fill( 0.0 );
00294
00296 this->m_SpatialJacobian.SetIdentity();
00297
00299 this->m_NonZeroJacobianIndices.resize( ParametersDimension );
00300 for ( unsigned int i = 0; i < ParametersDimension; ++i )
00301 {
00302 this->m_NonZeroJacobianIndices[ i ] = i;
00303 }
00304
00306 this->m_HasNonZeroSpatialHessian = false;
00307 this->m_HasNonZeroJacobianOfSpatialHessian = false;
00308 this->m_JacobianOfSpatialJacobian.resize( ParametersDimension );
00309 this->m_JacobianOfSpatialHessian.resize( ParametersDimension );
00310
00312 }
00313 virtual ~AdvancedIdentityTransform() {}
00314
00315 private:
00316 AdvancedIdentityTransform(const Self&);
00317 void operator=(const Self&);
00318
00319 SpatialJacobianType m_SpatialJacobian;
00320 SpatialHessianType m_SpatialHessian;
00321 NonZeroJacobianIndicesType m_NonZeroJacobianIndices;
00322 JacobianOfSpatialJacobianType m_JacobianOfSpatialJacobian;
00323 JacobianOfSpatialHessianType m_JacobianOfSpatialHessian;
00324
00325 };
00326
00327 }
00328
00329 #endif
00330