SimpleITK  
sitkScaleTransform.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 sitkScaleTransform_h
19 #define sitkScaleTransform_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  ~ScaleTransform() override;
41 
42  explicit ScaleTransform(unsigned int dimensions,
43  const std::vector<double> &scale = std::vector<double>(3,1.0) );
44 
45  ScaleTransform( const ScaleTransform & );
46 
47  explicit ScaleTransform( const Transform & );
48 
50  std::string GetName() const override { return std::string ("ScaleTransform"); }
51 
52  ScaleTransform &operator=( const ScaleTransform & );
53 
54 
55  SITK_RETURN_SELF_TYPE_HEADER SetScale(const std::vector<double> &params);
56  std::vector<double> GetScale( ) const;
57 
59  SITK_RETURN_SELF_TYPE_HEADER SetCenter(const std::vector<double> &params);
60  std::vector<double> GetCenter( ) const;
61 
63  std::vector<double> GetMatrix() const;
64 
65 protected:
66 
67  void SetPimpleTransform(std::unique_ptr<PimpleTransformBase> && pimpleTransform ) override;
68 
69 private:
70 
71  struct MyVisitor
72  {
75  template< typename TransformType >
76  void operator() ( ) const
77  {
78  TransformType *t = dynamic_cast<TransformType*>(transform);
79  if (t && (typeid(*t) == typeid(TransformType)))
80  {
81  that->InternalInitialization<TransformType>(t);
82  }
83  }
84  };
85 
86  void InternalInitialization(itk::TransformBase *transform);
87 
88  template <typename TransformType>
89  void InternalInitialization(TransformType *transform);
90 
91 
92  std::function<void(std::vector<double>)> m_pfSetCenter;
93  std::function<std::vector<double>()> m_pfGetCenter;
94  std::function<void(std::vector<double>)> m_pfSetScale;
95  std::function<std::vector<double>()> m_pfGetScale;
96  std::function<std::vector<double>()> m_pfGetMatrix;
97 
98 
99 };
100 
101 }
102 
103 #endif // sitkScaleTransform_h
itk::simple::ScaleTransform::MyVisitor
Definition: sitkScaleTransform.h:71
itk::simple::ScaleTransform::GetName
std::string GetName() const override
Definition: sitkScaleTransform.h:50
itk::simple::ScaleTransform::m_pfSetScale
std::function< void(std::vector< double >)> m_pfSetScale
Definition: sitkScaleTransform.h:94
itk::simple::Transform
A simplified wrapper around a variety of ITK transforms.
Definition: sitkTransform.h:81
sitkCommon.h
itk::simple::ScaleTransform::MyVisitor::transform
itk::TransformBase * transform
Definition: sitkScaleTransform.h:73
itk::simple::ScaleTransform::m_pfSetCenter
std::function< void(std::vector< double >)> m_pfSetCenter
Definition: sitkScaleTransform.h:92
itk::simple::ScaleTransform::m_pfGetCenter
std::function< std::vector< double >)> m_pfGetCenter
Definition: sitkScaleTransform.h:93
itk::simple::ScaleTransform::MyVisitor::that
ScaleTransform * that
Definition: sitkScaleTransform.h:74
itk::simple::ScaleTransform::InternalInitialization
void InternalInitialization(itk::TransformBase *transform)
SITKCommon_EXPORT
#define SITKCommon_EXPORT
Definition: sitkCommon.h:41
itk::simple::ScaleTransform::m_pfGetScale
std::function< std::vector< double >)> m_pfGetScale
Definition: sitkScaleTransform.h:95
itk::simple::ScaleTransform::m_pfGetMatrix
std::function< std::vector< double >)> m_pfGetMatrix
Definition: sitkScaleTransform.h:96
sitkTransform.h
itk::simple
Definition: sitkAdditionalProcedures.h:28
itk::simple::ScaleTransform
A 2D or 3D anisotropic scale of coordinate space around a fixed center.
Definition: sitkScaleTransform.h:33
itk::TransformBaseTemplate
Definition: sitkTransform.h:30