ITK  4.4.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 <vector>
27 #include <iostream>
28 
29 namespace itk
30 {
67 template< class TTransform,
68  class TFixedImage,
69  class TMovingImage >
71  public Object
72 {
73 public:
76  typedef Object Superclass;
79 
81  itkNewMacro(Self);
82 
85 
87  typedef TTransform TransformType;
88  typedef typename TransformType::Pointer TransformPointer;
89 
91  itkStaticConstMacro(InputSpaceDimension, unsigned int, TransformType::InputSpaceDimension);
92  itkStaticConstMacro(OutputSpaceDimension, unsigned int, TransformType::OutputSpaceDimension);
94 
96  itkSetObjectMacro(Transform, TransformType);
97 
99  typedef TFixedImage FixedImageType;
100  typedef TMovingImage MovingImageType;
101 
102 
103  typedef typename FixedImageType::ConstPointer FixedImagePointer;
104  typedef typename MovingImageType::ConstPointer MovingImagePointer;
105 
107  itkStaticConstMacro(ImageDimension, unsigned int, FixedImageType::ImageDimension);
108 
110  typedef typename TransformType::InputPointType InputPointType;
111  typedef typename TransformType::OutputVectorType OutputVectorType;
113  typedef std::vector< LandmarkPointType > LandmarkPointContainer;
114  typedef typename LandmarkPointContainer::const_iterator PointsContainerConstIterator;
115  typedef typename TransformType::ParametersType ParametersType;
116  typedef typename ParametersType::ValueType ParameterValueType;
117  typedef std::vector< double > LandmarkWeightType;
118  typedef LandmarkWeightType::const_iterator LandmarkWeightConstIterator;
119 
121  void SetFixedLandmarks(const LandmarkPointContainer & fixedLandmarks)
122  {
123  this->m_FixedLandmarks = fixedLandmarks;
124  }
125 
127  void SetMovingLandmarks(const LandmarkPointContainer & movingLandmarks)
128  {
129  this->m_MovingLandmarks = movingLandmarks;
130  }
131 
135  void SetLandmarkWeight(LandmarkWeightType & landmarkWeight)
136  {
137  this->m_LandmarkWeight= landmarkWeight;
138  }
139 
144 
146  virtual void InitializeTransform();
147 
148 protected:
151 
152  void PrintSelf(std::ostream & os, Indent indent) const;
153 
154  // Supported Transform types
155  typedef enum {
156  VersorRigid3Dtransform = 1,
158  Else
159  } InputTransformType;
160 
161 private:
162  LandmarkBasedTransformInitializer(const Self &); //purposely not implemented
163  void operator=(const Self &); //purposely not implemented
164 
165 
167  template <class TTransform2>
168  void InternalInitializeTransform(TTransform *);
169 
171  void InternalInitializeTransform(VersorRigid3DTransformType *);
172 
174  void InternalInitializeTransform(Rigid2DTransformType *);
175 
177  void InternalInitializeTransform(AffineTransformType *);
178 
181 
184 
188 
189 }; //class LandmarkBasedTransformInitializer
190 } // namespace itk
191 
192 #ifndef ITK_MANUAL_INSTANTIATION
193 #include "itkLandmarkBasedTransformInitializer.hxx"
194 #endif
195 
196 #endif /* __itkLandmarkBasedTransformInitializer_h */
197