SimpleITK  2.1.0.dev97
sitkTranslationTransform.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 sitkTranslationTransform_h
19 #define sitkTranslationTransform_h
20 
21 #include "sitkCommon.h"
22 #include "sitkTransform.h"
23 
24 namespace itk
25 {
26 namespace simple
27 {
28 
29 
36  : public Transform
37 {
38 public:
41 
42 ~TranslationTransform() override;
43 
44 explicit TranslationTransform(unsigned int dimensions,
45  const std::vector<double> &offset = std::vector<double>(3,0.0) );
46 
48 
49 explicit TranslationTransform( const Transform & );
50 
51 TranslationTransform &operator=( const TranslationTransform & );
52 
54 std::string GetName() const override { return std::string ("TranslationTransform"); }
55 
56 SITK_RETURN_SELF_TYPE_HEADER SetOffset(const std::vector<double> &params);
57 std::vector<double> GetOffset( ) const;
58 
59 protected:
60 
61 void SetPimpleTransform( PimpleTransformBase *pimpleTransform ) override;
62 
63 private:
64 
65 struct MyVisitor
66 {
69  template< typename TransformType >
70  void operator() ( ) const
71  {
72  TransformType *t = dynamic_cast<TransformType*>(transform);
73  if (t && (typeid(*t) == typeid(TransformType)))
74  {
75  that->InternalInitialization<TransformType>(t);
76  }
77  }
78 };
79 
80 void InternalInitialization(itk::TransformBase *transform);
81 
82 template <typename TransformType>
83 void InternalInitialization(TransformType *transform);
84 
85 std::function<void(const std::vector<double> &)> m_pfSetOffset;
86 std::function<std::vector<double>()> m_pfGetOffset;
87 
88 };
89 
90 }
91 }
92 
93 #endif // sitkTranslationTransform_h
itk::simple::TranslationTransform::MyVisitor::that
TranslationTransform * that
Definition: sitkTranslationTransform.h:68
itk::simple::Transform
A simplified wrapper around a variety of ITK transforms.
Definition: sitkTransform.h:80
sitkCommon.h
itk::simple::TranslationTransform::GetName
std::string GetName() const override
Definition: sitkTranslationTransform.h:54
itk::simple::TranslationTransform
Translation of a 2D or 3D coordinate space.
Definition: sitkTranslationTransform.h:35
SITKCommon_EXPORT
#define SITKCommon_EXPORT
Definition: sitkCommon.h:41
itk::simple::TranslationTransform::InternalInitialization
void InternalInitialization(itk::TransformBase *transform)
itk::simple::TranslationTransform::m_pfGetOffset
std::function< std::vector< double >)> m_pfGetOffset
Definition: sitkTranslationTransform.h:86
itk::simple::TranslationTransform::m_pfSetOffset
std::function< void(const std::vector< double > &)> m_pfSetOffset
Definition: sitkTranslationTransform.h:85
itk::simple::TranslationTransform::MyVisitor::transform
itk::TransformBase * transform
Definition: sitkTranslationTransform.h:67
sitkTransform.h
itk
itk::simple::TranslationTransform::MyVisitor
Definition: sitkTranslationTransform.h:65
itk::TransformBaseTemplate
Definition: sitkTransform.h:30