go home Home | Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Data Structures | File List | Namespace Members | Data Fields | Globals | Related Pages
itkAdvancedBSplineDeformableTransform.h
Go to the documentation of this file.
00001 /*======================================================================
00002 
00003 This file is part of the elastix software.
00004 
00005 Copyright (c) University Medical Center Utrecht. All rights reserved.
00006 See src/CopyrightElastix.txt or http://elastix.isi.uu.nl/legal.php for
00007 details.
00008 
00009 This software is distributed WITHOUT ANY WARRANTY; without even
00010 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00011 PURPOSE. See the above copyright notices for more information.
00012 
00013 ======================================================================*/
00014 
00015 /*=========================================================================
00016 
00017   Program:   Insight Segmentation & Registration Toolkit
00018   Module:    $RCSfile: itkAdvancedBSplineDeformableTransform.h,v $
00019   Language:  C++
00020   Date:      $Date: 2008-04-11 16:28:11 $
00021   Version:   $Revision: 1.38 $
00022 
00023   Copyright (c) Insight Software Consortium. All rights reserved.
00024   See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
00025 
00026      This software is distributed WITHOUT ANY WARRANTY; without even
00027      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00028      PURPOSE.  See the above copyright notices for more information.
00029 
00030 =========================================================================*/
00031 
00032 #ifndef __itkAdvancedBSplineDeformableTransform_h
00033 #define __itkAdvancedBSplineDeformableTransform_h
00034 
00035 #include "itkAdvancedBSplineDeformableTransformBase.h"
00036 #include "itkImage.h"
00037 #include "itkImageRegion.h"
00038 #include "itkBSplineInterpolationWeightFunction2.h"
00039 #include "itkBSplineInterpolationDerivativeWeightFunction.h"
00040 #include "itkBSplineInterpolationSecondOrderDerivativeWeightFunction.h"
00041 
00042 
00043 namespace itk
00044 {
00045 
00123 template <
00124     class TScalarType = double,          // Data type for scalars
00125     unsigned int NDimensions = 3,        // Number of dimensions
00126     unsigned int VSplineOrder = 3 >      // Spline order
00127 class ITK_EXPORT AdvancedBSplineDeformableTransform
00128   : public AdvancedBSplineDeformableTransformBase< TScalarType, NDimensions >
00129 {
00130 public:
00132   typedef AdvancedBSplineDeformableTransform        Self;
00133   typedef AdvancedBSplineDeformableTransformBase<
00134     TScalarType, NDimensions >                      Superclass;
00135   typedef SmartPointer<Self>                        Pointer;
00136   typedef SmartPointer<const Self>                  ConstPointer;
00137 
00139   itkNewMacro( Self );
00140 
00142   itkTypeMacro( AdvancedBSplineDeformableTransform, AdvancedBSplineDeformableTransformBase );
00143 
00145   itkStaticConstMacro( SpaceDimension, unsigned int, NDimensions );
00146 
00148   itkStaticConstMacro( SplineOrder, unsigned int, VSplineOrder );
00149 
00151   typedef typename Superclass::ParametersType         ParametersType;
00152   typedef typename Superclass::JacobianType           JacobianType;
00153   typedef typename Superclass::ScalarType             ScalarType;
00154   typedef typename Superclass::InputPointType         InputPointType;
00155   typedef typename Superclass::OutputPointType        OutputPointType;
00156   typedef typename Superclass::InputVectorType        InputVectorType;
00157   typedef typename Superclass::OutputVectorType       OutputVectorType;
00158   typedef typename Superclass::InputVnlVectorType     InputVnlVectorType;
00159   typedef typename Superclass::OutputVnlVectorType    OutputVnlVectorType;
00160   typedef typename Superclass::InputCovariantVectorType
00161     InputCovariantVectorType;
00162   typedef typename Superclass::OutputCovariantVectorType
00163     OutputCovariantVectorType;
00164 
00165   typedef typename Superclass
00166     ::NonZeroJacobianIndicesType                    NonZeroJacobianIndicesType;
00167   typedef typename Superclass::SpatialJacobianType  SpatialJacobianType;
00168   typedef typename Superclass
00169     ::JacobianOfSpatialJacobianType                 JacobianOfSpatialJacobianType;
00170   typedef typename Superclass::SpatialHessianType   SpatialHessianType;
00171   typedef typename Superclass
00172     ::JacobianOfSpatialHessianType                  JacobianOfSpatialHessianType;
00173   typedef typename Superclass::InternalMatrixType   InternalMatrixType;
00174 
00176   typedef typename Superclass::PixelType        PixelType;
00177   typedef typename Superclass::ImageType        ImageType;
00178   typedef typename Superclass::ImagePointer     ImagePointer;
00179 
00181   typedef typename Superclass::RegionType       RegionType;
00182 
00183   typedef typename Superclass::IndexType        IndexType;
00184   typedef typename Superclass::SizeType         SizeType;
00185   typedef typename Superclass::SpacingType      SpacingType;
00186   typedef typename Superclass::DirectionType    DirectionType;
00187   typedef typename Superclass::OriginType       OriginType;
00188   typedef typename Superclass::GridOffsetType   GridOffsetType;
00189 
00191   virtual void SetGridRegion( const RegionType& region );
00192 
00194   OutputPointType TransformPoint( const InputPointType & point ) const;
00195 
00197   typedef BSplineInterpolationWeightFunction2< ScalarType,
00198     itkGetStaticConstMacro( SpaceDimension ),
00199     itkGetStaticConstMacro( SplineOrder ) >                 WeightsFunctionType;
00200   typedef typename WeightsFunctionType::WeightsType         WeightsType;
00201   typedef typename WeightsFunctionType::ContinuousIndexType ContinuousIndexType;
00202   typedef BSplineInterpolationDerivativeWeightFunction<
00203     ScalarType,
00204     itkGetStaticConstMacro( SpaceDimension ),
00205     itkGetStaticConstMacro( SplineOrder ) >                 DerivativeWeightsFunctionType;
00206   typedef BSplineInterpolationSecondOrderDerivativeWeightFunction<
00207     ScalarType,
00208     itkGetStaticConstMacro( SpaceDimension ),
00209     itkGetStaticConstMacro( SplineOrder ) >                 SODerivativeWeightsFunctionType;
00210 
00212   typedef typename Superclass::ParameterIndexArrayType  ParameterIndexArrayType;
00213 
00221   virtual void TransformPoint(
00222     const InputPointType & inputPoint,
00223     OutputPointType & outputPoint,
00224     WeightsType & weights,
00225     ParameterIndexArrayType & indices,
00226     bool & inside ) const;
00227 
00229   unsigned long GetNumberOfWeights( void ) const
00230   {
00231     return this->m_WeightsFunction->GetNumberOfWeights();
00232   }
00233 
00234   unsigned int GetNumberOfAffectedWeights( void ) const;
00235 
00236   virtual unsigned long GetNumberOfNonZeroJacobianIndices( void ) const;
00237 
00239   virtual const JacobianType & GetJacobian( const InputPointType & point ) const;
00240 
00242   virtual void GetJacobian(
00243     const InputPointType & ipp,
00244     WeightsType & weights,
00245     ParameterIndexArrayType & indices ) const;
00246 
00248   virtual void GetJacobian(
00249     const InputPointType & ipp,
00250     JacobianType & j,
00251     NonZeroJacobianIndicesType & ) const;
00252 
00254   virtual void GetSpatialJacobian(
00255     const InputPointType & ipp,
00256     SpatialJacobianType & sj ) const;
00257 
00259   virtual void GetSpatialHessian(
00260     const InputPointType & ipp,
00261     SpatialHessianType & sh ) const;
00262 
00264   virtual void GetJacobianOfSpatialJacobian(
00265     const InputPointType & ipp,
00266     JacobianOfSpatialJacobianType & jsj,
00267     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00268 
00272   virtual void GetJacobianOfSpatialJacobian(
00273     const InputPointType & ipp,
00274     SpatialJacobianType & sj,
00275     JacobianOfSpatialJacobianType & jsj,
00276     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00277 
00279   virtual void GetJacobianOfSpatialHessian(
00280     const InputPointType & ipp,
00281     JacobianOfSpatialHessianType & jsh,
00282     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00283 
00287   virtual void GetJacobianOfSpatialHessian(
00288     const InputPointType & ipp,
00289     SpatialHessianType & sh,
00290     JacobianOfSpatialHessianType & jsh,
00291     NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00292 
00293 protected:
00295   virtual void PrintSelf( std::ostream &os, Indent indent ) const;
00296 
00297   AdvancedBSplineDeformableTransform();
00298   virtual ~AdvancedBSplineDeformableTransform();
00299 
00301   // Why??
00302   itkSetObjectMacro( WeightsFunction, WeightsFunctionType );
00303   itkGetObjectMacro( WeightsFunction, WeightsFunctionType );
00304 
00306   void WrapAsImages( void );
00307 
00308   virtual void ComputeNonZeroJacobianIndices(
00309     NonZeroJacobianIndicesType & nonZeroJacobianIndices,
00310     const RegionType & supportRegion ) const;
00311 
00312   typedef typename Superclass::JacobianImageType JacobianImageType;
00313   typedef typename Superclass::JacobianPixelType JacobianPixelType;
00314 
00319   typename WeightsFunctionType::Pointer                   m_WeightsFunction;
00320   std::vector<
00321     typename DerivativeWeightsFunctionType::Pointer >     m_DerivativeWeightsFunctions;
00322   std::vector< std::vector<
00323     typename SODerivativeWeightsFunctionType::Pointer > > m_SODerivativeWeightsFunctions;
00324 
00325 private:
00326   AdvancedBSplineDeformableTransform(const Self&); //purposely not implemented
00327   void operator=(const Self&); //purposely not implemented
00328 
00329 }; //class AdvancedBSplineDeformableTransform
00330 
00331 
00332 }  // namespace itk
00333 
00334 // Define instantiation macro for this template.
00335 #define ITK_TEMPLATE_AdvancedBSplineDeformableTransform(_, EXPORT, x, y) namespace itk { \
00336   _(3(class EXPORT AdvancedBSplineDeformableTransform< ITK_TEMPLATE_3 x >)) \
00337   namespace Templates { typedef AdvancedBSplineDeformableTransform< ITK_TEMPLATE_3 x > \
00338                                                    AdvancedBSplineDeformableTransform##y; } \
00339   }
00340 
00341 #if ITK_TEMPLATE_EXPLICIT
00342 # include "Templates/itkAdvancedBSplineDeformableTransform+-.h"
00343 #endif
00344 
00345 #if ITK_TEMPLATE_TXX
00346 # include "itkAdvancedBSplineDeformableTransform.txx"
00347 #endif
00348 
00349 #endif /* __itkAdvancedBSplineDeformableTransform_h */


Generated on 11-05-2012 for elastix by doxygen 1.7.6.1 elastix logo