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