ITK  4.13.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:
94  typedef Object Superclass;
97 
99  itkNewMacro(Self);
100 
103 
105  typedef TTransform TransformType;
106  typedef typename TransformType::Pointer TransformPointer;
107 
109  itkStaticConstMacro(InputSpaceDimension, unsigned int, TransformType::InputSpaceDimension);
110  itkStaticConstMacro(OutputSpaceDimension, unsigned int, TransformType::OutputSpaceDimension);
112 
114  itkSetObjectMacro(Transform, TransformType);
115 
117  typedef TFixedImage FixedImageType;
118  typedef TMovingImage MovingImageType;
119 
121  itkSetConstObjectMacro(ReferenceImage, FixedImageType);
122 
124  itkSetMacro(BSplineNumberOfControlPoints, unsigned int);
125 
126  typedef typename FixedImageType::ConstPointer FixedImagePointer;
127  typedef typename MovingImageType::ConstPointer MovingImagePointer;
128 
130  itkStaticConstMacro(ImageDimension, unsigned int, FixedImageType::ImageDimension);
131 
133  typedef typename TransformType::InputPointType InputPointType;
134  typedef typename TransformType::OutputVectorType OutputVectorType;
135 
137  typedef std::vector< LandmarkPointType > LandmarkPointContainer;
138  typedef typename LandmarkPointContainer::const_iterator PointsContainerConstIterator;
139 
140  typedef typename TransformType::ParametersType ParametersType;
141  typedef typename ParametersType::ValueType ParametersValueType;
142  typedef std::vector< double > LandmarkWeightType;
143  typedef LandmarkWeightType::const_iterator LandmarkWeightConstIterator;
144 
146  void SetFixedLandmarks(const LandmarkPointContainer & fixedLandmarks)
147  {
148  this->m_FixedLandmarks = fixedLandmarks;
149  }
150 
152  void SetMovingLandmarks(const LandmarkPointContainer & movingLandmarks)
153  {
154  this->m_MovingLandmarks = movingLandmarks;
155  }
156 
160  void SetLandmarkWeight(LandmarkWeightType & landmarkWeight)
161  {
162  this->m_LandmarkWeight= landmarkWeight;
163  }
164 
169 
170  const static unsigned int SplineOrder = 3;
172  FixedImageType::ImageDimension,
173  SplineOrder> BSplineTransformType;
174 
176  virtual void InitializeTransform();
177 
178 protected:
181 
182  virtual void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
183 
184 private:
185  ITK_DISALLOW_COPY_AND_ASSIGN(LandmarkBasedTransformInitializer);
186 
187 
189  template <typename TTransform2>
190  void InternalInitializeTransform(TTransform2 *);
191 
193  void InternalInitializeTransform(VersorRigid3DTransformType *);
194 
196  void InternalInitializeTransform(Rigid2DTransformType *);
197 
199  void InternalInitializeTransform(AffineTransformType *);
200 
202  void InternalInitializeTransform(BSplineTransformType *);
203 
211 
212 }; //class LandmarkBasedTransformInitializer
213 } // namespace itk
214 
215 #ifndef ITK_MANUAL_INSTANTIATION
216 #include "itkLandmarkBasedTransformInitializer.hxx"
217 #endif
218 
219 #endif /* itkLandmarkBasedTransformInitializer_h */
Light weight base class for most itk classes.
VersorRigid3DTransform of a vector space (e.g. space coordinates)
Deformable transform using a BSpline representation.
Rigid2DTransform< ParametersValueType > Rigid2DTransformType
AffineTransform< ParametersValueType, FixedImageType::ImageDimension > AffineTransformType
void SetFixedLandmarks(const LandmarkPointContainer &fixedLandmarks)
void SetLandmarkWeight(LandmarkWeightType &landmarkWeight)
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
void SetMovingLandmarks(const LandmarkPointContainer &movingLandmarks)
BSplineTransform< ParametersValueType, FixedImageType::ImageDimension, SplineOrder > BSplineTransformType
Base class for templated image classes.
Definition: itkImageBase.h:114
Rigid2DTransform of a vector space (e.g. space coordinates)
VersorRigid3DTransform< ParametersValueType > VersorRigid3DTransformType
LandmarkPointContainer::const_iterator PointsContainerConstIterator
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Base class for most ITK classes.
Definition: itkObject.h:59
LandmarkWeightType::const_iterator LandmarkWeightConstIterator
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52