ITK  4.0.0
Insight Segmentation and Registration Toolkit
itkBSplineTransform.h
Go to the documentation of this file.
00001 /*=========================================================================
00002  *
00003  *  Copyright Insight Software Consortium
00004  *
00005  *  Licensed under the Apache License, Version 2.0 (the "License");
00006  *  you may not use this file except in compliance with the License.
00007  *  You may obtain a copy of the License at
00008  *
00009  *         http://www.apache.org/licenses/LICENSE-2.0.txt
00010  *
00011  *  Unless required by applicable law or agreed to in writing, software
00012  *  distributed under the License is distributed on an "AS IS" BASIS,
00013  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00014  *  See the License for the specific language governing permissions and
00015  *  limitations under the License.
00016  *
00017  *=========================================================================*/
00018 #ifndef __itkBSplineTransform_h
00019 #define __itkBSplineTransform_h
00020 
00021 #include "itkBSplineBaseTransform.h"
00022 
00023 namespace itk
00024 {
00108 template <class TScalarType = double, unsigned int NDimensions = 3,
00109           unsigned int VSplineOrder = 3>
00110 class ITK_EXPORT BSplineTransform :
00111   public BSplineBaseTransform<TScalarType,NDimensions,VSplineOrder>
00112 {
00113 public:
00115   typedef BSplineTransform                                           Self;
00116   typedef BSplineBaseTransform<TScalarType,NDimensions,VSplineOrder> Superclass;
00117   typedef SmartPointer<Self>                                         Pointer;
00118   typedef SmartPointer<const Self>                                   ConstPointer;
00119 
00121   itkNewMacro( Self );
00122 
00124   itkTypeMacro( BSplineTransform, BSplineBaseTransform );
00125 
00127   itkStaticConstMacro( SpaceDimension, unsigned int, NDimensions );
00128 
00130   itkStaticConstMacro( SplineOrder, unsigned int, VSplineOrder );
00131 
00133   typedef typename Superclass::ScalarType ScalarType;
00134 
00136   typedef typename Superclass::ParametersType ParametersType;
00137 
00139   typedef typename Superclass::JacobianType JacobianType;
00140 
00142   typedef typename Superclass::NumberOfParametersType NumberOfParametersType;
00143 
00145   typedef typename Superclass::InputVectorType  InputVectorType;
00146   typedef typename Superclass::OutputVectorType OutputVectorType;
00147 
00149   typedef typename Superclass::InputCovariantVectorType  InputCovariantVectorType;
00150   typedef typename Superclass::OutputCovariantVectorType OutputCovariantVectorType;
00151 
00153   typedef typename Superclass::InputVnlVectorType  InputVnlVectorType;
00154   typedef typename Superclass::OutputVnlVectorType OutputVnlVectorType;
00155 
00157   typedef typename Superclass::InputPointType  InputPointType;
00158   typedef typename Superclass::OutputPointType OutputPointType;
00159 
00160 
00183   virtual void SetFixedParameters( const ParametersType & parameters );
00185 
00187   typedef typename Superclass::ParametersValueType   ParametersValueType;
00188   typedef typename Superclass::ImageType             ImageType;
00189   typedef typename Superclass::ImagePointer          ImagePointer;
00190   typedef typename Superclass::CoefficientImageArray CoefficientImageArray;
00191 
00203   virtual void SetCoefficientImages( const CoefficientImageArray & images );
00204 
00206   typedef typename Superclass::RegionType    RegionType;
00207 
00208   typedef typename Superclass::IndexType     IndexType;
00209   typedef typename Superclass::SizeType      SizeType;
00210   typedef typename Superclass::SpacingType   SpacingType;
00211   typedef typename Superclass::DirectionType DirectionType;
00212   typedef typename Superclass::OriginType    OriginType;
00213 
00215   typedef typename Superclass::WeightsFunctionType WeightsFunctionType;
00216 
00217   typedef typename Superclass::WeightsType         WeightsType;
00218   typedef typename Superclass::ContinuousIndexType ContinuousIndexType;
00219 
00221   typedef typename Superclass::ParameterIndexArrayType ParameterIndexArrayType;
00222 
00231   using Superclass::TransformPoint;
00232   virtual void TransformPoint( const InputPointType & inputPoint, OutputPointType & outputPoint,
00233     WeightsType & weights, ParameterIndexArrayType & indices, bool & inside ) const;
00235 
00236   virtual void ComputeJacobianWithRespectToParameters( const InputPointType &, JacobianType & ) const;
00237 
00239   virtual NumberOfParametersType GetNumberOfParameters() const;
00240 
00242   NumberOfParametersType GetNumberOfParametersPerDimension() const;
00243 
00244   typedef typename Superclass::SpacingType   PhysicalDimensionsType;
00245   typedef typename Superclass::PixelType     PixelType;
00246 
00247   typedef typename Superclass::MeshSizeType MeshSizeType;
00248 
00250   virtual void SetTransformDomainOrigin( const OriginType & );
00251 
00253   itkGetConstMacro( TransformDomainOrigin, OriginType );
00254 
00256   virtual void SetTransformDomainPhysicalDimensions( const PhysicalDimensionsType & );
00257 
00259   itkGetConstMacro( TransformDomainPhysicalDimensions, PhysicalDimensionsType );
00260 
00262   virtual void SetTransformDomainDirection( const DirectionType & );
00263 
00265   itkGetConstMacro( TransformDomainDirection, DirectionType );
00266 
00268   virtual void SetTransformDomainMeshSize( const MeshSizeType & );
00269 
00271   itkGetConstMacro( TransformDomainMeshSize, MeshSizeType );
00272 
00273   virtual bool HasLocalSupport() const
00274   {
00275     return false;
00276   }
00277 
00278 protected:
00280   void PrintSelf( std::ostream & os, Indent indent ) const;
00281 
00282   BSplineTransform();
00283   virtual ~BSplineTransform();
00284 
00285 private:
00286 
00288   virtual void SetFixedParametersGridSizeFromTransformDomainInformation() const;
00289 
00291   virtual void SetFixedParametersGridOriginFromTransformDomainInformation() const;
00292 
00294   virtual void SetFixedParametersGridSpacingFromTransformDomainInformation() const;
00295 
00297   virtual void SetFixedParametersGridDirectionFromTransformDomainInformation() const;
00298 
00300   virtual void SetCoefficientImageInformationFromFixedParameters();
00301 
00302   BSplineTransform( const Self & ); // purposely not implemented
00303   void operator=( const Self & );   // purposely not implemented
00304 
00306   virtual bool InsideValidRegion( ContinuousIndexType & ) const;
00307 
00308   OriginType             m_TransformDomainOrigin;
00309   PhysicalDimensionsType m_TransformDomainPhysicalDimensions;
00310   DirectionType          m_TransformDomainDirection;
00311   DirectionType          m_TransformDomainDirectionInverse;
00312 
00313   MeshSizeType m_TransformDomainMeshSize;
00314 }; // class BSplineTransform
00315 }  // namespace itk
00316 
00317 // Define instantiation macro for this template.
00318 #define ITK_TEMPLATE_BSplineTransform(_, EXPORT, TypeX, TypeY)     \
00319   namespace itk                                                              \
00320   {                                                                          \
00321   _( 3 ( class EXPORT BSplineTransform<ITK_TEMPLATE_3 TypeX> ) ) \
00322   namespace Templates                                                        \
00323   {                                                                          \
00324   typedef BSplineTransform<ITK_TEMPLATE_3 TypeX>                 \
00325   BSplineTransform##TypeY;                                       \
00326   }                                                                          \
00327   }
00328 
00329 #if ITK_TEMPLATE_EXPLICIT
00330 // template < class TScalarType, unsigned int NDimensions, unsigned int
00331 // VSplineOrder >
00332 //   const unsigned int itk::BSplineTransform<TScalarType,
00333 // NDimensions, VSplineOrder >::SpaceDimension;
00334 // template < class TScalarType, unsigned int NDimensions, unsigned int
00335 // VSplineOrder >
00336 //   const unsigned int itk::BSplineTransform<TScalarType,
00337 // NDimensions, VSplineOrder >::SplineOrder;
00338 #include "Templates/itkBSplineTransform+-.h"
00339 #endif
00340 
00341 #if ITK_TEMPLATE_TXX
00342 #include "itkBSplineTransform.hxx"
00343 #endif
00344 
00345 #endif /* __itkBSplineTransform_h */
00346