Main Page   Groups   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Concepts

itkBSplineDeformableTransform.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Insight Segmentation & Registration Toolkit
00004   Module:    $RCSfile: itkBSplineDeformableTransform.h,v $
00005   Language:  C++
00006   Date:      $Date: 2002/09/15 15:59:26 $
00007   Version:   $Revision: 1.7 $
00008 
00009   Copyright (c) 2002 Insight Consortium. All rights reserved.
00010   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00011 
00012      This software is distributed WITHOUT ANY WARRANTY; without even 
00013      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR 
00014      PURPOSE.  See the above copyright notices for more information.
00015 
00016 =========================================================================*/
00017 
00018 #ifndef __itkBSplineDeformableTransform_h
00019 #define __itkBSplineDeformableTransform_h
00020 
00021 #include <iostream>
00022 #include "itkTransform.h"
00023 #include "itkImage.h"
00024 #include "itkImageRegion.h"
00025 #include "itkBSplineInterpolationWeightFunction.h"
00026 
00027 namespace itk
00028 {
00029 
00067 template <
00068     class TScalarType = double,          // Data type for scalars (float or double)
00069     unsigned int NDimensions = 3,        // Number of dimensions
00070     unsigned int VSplineOrder = 3 >      // Spline order
00071 class BSplineDeformableTransform : 
00072           public Transform< TScalarType, NDimensions, NDimensions >
00073 {
00074 public:
00076   typedef BSplineDeformableTransform Self;
00077   typedef Transform< TScalarType, NDimensions, NDimensions > Superclass;
00078   typedef SmartPointer<Self>        Pointer;
00079   typedef SmartPointer<const Self>  ConstPointer;
00080       
00082   itkNewMacro( Self );
00083 
00085   itkTypeMacro( BSplineDeformableTransform, Transform );
00086 
00088   itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions);
00089 
00091   itkStaticConstMacro(SplineOrder, unsigned int, VSplineOrder);
00092 
00094   typedef typename Superclass::ScalarType ScalarType;
00095 
00097   typedef typename Superclass::ParametersType ParametersType;
00098 
00100   typedef typename Superclass::JacobianType JacobianType;
00101 
00103   typedef Vector<TScalarType,
00104                  itkGetStaticConstMacro(SpaceDimension)> InputVectorType;
00105   typedef Vector<TScalarType,
00106                  itkGetStaticConstMacro(SpaceDimension)> OutputVectorType;
00107 
00109   typedef CovariantVector<TScalarType,
00110                           itkGetStaticConstMacro(SpaceDimension)> InputCovariantVectorType;
00111   typedef CovariantVector<TScalarType,
00112                           itkGetStaticConstMacro(SpaceDimension)> OutputCovariantVectorType;
00113   
00115   typedef vnl_vector_fixed<TScalarType,
00116                            itkGetStaticConstMacro(SpaceDimension)> InputVnlVectorType;
00117   typedef vnl_vector_fixed<TScalarType,
00118                            itkGetStaticConstMacro(SpaceDimension)> OutputVnlVectorType;
00119   
00121   typedef Point<TScalarType,
00122                 itkGetStaticConstMacro(SpaceDimension)> InputPointType;
00123   typedef Point<TScalarType,
00124                 itkGetStaticConstMacro(SpaceDimension)> OutputPointType;
00125   
00143   void SetParameters(const ParametersType & parameters);
00144 
00146   virtual const ParametersType& GetParameters(void) const;
00147 
00149   typedef ImageRegion<itkGetStaticConstMacro(SpaceDimension)>    RegionType;
00150   typedef typename RegionType::IndexType IndexType;
00151   typedef typename RegionType::SizeType  SizeType;
00152   typedef FixedArray<double> SpacingType;
00153   typedef FixedArray<double> OriginType;
00154 
00156   virtual void SetGridRegion( const RegionType& region );
00157   itkGetMacro( GridRegion, RegionType );
00158 
00160   virtual void SetGridSpacing( const SpacingType& spacing );
00161   itkGetMacro( GridSpacing, SpacingType );
00162 
00164   virtual void SetGridOrigin( const OriginType& origin );
00165   itkGetMacro( GridOrigin, OriginType );
00166 
00168   typedef Transform<ScalarType,itkGetStaticConstMacro(SpaceDimension),
00169                     itkGetStaticConstMacro(SpaceDimension)> BulkTransformType;
00170   typedef typename BulkTransformType::ConstPointer  BulkTransformPointer;
00171 
00175   itkSetConstObjectMacro( BulkTransform, BulkTransformType );
00176   itkGetConstObjectMacro( BulkTransform, BulkTransformType );
00177 
00179   OutputPointType  TransformPoint(const InputPointType  &point ) const;
00180 
00182   typedef BSplineInterpolationWeightFunction<ScalarType,
00183                                              itkGetStaticConstMacro(SpaceDimension),
00184                                              itkGetStaticConstMacro(SplineOrder)> WeightsFunctionType;
00185   typedef typename WeightsFunctionType::WeightsType WeightsType;
00186   typedef typename WeightsFunctionType::ContinuousIndexType ContinuousIndexType;
00187 
00193   void TransformPoint( const InputPointType & inputPoint,
00194                        OutputPointType & outputPoint,
00195                        WeightsType & weights,
00196                        IndexType & startIndex, bool & inside ) const;
00197 
00199   unsigned long GetNumberOfWeights() const
00200     { return m_WeightsFunction->GetNumberOfWeights(); }
00201 
00203   virtual OutputVectorType TransformVector(const InputVectorType &vector) const
00204     { 
00205       itkExceptionMacro(<< "Method not applicable for deformable transform." );
00206       return OutputVectorType(); 
00207     }
00208 
00210   virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &vector) const
00211     { 
00212       itkExceptionMacro(<< "Method not applicable for deformable transform. ");
00213       return OutputVnlVectorType(); 
00214     }
00215 
00217   virtual OutputCovariantVectorType TransformCovariantVector(
00218     const InputCovariantVectorType &vector) const
00219     { 
00220       itkExceptionMacro(<< "Method not applicable for deformable transfrom. ");
00221       return OutputCovariantVectorType(); 
00222     } 
00223     
00225   void PrintSelf(std::ostream &os, Indent indent) const;
00226 
00228   virtual const JacobianType& GetJacobian(const InputPointType  &point ) const;
00229 
00231   unsigned int virtual GetNumberOfParameters(void) const;
00232 
00233 protected:
00234   BSplineDeformableTransform();
00235   ~BSplineDeformableTransform();
00236 
00237 private:
00238   BSplineDeformableTransform(const Self&); //purposely not implemented
00239   void operator=(const Self&); //purposely not implemented
00240 
00242   BulkTransformPointer  m_BulkTransform;
00243 
00245   RegionType    m_GridRegion;
00246   SpacingType   m_GridSpacing;
00247   OriginType    m_GridOrigin;
00248   
00249   RegionType    m_ValidRegion;
00250 
00252   unsigned long m_Offset;
00253   SizeType      m_SupportSize;
00254 
00256   typedef typename ParametersType::ValueType PixelType;
00257   typedef Image<PixelType,itkGetStaticConstMacro(SpaceDimension)> ImageType;
00258   
00259   typename ImageType::Pointer   m_CoefficientImage[NDimensions];
00260 
00262   typedef typename JacobianType::ValueType JacobianPixelType;
00263   typedef Image<JacobianPixelType,
00264                 itkGetStaticConstMacro(SpaceDimension)> JacobianImageType;
00265  
00266   typename JacobianImageType::Pointer m_JacobianImage[NDimensions];
00267 
00271   mutable IndexType m_LastJacobianIndex;
00272 
00274   const ParametersType *  m_InputParametersPointer;
00275 
00277   typename WeightsFunctionType::Pointer  m_WeightsFunction;
00278 
00279 
00280 }; //class BSplineDeformableTransform
00281 
00282 
00283 }  // namespace itk
00284 
00285 
00286 #ifndef ITK_MANUAL_INSTANTIATION
00287 #include "itkBSplineDeformableTransform.txx"
00288 #endif
00289 
00290 #endif /* __itkBSplineDeformableTransform_h */

Generated at Wed Mar 12 01:12:49 2003 for ITK by doxygen 1.2.15 written by Dimitri van Heesch, © 1997-2000