SimpleITK  1.0.1
sitkBSplineTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2 *
3 * Copyright Insight Software Consortium
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0.txt
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 *=========================================================================*/
18 #ifndef sitkBSplineTransform_h
19 #define sitkBSplineTransform_h
20 
21 #include "sitkCommon.h"
22 #include "sitkTransform.h"
23 
24 namespace itk
25 {
26 namespace simple
27 {
28 
35  : public Transform
36 {
37 public:
40 
41  explicit BSplineTransform(unsigned int dimensions, unsigned int order=3);
42 
44 
45  explicit BSplineTransform( const Transform &);
46 
47  BSplineTransform &operator=( const BSplineTransform & );
48 
50  std::string GetName() const { return std::string ("BSplineTransform"); }
51 
55  SITK_RETURN_SELF_TYPE_HEADER SetTransformDomainDirection(const std::vector<double> &);
56  std::vector<double> GetTransformDomainDirection() const;
57  SITK_RETURN_SELF_TYPE_HEADER SetTransformDomainMeshSize(const std::vector<unsigned int>&);
58  std::vector<unsigned int> GetTransformDomainMeshSize() const;
59  SITK_RETURN_SELF_TYPE_HEADER SetTransformDomainOrigin(const std::vector<double>&);
60  std::vector<double> GetTransformDomainOrigin() const;
61  SITK_RETURN_SELF_TYPE_HEADER SetTransformDomainPhysicalDimensions(const std::vector<double> &);
62  std::vector<double> GetTransformDomainPhysicalDimensions() const;
63 
64  /* additional methods */
65 
73  std::vector<Image> GetCoefficientImages () const;
74 
75  unsigned int GetOrder() const;
76 
77 protected:
78 
79  virtual void SetPimpleTransform( PimpleTransformBase *pimpleTransform );
80 
81 private:
82 
83  using Superclass::AddTransform;
84 
85  struct MyVisitor
86  {
89  template< typename TransformType >
90  void operator() ( void ) const
91  {
92  TransformType *t = dynamic_cast<TransformType*>(transform);
93  if (t && (typeid(*t)==typeid(TransformType)))
94  {
95  that->InternalInitialization<TransformType>(t);
96  }
97  }
98  };
99 
100  void InternalInitialization(itk::TransformBase *transform);
101 
102  template <typename TransformType>
103  void InternalInitialization(TransformType *transform);
104 
105  static PimpleTransformBase *CreateBSplinePimpleTransform(unsigned int dimension, unsigned int order);
106 
107  template <unsigned int ND>
108  static PimpleTransformBase *CreateBSplinePimpleTransform(unsigned int order);
109 
110  nsstd::function<std::vector<double> ()> m_pfGetTransformDomainDirection;
111  nsstd::function<void (const std::vector<double> &)> m_pfSetTransformDomainDirection;
112  nsstd::function<std::vector<unsigned int> ()> m_pfGetTransformDomainMeshSize;
113  nsstd::function<void (const std::vector<unsigned int>&)> m_pfSetTransformDomainMeshSize;
114  nsstd::function<std::vector<double> ()> m_pfGetTransformDomainOrigin;
115  nsstd::function<void (const std::vector<double>&)> m_pfSetTransformDomainOrigin;
116  nsstd::function<std::vector<double> ()> m_pfGetTransformDomainPhysicalDimensions;
117  nsstd::function<void (const std::vector<double> &)> m_pfSetTransformDomainPhysicalDimensions;
118 
119  nsstd::function<std::vector<Image> ()> m_pfGetCoefficientImages;
120  nsstd::function< unsigned int()> m_pfGetOrder;
121 
122 };
123 
124 }
125 }
126 
127 #endif // sitkBSplineTransform_h
A simplified wrapper around a variety of ITK transforms.
Definition: sitkTransform.h:83
A deformable transform over a bounded spatial domain using a BSpline representation for a 2D or 3D co...
#define SITKCommon_EXPORT
Definition: sitkCommon.h:41
nsstd::function< unsigned int()> m_pfGetOrder
void InternalInitialization(itk::TransformBase *transform)