ITK  6.0.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  * https://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"
25 #include "itkRigid2DTransform.h"
26 #include "itkAffineTransform.h"
27 #include "itkBSplineTransform.h"
28 #include "itkPoint.h"
29 #include "itkPointSet.h"
32 #include <vector>
33 
34 namespace itk
35 {
87 template <typename TTransform,
90 class ITK_TEMPLATE_EXPORT LandmarkBasedTransformInitializer : public Object
91 {
92 public:
93  ITK_DISALLOW_COPY_AND_MOVE(LandmarkBasedTransformInitializer);
94 
97  using Superclass = Object;
100 
102  itkNewMacro(Self);
103 
105  itkOverrideGetNameOfClassMacro(LandmarkBasedTransformInitializer);
106 
108  using TransformType = TTransform;
110 
112  static constexpr unsigned int InputSpaceDimension = TransformType::InputSpaceDimension;
113  static constexpr unsigned int OutputSpaceDimension = TransformType::OutputSpaceDimension;
114 
116  itkSetObjectMacro(Transform, TransformType);
117 
119  using FixedImageType = TFixedImage;
120  using MovingImageType = TMovingImage;
121 
123  itkSetConstObjectMacro(ReferenceImage, FixedImageType);
124 
126  itkSetMacro(BSplineNumberOfControlPoints, unsigned int);
127 
130 
132  static constexpr unsigned int ImageDimension = FixedImageType::ImageDimension;
133 
135  using InputPointType = typename TransformType::InputPointType;
136  using OutputVectorType = typename TransformType::OutputVectorType;
137 
140  using LandmarkPointContainer = std::vector<LandmarkPointType>;
141  using PointsContainerConstIterator = typename LandmarkPointContainer::const_iterator;
142 
143  using ParametersType = typename TransformType::ParametersType;
144  using ParametersValueType = typename ParametersType::ValueType;
145  using LandmarkWeightType = std::vector<double>;
146  using LandmarkWeightConstIterator = LandmarkWeightType::const_iterator;
147 
149  void
151  {
152  this->m_FixedLandmarks = fixedLandmarks;
153  }
154 
156  void
158  {
159  this->m_MovingLandmarks = movingLandmarks;
160  }
161 
165  void
167  {
168  this->m_LandmarkWeight = landmarkWeight;
169  }
170 
176 
177  static constexpr unsigned int SplineOrder = 3;
179 
181  virtual void
182  InitializeTransform();
183 
184 protected:
186  ~LandmarkBasedTransformInitializer() override = default;
187 
188  void
189  PrintSelf(std::ostream & os, Indent indent) const override;
190 
191 private:
193  template <typename TTransform2>
194  void
195  InternalInitializeTransform(TTransform2 *);
196 
198  void
199  InternalInitializeTransform(VersorRigid3DTransformType *);
200 
202  void
203  InternalInitializeTransform(Similarity3DTransformType *);
204 
206  void
207  InternalInitializeTransform(Rigid2DTransformType *);
208 
210  void
211  InternalInitializeTransform(AffineTransformType *);
212 
214  void
215  InternalInitializeTransform(BSplineTransformType *);
216 
218  ComputeCentroid(const LandmarkPointContainer);
219 
220  void
223 
224  FixedImagePointer m_ReferenceImage{};
225  TransformPointer m_Transform{};
226  LandmarkPointContainer m_FixedLandmarks{};
227  LandmarkPointContainer m_MovingLandmarks{};
228 
230  LandmarkWeightType m_LandmarkWeight{};
231  unsigned int m_BSplineNumberOfControlPoints{ 4 };
232 
233 }; // class LandmarkBasedTransformInitializer
234 } // namespace itk
235 
236 #ifndef ITK_MANUAL_INSTANTIATION
237 # include "itkLandmarkBasedTransformInitializer.hxx"
238 #endif
239 
240 #endif /* itkLandmarkBasedTransformInitializer_h */
itkVectorIndexSelectionCastImageFilter.h
Pointer
SmartPointer< Self > Pointer
Definition: itkAddImageFilter.h:93
itkObjectFactory.h
itk::LandmarkBasedTransformInitializer::FixedImagePointer
typename FixedImageType::ConstPointer FixedImagePointer
Definition: itkLandmarkBasedTransformInitializer.h:128
ConstPointer
SmartPointer< const Self > ConstPointer
Definition: itkAddImageFilter.h:94
itk::LandmarkBasedTransformInitializer::SetMovingLandmarks
void SetMovingLandmarks(const LandmarkPointContainer &movingLandmarks)
Definition: itkLandmarkBasedTransformInitializer.h:157
itk::LandmarkBasedTransformInitializer::FixedImageType
TFixedImage FixedImageType
Definition: itkLandmarkBasedTransformInitializer.h:119
itkRigid2DTransform.h
itk::ImageBase
Base class for templated image classes.
Definition: itkImageBase.h:114
itkPoint.h
itk::VersorRigid3DTransform
VersorRigid3DTransform of a vector space (e.g. space coordinates)
Definition: itkVersorRigid3DTransform.h:46
itk::SmartPointer< Self >
itk::Indent
Control indentation during Print() invocation.
Definition: itkIndent.h:49
itkAffineTransform.h
itk::AffineTransform
Definition: itkAffineTransform.h:101
itk::LandmarkBasedTransformInitializer::LandmarkPointContainer
std::vector< LandmarkPointType > LandmarkPointContainer
Definition: itkLandmarkBasedTransformInitializer.h:140
itk::LandmarkBasedTransformInitializer::InputPointType
typename TransformType::InputPointType InputPointType
Definition: itkLandmarkBasedTransformInitializer.h:135
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:55
itk::LandmarkBasedTransformInitializer::ParametersType
typename TransformType::ParametersType ParametersType
Definition: itkLandmarkBasedTransformInitializer.h:143
itkBSplineTransform.h
itkBSplineScatteredDataPointSetToImageFilter.h
itkVersorRigid3DTransform.h
itkSimilarity3DTransform.h
itk::LandmarkBasedTransformInitializer::MovingImageType
TMovingImage MovingImageType
Definition: itkLandmarkBasedTransformInitializer.h:120
itk::LandmarkBasedTransformInitializer
Definition: itkLandmarkBasedTransformInitializer.h:90
itk::Matrix
A templated class holding a M x N size Matrix.
Definition: itkMatrix.h:52
itkObject.h
itk::LandmarkBasedTransformInitializer::TransformPointer
typename TransformType::Pointer TransformPointer
Definition: itkLandmarkBasedTransformInitializer.h:109
itk
The "itk" namespace contains all Insight Segmentation and Registration Toolkit (ITK) classes....
Definition: itkAnatomicalOrientation.h:29
itk::LandmarkBasedTransformInitializer::OutputVectorType
typename TransformType::OutputVectorType OutputVectorType
Definition: itkLandmarkBasedTransformInitializer.h:136
itk::LandmarkBasedTransformInitializer::SetFixedLandmarks
void SetFixedLandmarks(const LandmarkPointContainer &fixedLandmarks)
Definition: itkLandmarkBasedTransformInitializer.h:150
itk::Object
Base class for most ITK classes.
Definition: itkObject.h:61
itk::Point< double, 3 >
itk::LandmarkBasedTransformInitializer::ParametersValueType
typename ParametersType::ValueType ParametersValueType
Definition: itkLandmarkBasedTransformInitializer.h:144
itk::Transform
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:83
itkPointSet.h
itk::LandmarkBasedTransformInitializer::TransformType
TTransform TransformType
Definition: itkLandmarkBasedTransformInitializer.h:108
itk::LandmarkBasedTransformInitializer::SetLandmarkWeight
void SetLandmarkWeight(LandmarkWeightType &landmarkWeight)
Definition: itkLandmarkBasedTransformInitializer.h:166
itk::Similarity3DTransform
Similarity3DTransform of a vector space (e.g. space coordinates)
Definition: itkSimilarity3DTransform.h:47
itk::LandmarkBasedTransformInitializer::LandmarkWeightConstIterator
LandmarkWeightType::const_iterator LandmarkWeightConstIterator
Definition: itkLandmarkBasedTransformInitializer.h:146
itk::LandmarkBasedTransformInitializer::PointsContainerConstIterator
typename LandmarkPointContainer::const_iterator PointsContainerConstIterator
Definition: itkLandmarkBasedTransformInitializer.h:141
itk::LandmarkBasedTransformInitializer::LandmarkWeightType
std::vector< double > LandmarkWeightType
Definition: itkLandmarkBasedTransformInitializer.h:145
itk::LandmarkBasedTransformInitializer::MovingImagePointer
typename MovingImageType::ConstPointer MovingImagePointer
Definition: itkLandmarkBasedTransformInitializer.h:129