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
24namespace itk::simple
25{
26
27
34{
35public:
38
40
41 explicit TranslationTransform(unsigned int dimensions,
42 const std::vector<double> & offset = std::vector<double>(3, 0.0));
43
45
47
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
63protected:
64 void
65 SetPimpleTransform(std::unique_ptr<PimpleTransformBase> && pimpleTransform) override;
66
67private:
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
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
Transform()
By default a 3-d identity transform is constructed.
TranslationTransform(const Transform &)
std::vector< double > GetOffset() const
Self & SetOffset(const std::vector< double > &params)
void SetPimpleTransform(std::unique_ptr< PimpleTransformBase > &&pimpleTransform) override
void InternalInitialization(itk::TransformBase *transform)
TranslationTransform & operator=(const TranslationTransform &)
void InternalInitialization(TransformType *transform)
std::function< std::vector< double >()> m_pfGetOffset
TranslationTransform(const TranslationTransform &)
std::function< void(const std::vector< double > &)> m_pfSetOffset
TranslationTransform(unsigned int dimensions, const std::vector< double > &offset=std::vector< double >(3, 0.0))
TransformBaseTemplate< double > TransformBase
#define SITKCommon_EXPORT
Definition sitkCommon.h:41