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
24namespace itk::simple
25{
26
34{
35public:
38
39 ~ScaleTransform() override;
40
41 explicit ScaleTransform(unsigned int dimensions, const std::vector<double> & scale = std::vector<double>(3, 1.0));
42
44
45 explicit ScaleTransform(const Transform &);
46
48 std::string
49 GetName() const override
50 {
51 return std::string("ScaleTransform");
52 }
53
56
57
58 SITK_RETURN_SELF_TYPE_HEADER
59 SetScale(const std::vector<double> & params);
60 std::vector<double>
61 GetScale() const;
62
64 SITK_RETURN_SELF_TYPE_HEADER
65 SetCenter(const std::vector<double> & params);
66 std::vector<double>
67 GetCenter() const;
68
70 std::vector<double>
71 GetMatrix() const;
72
73protected:
74 void
75 SetPimpleTransform(std::unique_ptr<PimpleTransformBase> && pimpleTransform) override;
76
77private:
78 struct MyVisitor
79 {
82 template <typename TransformType>
83 void
84 operator()() const
85 {
86 TransformType * t = dynamic_cast<TransformType *>(transform);
87 if (t && (typeid(*t) == typeid(TransformType)))
88 {
89 that->InternalInitialization<TransformType>(t);
90 }
91 }
92 };
93
94 void
96
97 template <typename TransformType>
98 void
99 InternalInitialization(TransformType * transform);
100
101
102 std::function<void(std::vector<double>)> m_pfSetCenter;
103 std::function<std::vector<double>()> m_pfGetCenter;
104 std::function<void(std::vector<double>)> m_pfSetScale;
105 std::function<std::vector<double>()> m_pfGetScale;
106 std::function<std::vector<double>()> m_pfGetMatrix;
107};
108
109} // namespace itk::simple
110
111#endif // sitkScaleTransform_h
A 2D or 3D anisotropic scale of coordinate space around a fixed center.
std::function< std::vector< double >()> m_pfGetScale
std::vector< double > GetCenter() const
std::function< void(std::vector< double >)> m_pfSetScale
Self & SetScale(const std::vector< double > &params)
void SetPimpleTransform(std::unique_ptr< PimpleTransformBase > &&pimpleTransform) override
std::string GetName() const override
ScaleTransform(unsigned int dimensions, const std::vector< double > &scale=std::vector< double >(3, 1.0))
std::function< void(std::vector< double >)> m_pfSetCenter
Self & SetCenter(const std::vector< double > &params)
ScaleTransform(const ScaleTransform &)
void InternalInitialization(itk::TransformBase *transform)
std::function< std::vector< double >()> m_pfGetMatrix
ScaleTransform & operator=(const ScaleTransform &)
ScaleTransform(const Transform &)
void InternalInitialization(TransformType *transform)
std::function< std::vector< double >()> m_pfGetCenter
std::vector< double > GetMatrix() const
std::vector< double > GetScale() const
Transform()
By default a 3-d identity transform is constructed.
TransformBaseTemplate< double > TransformBase
#define SITKCommon_EXPORT
Definition sitkCommon.h:41