SimpleITK  1.3.0.dev466
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 
36  : public Transform
37 {
38 public:
41 
42  virtual ~BSplineTransform();
43 
44  explicit BSplineTransform(unsigned int dimensions, unsigned int order=3);
45 
55  explicit BSplineTransform( const std::vector<Image> &coefficientImages, unsigned int order=3 );
56 
58 
59  explicit BSplineTransform( const Transform &);
60 
61  BSplineTransform &operator=( const BSplineTransform & );
62 
64  std::string GetName() const { return std::string ("BSplineTransform"); }
65 
69  SITK_RETURN_SELF_TYPE_HEADER SetTransformDomainDirection(const std::vector<double> &);
70  std::vector<double> GetTransformDomainDirection() const;
71  SITK_RETURN_SELF_TYPE_HEADER SetTransformDomainMeshSize(const std::vector<unsigned int>&);
72  std::vector<unsigned int> GetTransformDomainMeshSize() const;
73  SITK_RETURN_SELF_TYPE_HEADER SetTransformDomainOrigin(const std::vector<double>&);
74  std::vector<double> GetTransformDomainOrigin() const;
75  SITK_RETURN_SELF_TYPE_HEADER SetTransformDomainPhysicalDimensions(const std::vector<double> &);
76  std::vector<double> GetTransformDomainPhysicalDimensions() const;
77 
78  /* additional methods */
79 
87  std::vector<Image> GetCoefficientImages () const;
88 
89  unsigned int GetOrder() const;
90 
91 protected:
92 
93  virtual void SetPimpleTransform( PimpleTransformBase *pimpleTransform );
94 
95 private:
96 
97  using Superclass::AddTransform;
98 
99  struct MyVisitor
100  {
103  template< typename TransformType >
104  void operator() ( void ) const
105  {
106  TransformType *t = dynamic_cast<TransformType*>(transform);
107  if (t && (typeid(*t) == typeid(TransformType)))
108  {
109  that->InternalInitialization<TransformType>(t);
110  }
111  }
112  };
113 
114  void InternalInitialization(itk::TransformBase *transform);
115 
116  template <typename TransformType>
117  void InternalInitialization(TransformType *transform);
118 
119  static PimpleTransformBase *CreateBSplinePimpleTransform(unsigned int dimension, unsigned int order);
120 
121  template <unsigned int ND>
122  static PimpleTransformBase *CreateBSplinePimpleTransform(unsigned int order);
123 
124  nsstd::function<std::vector<double> ()> m_pfGetTransformDomainDirection;
125  nsstd::function<void (const std::vector<double> &)> m_pfSetTransformDomainDirection;
126  nsstd::function<std::vector<unsigned int> ()> m_pfGetTransformDomainMeshSize;
127  nsstd::function<void (const std::vector<unsigned int>&)> m_pfSetTransformDomainMeshSize;
128  nsstd::function<std::vector<double> ()> m_pfGetTransformDomainOrigin;
129  nsstd::function<void (const std::vector<double>&)> m_pfSetTransformDomainOrigin;
130  nsstd::function<std::vector<double> ()> m_pfGetTransformDomainPhysicalDimensions;
131  nsstd::function<void (const std::vector<double> &)> m_pfSetTransformDomainPhysicalDimensions;
132 
133  nsstd::function<std::vector<Image> ()> m_pfGetCoefficientImages;
134  nsstd::function< unsigned int()> m_pfGetOrder;
135 
136  nsstd::function<void (const std::vector<Image> &)> m_pfSetCoefficientImages;
137 
138 };
139 
140 }
141 }
142 
143 #endif // sitkBSplineTransform_h
A simplified wrapper around a variety of ITK transforms.
Definition: sitkTransform.h:84
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)