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  : public Transform
35 {
36 public:
39 
40  ~Similarity2DTransform() override;
41 
42  // construct identity
44 
45  explicit Similarity2DTransform( double scaleFactor,
46  double angle=0.0,
47  const std::vector<double> &translation = std::vector<double>(2,0.0),
48  const std::vector< double > &fixedCenter = std::vector<double>(2,0.0) );
49 
51 
52  explicit Similarity2DTransform( const Transform & );
53 
54  Similarity2DTransform &operator=( const Similarity2DTransform & );
55 
57  std::string GetName() const override { return std::string ("Similarity2DTransform"); }
58 
60  SITK_RETURN_SELF_TYPE_HEADER SetCenter(const std::vector<double> &params);
61  std::vector<double> GetCenter( ) const;
62 
64  SITK_RETURN_SELF_TYPE_HEADER SetAngle (double angle);
65  double GetAngle () const;
66 
67  std::vector<double> GetTranslation( ) const;
68  SITK_RETURN_SELF_TYPE_HEADER SetTranslation(const std::vector<double>& translation);
69 
70  SITK_RETURN_SELF_TYPE_HEADER SetScale(double scale);
71  double GetScale() const;
72 
74  std::vector<double> GetMatrix() const;
75  SITK_RETURN_SELF_TYPE_HEADER SetMatrix(const std::vector<double> &matrix, double tolerance = 1e-10);
76 
77 protected:
78 
79  void SetPimpleTransform(std::unique_ptr<PimpleTransformBase> && pimpleTransform ) override;
80 
81 private:
82 
83  void InternalInitialization(itk::TransformBase *transform);
84 
85  template <typename TransformType>
86  void InternalInitialization(TransformType *transform);
87 
88  std::function<void(const std::vector<double>&)> m_pfSetCenter;
89  std::function<std::vector<double>()> m_pfGetCenter;
90  std::function<void(double)> m_pfSetAngle;
91  std::function<double()> m_pfGetAngle;
92  std::function<void(const std::vector<double>&)> m_pfSetTranslation;
93  std::function<std::vector<double>()> m_pfGetTranslation;
94  std::function<void(double)> m_pfSetScale;
95  std::function<double()> m_pfGetScale;
96  std::function<std::vector<double>()> m_pfGetMatrix;
97  std::function<void(const std::vector<double>&, double)> m_pfSetMatrix;
98 };
99 
100 }
101 
102 #endif // sitkSimilarity2DTransform_h
itk::simple::Similarity2DTransform::m_pfGetMatrix
std::function< std::vector< double >)> m_pfGetMatrix
Definition: sitkSimilarity2DTransform.h:96
itk::simple::Similarity2DTransform::m_pfSetCenter
std::function< void(const std::vector< double > &)> m_pfSetCenter
Definition: sitkSimilarity2DTransform.h:88
itk::simple::Similarity2DTransform::GetName
std::string GetName() const override
Definition: sitkSimilarity2DTransform.h:57
itk::simple::Transform
A simplified wrapper around a variety of ITK transforms.
Definition: sitkTransform.h:81
itk::simple::Similarity2DTransform::m_pfGetAngle
std::function< double()> m_pfGetAngle
Definition: sitkSimilarity2DTransform.h:91
sitkCommon.h
itk::simple::Similarity2DTransform::m_pfSetAngle
std::function< void(double)> m_pfSetAngle
Definition: sitkSimilarity2DTransform.h:90
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:89
itk::simple::Similarity2DTransform::m_pfGetTranslation
std::function< std::vector< double >)> m_pfGetTranslation
Definition: sitkSimilarity2DTransform.h:93
SITKCommon_EXPORT
#define SITKCommon_EXPORT
Definition: sitkCommon.h:41
itk::simple::Similarity2DTransform::m_pfSetScale
std::function< void(double)> m_pfSetScale
Definition: sitkSimilarity2DTransform.h:94
itk::simple::Similarity2DTransform::m_pfSetTranslation
std::function< void(const std::vector< double > &)> m_pfSetTranslation
Definition: sitkSimilarity2DTransform.h:92
sitkTransform.h
itk::simple::Similarity2DTransform::m_pfGetScale
std::function< double()> m_pfGetScale
Definition: sitkSimilarity2DTransform.h:95
itk::simple::Similarity2DTransform::m_pfSetMatrix
std::function< void(const std::vector< double > &, double)> m_pfSetMatrix
Definition: sitkSimilarity2DTransform.h:97
itk::simple
Definition: sitkAdditionalProcedures.h:28
itk::TransformBaseTemplate
Definition: sitkTransform.h:30