SimpleITK  2.0.0
sitkBSplineTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2 *
3 * Copyright NumFOCUS
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  ~BSplineTransform() override;
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 override { 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  void SetPimpleTransform( PimpleTransformBase *pimpleTransform ) override;
94 
95 private:
96 
97  struct MyVisitor
98  {
101  template< typename TransformType >
102  void operator() ( ) const
103  {
104  TransformType *t = dynamic_cast<TransformType*>(transform);
105  if (t && (typeid(*t) == typeid(TransformType)))
106  {
107  that->InternalInitialization<TransformType>(t);
108  }
109  }
110  };
111 
112  void InternalInitialization(itk::TransformBase *transform);
113 
114  template <typename TransformType>
115  void InternalInitialization(TransformType *transform);
116 
117  static PimpleTransformBase *CreateBSplinePimpleTransform(unsigned int dimension, unsigned int order);
118 
119  template <unsigned int ND>
120  static PimpleTransformBase *CreateBSplinePimpleTransform(unsigned int order);
121 
122  std::function<std::vector<double> ()> m_pfGetTransformDomainDirection;
123  std::function<void (const std::vector<double> &)> m_pfSetTransformDomainDirection;
124  std::function<std::vector<unsigned int> ()> m_pfGetTransformDomainMeshSize;
125  std::function<void (const std::vector<unsigned int>&)> m_pfSetTransformDomainMeshSize;
126  std::function<std::vector<double> ()> m_pfGetTransformDomainOrigin;
127  std::function<void (const std::vector<double>&)> m_pfSetTransformDomainOrigin;
128  std::function<std::vector<double> ()> m_pfGetTransformDomainPhysicalDimensions;
129  std::function<void (const std::vector<double> &)> m_pfSetTransformDomainPhysicalDimensions;
130 
131  std::function<std::vector<Image> ()> m_pfGetCoefficientImages;
132  std::function< unsigned int()> m_pfGetOrder;
133 
134  std::function<void (const std::vector<Image> &)> m_pfSetCoefficientImages;
135 
136 };
137 
138 }
139 }
140 
141 #endif // sitkBSplineTransform_h
itk::simple::BSplineTransform::m_pfSetCoefficientImages
std::function< void(const std::vector< Image > &)> m_pfSetCoefficientImages
Definition: sitkBSplineTransform.h:134
itk::simple::Transform
A simplified wrapper around a variety of ITK transforms.
Definition: sitkTransform.h:80
itk::simple::BSplineTransform::MyVisitor::that
BSplineTransform * that
Definition: sitkBSplineTransform.h:100
itk::simple::BSplineTransform::GetName
std::string GetName() const override
Definition: sitkBSplineTransform.h:64
sitkCommon.h
itk::simple::BSplineTransform::MyVisitor::transform
itk::TransformBase * transform
Definition: sitkBSplineTransform.h:99
itk::simple::BSplineTransform::m_pfSetTransformDomainOrigin
std::function< void(const std::vector< double > &)> m_pfSetTransformDomainOrigin
Definition: sitkBSplineTransform.h:127
itk::simple::BSplineTransform::m_pfGetTransformDomainMeshSize
std::function< std::vector< unsigned int >)> m_pfGetTransformDomainMeshSize
Definition: sitkBSplineTransform.h:124
itk::simple::BSplineTransform::m_pfSetTransformDomainPhysicalDimensions
std::function< void(const std::vector< double > &)> m_pfSetTransformDomainPhysicalDimensions
Definition: sitkBSplineTransform.h:129
itk::simple::BSplineTransform::m_pfGetTransformDomainOrigin
std::function< std::vector< double >)> m_pfGetTransformDomainOrigin
Definition: sitkBSplineTransform.h:126
itk::simple::BSplineTransform::m_pfGetTransformDomainPhysicalDimensions
std::function< std::vector< double >)> m_pfGetTransformDomainPhysicalDimensions
Definition: sitkBSplineTransform.h:128
itk::simple::BSplineTransform::m_pfGetCoefficientImages
std::function< std::vector< Image >)> m_pfGetCoefficientImages
Definition: sitkBSplineTransform.h:131
SITKCommon_EXPORT
#define SITKCommon_EXPORT
Definition: sitkCommon.h:41
itk::simple::BSplineTransform::m_pfGetTransformDomainDirection
std::function< std::vector< double >)> m_pfGetTransformDomainDirection
Definition: sitkBSplineTransform.h:122
sitkTransform.h
itk::simple::BSplineTransform::InternalInitialization
void InternalInitialization(itk::TransformBase *transform)
itk
itk::simple::BSplineTransform::m_pfSetTransformDomainMeshSize
std::function< void(const std::vector< unsigned int > &)> m_pfSetTransformDomainMeshSize
Definition: sitkBSplineTransform.h:125
itk::simple::BSplineTransform::m_pfGetOrder
std::function< unsigned int()> m_pfGetOrder
Definition: sitkBSplineTransform.h:132
itk::simple::BSplineTransform::m_pfSetTransformDomainDirection
std::function< void(const std::vector< double > &)> m_pfSetTransformDomainDirection
Definition: sitkBSplineTransform.h:123
itk::simple::BSplineTransform
A deformable transform over a bounded spatial domain using a BSpline representation for a 2D or 3D co...
Definition: sitkBSplineTransform.h:35
itk::TransformBaseTemplate
Definition: sitkTransform.h:30
itk::simple::BSplineTransform::MyVisitor
Definition: sitkBSplineTransform.h:97