Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
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,
00125 unsigned int NDimensions = 3,
00126 unsigned int VSplineOrder = 3 >
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 typedef typename Superclass::BulkTransformType BulkTransformType;
00195 typedef typename Superclass::BulkTransformPointer BulkTransformPointer;
00196
00198 OutputPointType TransformPoint( const InputPointType & point ) const;
00199
00201 typedef BSplineInterpolationWeightFunction2< ScalarType,
00202 itkGetStaticConstMacro( SpaceDimension ),
00203 itkGetStaticConstMacro( SplineOrder ) > WeightsFunctionType;
00204 typedef typename WeightsFunctionType::WeightsType WeightsType;
00205 typedef typename WeightsFunctionType::ContinuousIndexType ContinuousIndexType;
00206 typedef BSplineInterpolationDerivativeWeightFunction<
00207 ScalarType,
00208 itkGetStaticConstMacro( SpaceDimension ),
00209 itkGetStaticConstMacro( SplineOrder ) > DerivativeWeightsFunctionType;
00210 typedef BSplineInterpolationSecondOrderDerivativeWeightFunction<
00211 ScalarType,
00212 itkGetStaticConstMacro( SpaceDimension ),
00213 itkGetStaticConstMacro( SplineOrder ) > SODerivativeWeightsFunctionType;
00214
00216 typedef typename Superclass::ParameterIndexArrayType ParameterIndexArrayType;
00217
00225 virtual void TransformPoint(
00226 const InputPointType & inputPoint,
00227 OutputPointType & outputPoint,
00228 WeightsType & weights,
00229 ParameterIndexArrayType & indices,
00230 bool & inside ) const;
00231
00233 unsigned long GetNumberOfWeights( void ) const
00234 {
00235 return this->m_WeightsFunction->GetNumberOfWeights();
00236 }
00237
00238 unsigned int GetNumberOfAffectedWeights( void ) const;
00239
00240 virtual unsigned long GetNumberOfNonZeroJacobianIndices( void ) const;
00241
00243 virtual bool GetHasNonZeroSpatialHessian( void ) const
00244 {
00245 return true;
00246 }
00247 virtual bool HasNonZeroJacobianOfSpatialHessian( void ) const
00248 {
00249 return true;
00250 }
00251
00253 virtual const JacobianType & GetJacobian( const InputPointType & point ) const;
00254
00256 virtual void GetJacobian(
00257 const InputPointType & ipp,
00258 WeightsType & weights,
00259 ParameterIndexArrayType & indices ) const;
00260
00262 virtual void GetJacobian(
00263 const InputPointType & ipp,
00264 JacobianType & j,
00265 NonZeroJacobianIndicesType & ) const;
00266
00268 virtual void GetSpatialJacobian(
00269 const InputPointType & ipp,
00270 SpatialJacobianType & sj ) const;
00271
00273 virtual void GetSpatialHessian(
00274 const InputPointType & ipp,
00275 SpatialHessianType & sh ) const;
00276
00278 virtual void GetJacobianOfSpatialJacobian(
00279 const InputPointType & ipp,
00280 JacobianOfSpatialJacobianType & jsj,
00281 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00282
00286 virtual void GetJacobianOfSpatialJacobian(
00287 const InputPointType & ipp,
00288 SpatialJacobianType & sj,
00289 JacobianOfSpatialJacobianType & jsj,
00290 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00291
00293 virtual void GetJacobianOfSpatialHessian(
00294 const InputPointType & ipp,
00295 JacobianOfSpatialHessianType & jsh,
00296 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00297
00301 virtual void GetJacobianOfSpatialHessian(
00302 const InputPointType & ipp,
00303 SpatialHessianType & sh,
00304 JacobianOfSpatialHessianType & jsh,
00305 NonZeroJacobianIndicesType & nonZeroJacobianIndices ) const;
00306
00307 protected:
00309 virtual void PrintSelf( std::ostream &os, Indent indent ) const;
00310
00311 AdvancedBSplineDeformableTransform();
00312 virtual ~AdvancedBSplineDeformableTransform();
00313
00315
00316 itkSetObjectMacro( WeightsFunction, WeightsFunctionType );
00317 itkGetObjectMacro( WeightsFunction, WeightsFunctionType );
00318
00320 void WrapAsImages( void );
00321
00322 virtual void ComputeNonZeroJacobianIndices(
00323 NonZeroJacobianIndicesType & nonZeroJacobianIndices,
00324 const RegionType & supportRegion ) const;
00325
00326 typedef typename Superclass::JacobianImageType JacobianImageType;
00327 typedef typename Superclass::JacobianPixelType JacobianPixelType;
00328
00333 typename WeightsFunctionType::Pointer m_WeightsFunction;
00334 std::vector<
00335 typename DerivativeWeightsFunctionType::Pointer > m_DerivativeWeightsFunctions;
00336 std::vector< std::vector<
00337 typename SODerivativeWeightsFunctionType::Pointer > > m_SODerivativeWeightsFunctions;
00338
00339 private:
00340 AdvancedBSplineDeformableTransform(const Self&);
00341 void operator=(const Self&);
00342
00343 };
00344
00345
00346 }
00347
00348
00349 #define ITK_TEMPLATE_AdvancedBSplineDeformableTransform(_, EXPORT, x, y) namespace itk { \
00350 _(3(class EXPORT AdvancedBSplineDeformableTransform< ITK_TEMPLATE_3 x >)) \
00351 namespace Templates { typedef AdvancedBSplineDeformableTransform< ITK_TEMPLATE_3 x > \
00352 AdvancedBSplineDeformableTransform##y; } \
00353 }
00354
00355 #if ITK_TEMPLATE_EXPLICIT
00356 # include "Templates/itkAdvancedBSplineDeformableTransform+-.h"
00357 #endif
00358
00359 #if ITK_TEMPLATE_TXX
00360 # include "itkAdvancedBSplineDeformableTransform.txx"
00361 #endif
00362
00363 #endif