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 
24 namespace itk::simple
25 {
26 
34 {
35 public:
38 
39  ~Similarity2DTransform() override;
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 
51  explicit Similarity2DTransform(const Transform &);
52 
54  operator=(const Similarity2DTransform &);
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>
76  GetTranslation() const;
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 
91 protected:
92  void
93  SetPimpleTransform(std::unique_ptr<PimpleTransformBase> && pimpleTransform) override;
94 
95 private:
96  void
97  InternalInitialization(itk::TransformBase * transform);
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
itk::simple::Similarity2DTransform::m_pfGetMatrix
std::function< std::vector< double >)> m_pfGetMatrix
Definition: sitkSimilarity2DTransform.h:111
itk::simple::Similarity2DTransform::m_pfSetTranslation
std::function< void(const std::vector< double > &)> m_pfSetTranslation
Definition: sitkSimilarity2DTransform.h:107
itk::simple::Similarity2DTransform::GetName
std::string GetName() const override
Definition: sitkSimilarity2DTransform.h:58
itk::simple::Transform
A simplified wrapper around a variety of ITK transforms.
Definition: sitkTransform.h:86
itk::simple::Similarity2DTransform::m_pfGetAngle
std::function< double()> m_pfGetAngle
Definition: sitkSimilarity2DTransform.h:106
sitkCommon.h
itk::simple::Similarity2DTransform::m_pfSetAngle
std::function< void(double)> m_pfSetAngle
Definition: sitkSimilarity2DTransform.h:105
itk::simple::Similarity2DTransform
A similarity 2D transform with rotation in radians and isotropic scaling around a fixed center with t...
Definition: sitkSimilarity2DTransform.h:33
itk::simple::Similarity2DTransform::m_pfGetCenter
std::function< std::vector< double >)> m_pfGetCenter
Definition: sitkSimilarity2DTransform.h:104
itk::simple::Similarity2DTransform::m_pfGetTranslation
std::function< std::vector< double >)> m_pfGetTranslation
Definition: sitkSimilarity2DTransform.h:108
SITKCommon_EXPORT
#define SITKCommon_EXPORT
Definition: sitkCommon.h:41
itk::simple::Similarity2DTransform::m_pfSetScale
std::function< void(double)> m_pfSetScale
Definition: sitkSimilarity2DTransform.h:109
sitkTransform.h
itk::simple::Similarity2DTransform::m_pfGetScale
std::function< double()> m_pfGetScale
Definition: sitkSimilarity2DTransform.h:110
itk::simple
Definition: sitkAdditionalProcedures.h:28
itk::TransformBaseTemplate
Definition: sitkTransform.h:32
itk::simple::Similarity2DTransform::m_pfSetMatrix
std::function< void(const std::vector< double > &, double)> m_pfSetMatrix
Definition: sitkSimilarity2DTransform.h:112
itk::simple::Similarity2DTransform::m_pfSetCenter
std::function< void(const std::vector< double > &)> m_pfSetCenter
Definition: sitkSimilarity2DTransform.h:103