ITK  5.2.0
Insight Toolkit
itkLandmarkBasedTransformInitializer.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 itkLandmarkBasedTransformInitializer_h
19 #define itkLandmarkBasedTransformInitializer_h
20 
21 #include "itkObject.h"
22 #include "itkObjectFactory.h"
24 #include "itkRigid2DTransform.h"
25 #include "itkAffineTransform.h"
26 #include "itkBSplineTransform.h"
27 #include "itkPoint.h"
28 #include "itkPointSet.h"
31 #include <vector>
32 
33 namespace itk
34 {
85 template <typename TTransform,
88 class ITK_TEMPLATE_EXPORT LandmarkBasedTransformInitializer : public Object
89 {
90 public:
91  ITK_DISALLOW_COPY_AND_ASSIGN(LandmarkBasedTransformInitializer);
92 
95  using Superclass = Object;
98 
100  itkNewMacro(Self);
101 
104 
106  using TransformType = TTransform;
107  using TransformPointer = typename TransformType::Pointer;
108 
110  static constexpr unsigned int InputSpaceDimension = TransformType::InputSpaceDimension;
111  static constexpr unsigned int OutputSpaceDimension = TransformType::OutputSpaceDimension;
112 
114  itkSetObjectMacro(Transform, TransformType);
115 
117  using FixedImageType = TFixedImage;
118  using MovingImageType = TMovingImage;
119 
121  itkSetConstObjectMacro(ReferenceImage, FixedImageType);
122 
124  itkSetMacro(BSplineNumberOfControlPoints, unsigned int);
125 
126  using FixedImagePointer = typename FixedImageType::ConstPointer;
127  using MovingImagePointer = typename MovingImageType::ConstPointer;
128 
130  static constexpr unsigned int ImageDimension = FixedImageType::ImageDimension;
131 
133  using InputPointType = typename TransformType::InputPointType;
134  using OutputVectorType = typename TransformType::OutputVectorType;
135 
137  using LandmarkPointContainer = std::vector<LandmarkPointType>;
138  using PointsContainerConstIterator = typename LandmarkPointContainer::const_iterator;
139 
140  using ParametersType = typename TransformType::ParametersType;
141  using ParametersValueType = typename ParametersType::ValueType;
142  using LandmarkWeightType = std::vector<double>;
143  using LandmarkWeightConstIterator = LandmarkWeightType::const_iterator;
144 
146  void
148  {
149  this->m_FixedLandmarks = fixedLandmarks;
150  }
151 
153  void
155  {
156  this->m_MovingLandmarks = movingLandmarks;
157  }
158 
162  void
164  {
165  this->m_LandmarkWeight = landmarkWeight;
166  }
167 
172 
173  constexpr static unsigned int SplineOrder = 3;
175 
177  virtual void
178  InitializeTransform();
179 
180 protected:
182  ~LandmarkBasedTransformInitializer() override = default;
183 
184  void
185  PrintSelf(std::ostream & os, Indent indent) const override;
186 
187 private:
189  template <typename TTransform2>
190  void
191  InternalInitializeTransform(TTransform2 *);
192 
194  void
195  InternalInitializeTransform(VersorRigid3DTransformType *);
196 
198  void
199  InternalInitializeTransform(Rigid2DTransformType *);
200 
202  void
203  InternalInitializeTransform(AffineTransformType *);
204 
206  void
207  InternalInitializeTransform(BSplineTransformType *);
208 
215  unsigned int m_BSplineNumberOfControlPoints{ 4 };
216 
217 }; // class LandmarkBasedTransformInitializer
218 } // namespace itk
219 
220 #ifndef ITK_MANUAL_INSTANTIATION
221 # include "itkLandmarkBasedTransformInitializer.hxx"
222 #endif
223 
224 #endif /* itkLandmarkBasedTransformInitializer_h */
itkVectorIndexSelectionCastImageFilter.h
itkObjectFactory.h
itk::LandmarkBasedTransformInitializer::FixedImagePointer
typename FixedImageType::ConstPointer FixedImagePointer
Definition: itkLandmarkBasedTransformInitializer.h:126
itk::LandmarkBasedTransformInitializer::SetMovingLandmarks
void SetMovingLandmarks(const LandmarkPointContainer &movingLandmarks)
Definition: itkLandmarkBasedTransformInitializer.h:154
itk::LandmarkBasedTransformInitializer::FixedImageType
TFixedImage FixedImageType
Definition: itkLandmarkBasedTransformInitializer.h:117
itkRigid2DTransform.h
itk::LandmarkBasedTransformInitializer::m_LandmarkWeight
LandmarkWeightType m_LandmarkWeight
Definition: itkLandmarkBasedTransformInitializer.h:214
itk::LandmarkBasedTransformInitializer::m_FixedLandmarks
LandmarkPointContainer m_FixedLandmarks
Definition: itkLandmarkBasedTransformInitializer.h:211
itk::ImageBase
Base class for templated image classes.
Definition: itkImageBase.h:105
itkPoint.h
itk::VersorRigid3DTransform
VersorRigid3DTransform of a vector space (e.g. space coordinates)
Definition: itkVersorRigid3DTransform.h:46
itk::SmartPointer< Self >
itk::LandmarkBasedTransformInitializer::m_MovingLandmarks
LandmarkPointContainer m_MovingLandmarks
Definition: itkLandmarkBasedTransformInitializer.h:212
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkAffineTransform.h
itk::AffineTransform
Definition: itkAffineTransform.h:101
itk::LandmarkBasedTransformInitializer::m_ReferenceImage
FixedImagePointer m_ReferenceImage
Definition: itkLandmarkBasedTransformInitializer.h:209
itk::LandmarkBasedTransformInitializer::LandmarkPointContainer
std::vector< LandmarkPointType > LandmarkPointContainer
Definition: itkLandmarkBasedTransformInitializer.h:137
itk::LandmarkBasedTransformInitializer::InputPointType
typename TransformType::InputPointType InputPointType
Definition: itkLandmarkBasedTransformInitializer.h:133
itk::BSplineTransform
Deformable transform using a BSpline representation.
Definition: itkBSplineTransform.h:103
itk::Rigid2DTransform
Rigid2DTransform of a vector space (e.g. space coordinates)
Definition: itkRigid2DTransform.h:56
itk::LightObject
Light weight base class for most itk classes.
Definition: itkLightObject.h:59
itk::LandmarkBasedTransformInitializer::ParametersType
typename TransformType::ParametersType ParametersType
Definition: itkLandmarkBasedTransformInitializer.h:140
itkBSplineTransform.h
itkBSplineScatteredDataPointSetToImageFilter.h
itkVersorRigid3DTransform.h
itk::LandmarkBasedTransformInitializer::MovingImageType
TMovingImage MovingImageType
Definition: itkLandmarkBasedTransformInitializer.h:118
itk::LandmarkBasedTransformInitializer
Definition: itkLandmarkBasedTransformInitializer.h:88
itkObject.h
itk::LandmarkBasedTransformInitializer::m_Transform
TransformPointer m_Transform
Definition: itkLandmarkBasedTransformInitializer.h:210
itk::LandmarkBasedTransformInitializer::TransformPointer
typename TransformType::Pointer TransformPointer
Definition: itkLandmarkBasedTransformInitializer.h:107
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnnulusOperator.h:24
itk::LandmarkBasedTransformInitializer::OutputVectorType
typename TransformType::OutputVectorType OutputVectorType
Definition: itkLandmarkBasedTransformInitializer.h:134
itk::LandmarkBasedTransformInitializer::SetFixedLandmarks
void SetFixedLandmarks(const LandmarkPointContainer &fixedLandmarks)
Definition: itkLandmarkBasedTransformInitializer.h:147
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:60
itk::Point
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:53
itk::LandmarkBasedTransformInitializer::ParametersValueType
typename ParametersType::ValueType ParametersValueType
Definition: itkLandmarkBasedTransformInitializer.h:141
itk::Transform
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
itkPointSet.h
itk::LandmarkBasedTransformInitializer::TransformType
TTransform TransformType
Definition: itkLandmarkBasedTransformInitializer.h:106
itk::LandmarkBasedTransformInitializer::SetLandmarkWeight
void SetLandmarkWeight(LandmarkWeightType &landmarkWeight)
Definition: itkLandmarkBasedTransformInitializer.h:163
itk::LandmarkBasedTransformInitializer::LandmarkWeightConstIterator
LandmarkWeightType::const_iterator LandmarkWeightConstIterator
Definition: itkLandmarkBasedTransformInitializer.h:143
itk::LandmarkBasedTransformInitializer::PointsContainerConstIterator
typename LandmarkPointContainer::const_iterator PointsContainerConstIterator
Definition: itkLandmarkBasedTransformInitializer.h:138
itk::LandmarkBasedTransformInitializer::LandmarkWeightType
std::vector< double > LandmarkWeightType
Definition: itkLandmarkBasedTransformInitializer.h:142
itk::LandmarkBasedTransformInitializer::MovingImagePointer
typename MovingImageType::ConstPointer MovingImagePointer
Definition: itkLandmarkBasedTransformInitializer.h:127