SimpleITK  
sitkSimilarity2DTransform.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 sitkSimilarity2DTransform_h
19#define sitkSimilarity2DTransform_h
20
21#include "sitkCommon.h"
22#include "sitkTransform.h"
23
24namespace itk::simple
25{
26
34{
35public:
38
40
41 // construct identity
43
44 explicit Similarity2DTransform(double scaleFactor,
45 double angle = 0.0,
46 const std::vector<double> & translation = std::vector<double>(2, 0.0),
47 const std::vector<double> & fixedCenter = std::vector<double>(2, 0.0));
48
50
52
55
57 std::string
58 GetName() const override
59 {
60 return std::string("Similarity2DTransform");
61 }
62
64 SITK_RETURN_SELF_TYPE_HEADER
65 SetCenter(const std::vector<double> & params);
66 std::vector<double>
67 GetCenter() const;
68
70 SITK_RETURN_SELF_TYPE_HEADER
71 SetAngle(double angle);
72 double
73 GetAngle() const;
74
75 std::vector<double>
77 SITK_RETURN_SELF_TYPE_HEADER
78 SetTranslation(const std::vector<double> & translation);
79
80 SITK_RETURN_SELF_TYPE_HEADER
81 SetScale(double scale);
82 double
83 GetScale() const;
84
86 std::vector<double>
87 GetMatrix() const;
88 SITK_RETURN_SELF_TYPE_HEADER
89 SetMatrix(const std::vector<double> & matrix, double tolerance = 1e-10);
90
91protected:
92 void
93 SetPimpleTransform(std::unique_ptr<PimpleTransformBase> && pimpleTransform) override;
94
95private:
96 void
98
99 template <typename TransformType>
100 void
101 InternalInitialization(TransformType * transform);
102
103 std::function<void(const std::vector<double> &)> m_pfSetCenter;
104 std::function<std::vector<double>()> m_pfGetCenter;
105 std::function<void(double)> m_pfSetAngle;
106 std::function<double()> m_pfGetAngle;
107 std::function<void(const std::vector<double> &)> m_pfSetTranslation;
108 std::function<std::vector<double>()> m_pfGetTranslation;
109 std::function<void(double)> m_pfSetScale;
110 std::function<double()> m_pfGetScale;
111 std::function<std::vector<double>()> m_pfGetMatrix;
112 std::function<void(const std::vector<double> &, double)> m_pfSetMatrix;
113};
114
115} // namespace itk::simple
116
117#endif // sitkSimilarity2DTransform_h
std::function< void(const std::vector< double > &)> m_pfSetCenter
void SetPimpleTransform(std::unique_ptr< PimpleTransformBase > &&pimpleTransform) override
std::vector< double > GetMatrix() const
std::function< void(const std::vector< double > &)> m_pfSetTranslation
Similarity2DTransform(const Transform &)
Self & SetCenter(const std::vector< double > &params)
std::vector< double > GetCenter() const
Similarity2DTransform(const Similarity2DTransform &)
Self & SetMatrix(const std::vector< double > &matrix, double tolerance=1e-10)
std::function< std::vector< double >()> m_pfGetTranslation
std::function< std::vector< double >()> m_pfGetCenter
void InternalInitialization(TransformType *transform)
Similarity2DTransform & operator=(const Similarity2DTransform &)
Self & SetTranslation(const std::vector< double > &translation)
std::function< void(const std::vector< double > &, double)> m_pfSetMatrix
void InternalInitialization(itk::TransformBase *transform)
Similarity2DTransform(double scaleFactor, double angle=0.0, const std::vector< double > &translation=std::vector< double >(2, 0.0), const std::vector< double > &fixedCenter=std::vector< double >(2, 0.0))
std::function< std::vector< double >()> m_pfGetMatrix
std::vector< double > GetTranslation() const
Transform()
By default a 3-d identity transform is constructed.
TransformBaseTemplate< double > TransformBase
#define SITKCommon_EXPORT
Definition sitkCommon.h:41