SimpleITK  
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
24namespace itk::simple
25{
26
34{
35public:
38
40
41 explicit BSplineTransform(unsigned int dimensions, unsigned int order = 3);
42
52 explicit BSplineTransform(const std::vector<Image> & coefficientImages, unsigned int order = 3);
53
55
56 explicit BSplineTransform(const Transform &);
57
60
62 std::string
63 GetName() const override
64 {
65 return std::string("BSplineTransform");
66 }
67
69
71 SITK_RETURN_SELF_TYPE_HEADER
72 SetTransformDomainDirection(const std::vector<double> &);
73 std::vector<double>
75 SITK_RETURN_SELF_TYPE_HEADER
76 SetTransformDomainMeshSize(const std::vector<unsigned int> &);
77 std::vector<unsigned int>
79 SITK_RETURN_SELF_TYPE_HEADER
80 SetTransformDomainOrigin(const std::vector<double> &);
81 std::vector<double>
83 SITK_RETURN_SELF_TYPE_HEADER
84 SetTransformDomainPhysicalDimensions(const std::vector<double> &);
85 std::vector<double>
87
88 /* additional methods */
89
97 std::vector<Image>
99
100 unsigned int
101 GetOrder() const;
102
103protected:
104 void
105 SetPimpleTransform(std::unique_ptr<PimpleTransformBase> && pimpleTransform) override;
106
107private:
109 {
112 template <typename TransformType>
113 void
115 {
116 TransformType * t = dynamic_cast<TransformType *>(transform);
117 if (t && (typeid(*t) == typeid(TransformType)))
118 {
119 that->InternalInitialization<TransformType>(t);
120 }
121 }
122 };
123
124 void
126
127 template <typename TransformType>
128 void
129 InternalInitialization(TransformType * transform);
130
131 static PimpleTransformBase *
132 CreateBSplinePimpleTransform(unsigned int dimension, unsigned int order);
133
134 template <unsigned int ND>
135 static PimpleTransformBase *
136 CreateBSplinePimpleTransform(unsigned int order);
137
138 std::function<std::vector<double>()> m_pfGetTransformDomainDirection;
139 std::function<void(const std::vector<double> &)> m_pfSetTransformDomainDirection;
140 std::function<std::vector<unsigned int>()> m_pfGetTransformDomainMeshSize;
141 std::function<void(const std::vector<unsigned int> &)> m_pfSetTransformDomainMeshSize;
142 std::function<std::vector<double>()> m_pfGetTransformDomainOrigin;
143 std::function<void(const std::vector<double> &)> m_pfSetTransformDomainOrigin;
144 std::function<std::vector<double>()> m_pfGetTransformDomainPhysicalDimensions;
145 std::function<void(const std::vector<double> &)> m_pfSetTransformDomainPhysicalDimensions;
146
147 std::function<std::vector<Image>()> m_pfGetCoefficientImages;
148 std::function<unsigned int()> m_pfGetOrder;
149
150 std::function<void(const std::vector<Image> &)> m_pfSetCoefficientImages;
151};
152
153} // namespace itk::simple
154
155#endif // sitkBSplineTransform_h
Self & SetTransformDomainMeshSize(const std::vector< unsigned int > &)
void InternalInitialization(itk::TransformBase *transform)
std::string GetName() const override
static PimpleTransformBase * CreateBSplinePimpleTransform(unsigned int dimension, unsigned int order)
std::function< std::vector< double >()> m_pfGetTransformDomainDirection
std::function< std::vector< double >()> m_pfGetTransformDomainPhysicalDimensions
std::function< std::vector< Image >()> m_pfGetCoefficientImages
std::function< void(const std::vector< double > &)> m_pfSetTransformDomainOrigin
std::function< void(const std::vector< unsigned int > &)> m_pfSetTransformDomainMeshSize
BSplineTransform(const BSplineTransform &)
std::function< void(const std::vector< double > &)> m_pfSetTransformDomainDirection
unsigned int GetOrder() const
Self & SetTransformDomainDirection(const std::vector< double > &)
std::function< std::vector< double >()> m_pfGetTransformDomainOrigin
std::vector< Image > GetCoefficientImages() const
Get a vector of the coefficient images representing the BSpline.
std::vector< unsigned int > GetTransformDomainMeshSize() const
static PimpleTransformBase * CreateBSplinePimpleTransform(unsigned int order)
BSplineTransform(unsigned int dimensions, unsigned int order=3)
std::vector< double > GetTransformDomainPhysicalDimensions() const
std::function< void(const std::vector< Image > &)> m_pfSetCoefficientImages
void InternalInitialization(TransformType *transform)
void SetPimpleTransform(std::unique_ptr< PimpleTransformBase > &&pimpleTransform) override
std::vector< double > GetTransformDomainDirection() const
BSplineTransform(const Transform &)
std::function< void(const std::vector< double > &)> m_pfSetTransformDomainPhysicalDimensions
std::function< std::vector< unsigned int >()> m_pfGetTransformDomainMeshSize
Self & SetTransformDomainOrigin(const std::vector< double > &)
std::function< unsigned int()> m_pfGetOrder
Self & SetTransformDomainPhysicalDimensions(const std::vector< double > &)
std::vector< double > GetTransformDomainOrigin() const
BSplineTransform & operator=(const BSplineTransform &)
BSplineTransform(const std::vector< Image > &coefficientImages, unsigned int order=3)
Transform()
By default a 3-d identity transform is constructed.
TransformBaseTemplate< double > TransformBase
#define SITKCommon_EXPORT
Definition sitkCommon.h:41