Orfeo Toolbox  3.16
itkBSplineDeformableTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Insight Segmentation & Registration Toolkit
4  Module: $RCSfile: itkBSplineDeformableTransform.h,v $
5  Language: C++
6  Date: $Date: 2010-03-05 15:26:30 $
7  Version: $Revision: 1.42 $
8 
9  Copyright (c) Insight Software Consortium. All rights reserved.
10  See ITKCopyright.txt or http://www.itk.org/HTML/Copyright.htm for details.
11 
12  This software is distributed WITHOUT ANY WARRANTY; without even
13  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
14  PURPOSE. See the above copyright notices for more information.
15 
16 =========================================================================*/
17 
18 #ifndef __itkBSplineDeformableTransform_h
19 #define __itkBSplineDeformableTransform_h
20 
21 #include <iostream>
22 #include "itkTransform.h"
23 #include "itkImage.h"
24 #include "itkImageRegion.h"
26 
27 namespace itk
28 {
29 
107 template <
108  class TScalarType = double, // Data type for scalars
109  unsigned int NDimensions = 3, // Number of dimensions
110  unsigned int VSplineOrder = 3 > // Spline order
112  public Transform< TScalarType, NDimensions, NDimensions >
113 {
114 public:
120 
122  static Pointer New(void);
123 
126  virtual ::itk::LightObject::Pointer CreateAnother(void) const;
127 
129  itkTypeMacro( BSplineDeformableTransform, Transform );
130 
132  itkStaticConstMacro(SpaceDimension, unsigned int, NDimensions);
133 
135  itkStaticConstMacro(SplineOrder, unsigned int, VSplineOrder);
136 
139 
142 
145 
147  typedef Vector<TScalarType,
148  itkGetStaticConstMacro(SpaceDimension)> InputVectorType;
149  typedef Vector<TScalarType,
150  itkGetStaticConstMacro(SpaceDimension)> OutputVectorType;
151 
153  typedef CovariantVector<TScalarType,
154  itkGetStaticConstMacro(SpaceDimension)> InputCovariantVectorType;
155  typedef CovariantVector<TScalarType,
156  itkGetStaticConstMacro(SpaceDimension)> OutputCovariantVectorType;
157 
159  typedef vnl_vector_fixed<TScalarType,
160  itkGetStaticConstMacro(SpaceDimension)> InputVnlVectorType;
161  typedef vnl_vector_fixed<TScalarType,
162  itkGetStaticConstMacro(SpaceDimension)> OutputVnlVectorType;
163 
165  typedef Point<TScalarType,
166  itkGetStaticConstMacro(SpaceDimension)> InputPointType;
167  typedef Point<TScalarType,
168  itkGetStaticConstMacro(SpaceDimension)> OutputPointType;
169 
189  void SetParameters(const ParametersType & parameters);
190 
207  void SetFixedParameters(const ParametersType & parameters);
208 
226  void SetParametersByValue(const ParametersType & parameters);
227 
236  void SetIdentity();
237 
239  virtual const ParametersType& GetParameters(void) const;
240 
242  virtual const ParametersType& GetFixedParameters(void) const;
243 
245  typedef typename ParametersType::ValueType PixelType;
248 
250  virtual ImagePointer * GetCoefficientImage()
251  { return m_CoefficientImage; }
252  virtual const ImagePointer * GetCoefficientImage() const
253  { return m_CoefficientImage; }
254 
267  virtual void SetCoefficientImage( ImagePointer images[] );
268 
271 
272  typedef typename RegionType::IndexType IndexType;
273  typedef typename RegionType::SizeType SizeType;
277 
279  virtual void SetGridRegion( const RegionType& region );
280  itkGetConstMacro( GridRegion, RegionType );
281 
283  virtual void SetGridSpacing( const SpacingType& spacing );
284  itkGetConstMacro( GridSpacing, SpacingType );
285 
287  virtual void SetGridDirection( const DirectionType & spacing );
288  itkGetConstMacro( GridDirection, DirectionType );
289 
291  virtual void SetGridOrigin( const OriginType& origin );
292  itkGetConstMacro( GridOrigin, OriginType );
293 
295  typedef Transform<ScalarType,itkGetStaticConstMacro(SpaceDimension),
296  itkGetStaticConstMacro(SpaceDimension)> BulkTransformType;
298 
302  itkSetConstObjectMacro( BulkTransform, BulkTransformType );
303  itkGetConstObjectMacro( BulkTransform, BulkTransformType );
304 
306  OutputPointType TransformPoint(const InputPointType &point ) const;
307 
310  itkGetStaticConstMacro(SpaceDimension),
311  itkGetStaticConstMacro(SplineOrder)> WeightsFunctionType;
315 
318 
326  virtual void TransformPoint( const InputPointType & inputPoint,
327  OutputPointType & outputPoint,
328  WeightsType & weights,
329  ParameterIndexArrayType & indices,
330  bool & inside ) const;
331 
332  virtual void GetJacobian( const InputPointType & inputPoint,
333  WeightsType & weights,
334  ParameterIndexArrayType & indices
335  ) const;
336 
337 
339  unsigned long GetNumberOfWeights() const
340  { return m_WeightsFunction->GetNumberOfWeights(); }
341 
344  virtual OutputVectorType TransformVector(const InputVectorType &) const
345  {
346  itkExceptionMacro(<< "Method not applicable for deformable transform." );
347  return OutputVectorType();
348  }
349 
352  virtual OutputVnlVectorType TransformVector(const InputVnlVectorType &) const
353  {
354  itkExceptionMacro(<< "Method not applicable for deformable transform. ");
355  return OutputVnlVectorType();
356  }
357 
360  virtual OutputCovariantVectorType TransformCovariantVector(
361  const InputCovariantVectorType &) const
362  {
363  itkExceptionMacro(<< "Method not applicable for deformable transfrom. ");
364  return OutputCovariantVectorType();
365  }
366 
368  virtual const JacobianType& GetJacobian(const InputPointType &point ) const;
369 
371  virtual unsigned int GetNumberOfParameters(void) const;
372 
374  unsigned int GetNumberOfParametersPerDimension(void) const;
375 
377  itkGetConstReferenceMacro( ValidRegion, RegionType );
378 
384  virtual bool IsLinear() const { return false; }
385 
386  unsigned int GetNumberOfAffectedWeights() const;
387 
388 protected:
390  void PrintSelf(std::ostream &os, Indent indent) const;
391 
392 
394  virtual ~BSplineDeformableTransform();
395 
397  itkSetObjectMacro( WeightsFunction, WeightsFunctionType );
398  itkGetObjectMacro( WeightsFunction, WeightsFunctionType );
399 
401  void WrapAsImages();
402 
404  void TransformPointToContinuousIndex(
405  const InputPointType & point, ContinuousIndexType & index ) const;
406 
407 private:
408  BSplineDeformableTransform(const Self&); //purposely not implemented
409  void operator=(const Self&); //purposely not implemented
410 
413 
419 
422 
424 
426  unsigned long m_Offset;
431 
433  ImagePointer m_WrappedImage[NDimensions];
434 
437  ImagePointer m_CoefficientImage[NDimensions];
438 
441  typedef Image<JacobianPixelType,
442  itkGetStaticConstMacro(SpaceDimension)> JacobianImageType;
443 
444  typename JacobianImageType::Pointer m_JacobianImage[NDimensions];
445 
450 
453 
456 
459 
461  bool InsideValidRegion( const ContinuousIndexType& index ) const;
462 
463 
464 }; //class BSplineDeformableTransform
465 
466 
467 } // namespace itk
468 
469 // Define instantiation macro for this template.
470 #define ITK_TEMPLATE_BSplineDeformableTransform(_, EXPORT, x, y) namespace itk { \
471  _(3(class EXPORT BSplineDeformableTransform< ITK_TEMPLATE_3 x >)) \
472  namespace Templates { typedef BSplineDeformableTransform< ITK_TEMPLATE_3 x > \
473  BSplineDeformableTransform##y; } \
474  }
475 
476 #if ITK_TEMPLATE_EXPLICIT
477 # include "Templates/itkBSplineDeformableTransform+-.h"
478 #endif
479 
480 #if ITK_TEMPLATE_TXX
482 #endif
483 
484 #endif /* __itkBSplineDeformableTransform_h */

Generated at Sat May 11 2013 23:33:13 for Orfeo Toolbox with doxygen 1.8.3.1