SimpleITK  1.0.1
sitkScaleTransform.h
Go to the documentation of this file.
1 /*=========================================================================
2 *
3 * Copyright Insight Software Consortium
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
25 {
26 namespace simple
27 {
28 
35  : public Transform
36 {
37 public:
40 
41  explicit ScaleTransform(unsigned int dimensions,
42  const std::vector<double> &scale = std::vector<double>(3,1.0) );
43 
44  ScaleTransform( const ScaleTransform & );
45 
46  explicit ScaleTransform( const Transform & );
47 
49  std::string GetName() const { return std::string ("ScaleTransform"); }
50 
51  ScaleTransform &operator=( const ScaleTransform & );
52 
53 
54  SITK_RETURN_SELF_TYPE_HEADER SetScale(const std::vector<double> &params);
55  std::vector<double> GetScale( ) const;
56 
58  SITK_RETURN_SELF_TYPE_HEADER SetCenter(const std::vector<double> &params);
59  std::vector<double> GetCenter( ) const;
60 
62  std::vector<double> GetMatrix() const;
63 
64 protected:
65 
66  virtual void SetPimpleTransform( PimpleTransformBase *pimpleTransform );
67 
68 private:
69 
70  using Superclass::AddTransform;
71 
72  struct MyVisitor
73  {
76  template< typename TransformType >
77  void operator() ( void ) const
78  {
79  TransformType *t = dynamic_cast<TransformType*>(transform);
80  if (t && (typeid(*t)==typeid(TransformType)))
81  {
82  that->InternalInitialization<TransformType>(t);
83  }
84  }
85  };
86 
87  void InternalInitialization(itk::TransformBase *transform);
88 
89  template <typename TransformType>
90  void InternalInitialization(TransformType *transform);
91 
92 
93  nsstd::function<void(std::vector<double>)> m_pfSetCenter;
94  nsstd::function<std::vector<double>()> m_pfGetCenter;
95  nsstd::function<void(std::vector<double>)> m_pfSetScale;
96  nsstd::function<std::vector<double>()> m_pfGetScale;
97  nsstd::function<std::vector<double>()> m_pfGetMatrix;
98 
99 
100 };
101 
102 }
103 }
104 
105 #endif // sitkScaleTransform_h
void InternalInitialization(itk::TransformBase *transform)
std::string GetName() const
A simplified wrapper around a variety of ITK transforms.
Definition: sitkTransform.h:83
#define SITKCommon_EXPORT
Definition: sitkCommon.h:41
A 2D or 3D anisotropic scale of coordinate space around a fixed center.