ITK  5.0.0
Insight Segmentation and Registration Toolkit
itkLandmarkBasedTransformInitializer.h
Go to the documentation of this file.
1 /*=========================================================================
2  *
3  * Copyright Insight Software Consortium
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,
87  typename TMovingImage = itk::ImageBase<TTransform::OutputSpaceDimension> >
88 class ITK_TEMPLATE_EXPORT LandmarkBasedTransformInitializer:
89  public Object
90 {
91 public:
92  ITK_DISALLOW_COPY_AND_ASSIGN(LandmarkBasedTransformInitializer);
93 
96  using Superclass = Object;
99 
101  itkNewMacro(Self);
102 
105 
107  using TransformType = TTransform;
108  using TransformPointer = typename TransformType::Pointer;
109 
111  static constexpr unsigned int InputSpaceDimension = TransformType::InputSpaceDimension;
112  static constexpr unsigned int OutputSpaceDimension = TransformType::OutputSpaceDimension;
113 
115  itkSetObjectMacro(Transform, TransformType);
116 
118  using FixedImageType = TFixedImage;
119  using MovingImageType = TMovingImage;
120 
122  itkSetConstObjectMacro(ReferenceImage, FixedImageType);
123 
125  itkSetMacro(BSplineNumberOfControlPoints, unsigned int);
126 
127  using FixedImagePointer = typename FixedImageType::ConstPointer;
128  using MovingImagePointer = typename MovingImageType::ConstPointer;
129 
131  static constexpr unsigned int ImageDimension = FixedImageType::ImageDimension;
132 
134  using InputPointType = typename TransformType::InputPointType;
135  using OutputVectorType = typename TransformType::OutputVectorType;
136 
138  using LandmarkPointContainer = std::vector< LandmarkPointType >;
139  using PointsContainerConstIterator = typename LandmarkPointContainer::const_iterator;
140 
141  using ParametersType = typename TransformType::ParametersType;
142  using ParametersValueType = typename ParametersType::ValueType;
143  using LandmarkWeightType = std::vector< double >;
144  using LandmarkWeightConstIterator = LandmarkWeightType::const_iterator;
145 
147  void SetFixedLandmarks(const LandmarkPointContainer & fixedLandmarks)
148  {
149  this->m_FixedLandmarks = fixedLandmarks;
150  }
151 
153  void SetMovingLandmarks(const LandmarkPointContainer & movingLandmarks)
154  {
155  this->m_MovingLandmarks = movingLandmarks;
156  }
157 
161  void SetLandmarkWeight(LandmarkWeightType & landmarkWeight)
162  {
163  this->m_LandmarkWeight= landmarkWeight;
164  }
165 
170 
171  constexpr static unsigned int SplineOrder = 3;
173  FixedImageType::ImageDimension,
174  SplineOrder>;
175 
177  virtual void InitializeTransform();
178 
179 protected:
181  ~LandmarkBasedTransformInitializer() override = default;
182 
183  void PrintSelf(std::ostream & os, Indent indent) const override;
184 
185 private:
186 
188  template <typename TTransform2>
189  void InternalInitializeTransform(TTransform2 *);
190 
192  void InternalInitializeTransform(VersorRigid3DTransformType *);
193 
195  void InternalInitializeTransform(Rigid2DTransformType *);
196 
198  void InternalInitializeTransform(AffineTransformType *);
199 
201  void InternalInitializeTransform(BSplineTransformType *);
202 
209  unsigned int m_BSplineNumberOfControlPoints{4};
210 
211 }; //class LandmarkBasedTransformInitializer
212 } // namespace itk
213 
214 #ifndef ITK_MANUAL_INSTANTIATION
215 #include "itkLandmarkBasedTransformInitializer.hxx"
216 #endif
217 
218 #endif /* itkLandmarkBasedTransformInitializer_h */
typename TransformType::ParametersType ParametersType
Light weight base class for most itk classes.
VersorRigid3DTransform of a vector space (e.g. space coordinates)
Deformable transform using a BSpline representation.
typename TransformType::OutputVectorType OutputVectorType
typename MovingImageType::ConstPointer MovingImagePointer
void SetFixedLandmarks(const LandmarkPointContainer &fixedLandmarks)
void SetLandmarkWeight(LandmarkWeightType &landmarkWeight)
LandmarkWeightType::const_iterator LandmarkWeightConstIterator
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:83
typename LandmarkPointContainer::const_iterator PointsContainerConstIterator
typename FixedImageType::ConstPointer FixedImagePointer
void SetMovingLandmarks(const LandmarkPointContainer &movingLandmarks)
Base class for templated image classes.
Definition: itkImageBase.h:105
Rigid2DTransform of a vector space (e.g. space coordinates)
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:60
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52
typename TransformType::InputPointType InputPointType