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