ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkImageToSpatialObjectRegistrationMethod.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 __itkImageToSpatialObjectRegistrationMethod_h
19 #define __itkImageToSpatialObjectRegistrationMethod_h
20 
21 #include "itkProcessObject.h"
22 #include "itkImage.h"
25 #include "itkDataObjectDecorator.h"
26 
27 namespace itk
28 {
84 template< typename TFixedImage, typename TMovingSpatialObject >
86 {
87 public:
93 
95  itkNewMacro(Self);
96 
99 
101  typedef TFixedImage FixedImageType;
102  typedef typename FixedImageType::ConstPointer FixedImageConstPointer;
103 
105  typedef TMovingSpatialObject MovingSpatialObjectType;
106  typedef typename MovingSpatialObjectType::ConstPointer
108 
113 
117 
123 
127 
130 
134 
137 
139  itkSetConstObjectMacro(FixedImage, FixedImageType);
140  itkGetConstObjectMacro(FixedImage, FixedImageType);
142 
144  itkSetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);
145  itkGetConstObjectMacro(MovingSpatialObject, MovingSpatialObjectType);
147 
149  itkSetObjectMacro(Optimizer, OptimizerType);
150  itkGetObjectMacro(Optimizer, OptimizerType);
152 
154  itkSetObjectMacro(Metric, MetricType);
155  itkGetObjectMacro(Metric, MetricType);
157 
159  itkSetObjectMacro(Transform, TransformType);
160  itkGetObjectMacro(Transform, TransformType);
162 
164  itkSetObjectMacro(Interpolator, InterpolatorType);
165  itkGetObjectMacro(Interpolator, InterpolatorType);
167 
169  itkSetMacro(InitialTransformParameters, ParametersType);
170  itkGetConstReferenceMacro(InitialTransformParameters, ParametersType);
172 
175  itkGetConstReferenceMacro(LastTransformParameters, ParametersType);
176 
178  const TransformOutputType * GetOutput() const;
179 
183  using Superclass::MakeOutput;
184  virtual DataObjectPointer MakeOutput(DataObjectPointerArraySizeType idx);
185 
188  ModifiedTimeType GetMTime() const;
189 
190 #ifdef ITKV3_COMPATIBILITY
191  // StartRegistration is an old API from before
192  // the RegistrationMethod was a subclass of ProcessObject.
193  // Historically, one could call StartRegistration() instead of
194  // calling Update(). However, when called directly by the user, the
195  // inputs to the RegistrationMethod may not be up to date. This
196  // may cause an unexpected behavior.
197  //
198  // Since we cannot eliminate StartRegistration for ITKv3 backward
199  // compatibility reasons, we check whether StartRegistration was
200  // called directly or whether Update() (which in turn called
201  // StartRegistration()).
202  void StartRegistration(void) { this->Update(); }
203 #endif
204 
205 protected:
208  void PrintSelf(std::ostream & os, Indent indent) const;
209 
212  void GenerateData();
213 
215  void Initialize()
216  throw ( ExceptionObject );
217 
218  ParametersType m_InitialTransformParameters;
219  ParametersType m_LastTransformParameters;
220 
221 private:
222  ImageToSpatialObjectRegistrationMethod(const Self &); //purposely not
223  // implemented
224  void operator=(const Self &); //purposely not
225  // implemented
226 
227  MetricPointer m_Metric;
228  OptimizerType::Pointer m_Optimizer;
229 
230  MovingSpatialObjectConstPointer m_MovingSpatialObject;
232 
233  TransformPointer m_Transform;
234  InterpolatorPointer m_Interpolator;
235 };
236 } // end namespace itk
237 
238 #ifndef ITK_MANUAL_INSTANTIATION
239 #include "itkImageToSpatialObjectRegistrationMethod.hxx"
240 #endif
241 
242 #endif
243