ITK  4.8.0
Insight Segmentation and Registration Toolkit
itkVariationalRegistrationFunction.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 __itkVariationalRegistrationFunction_h
19 #define __itkVariationalRegistrationFunction_h
20 
22 //#include "itkWarpImageFilter.h"
24 
25 namespace itk {
26 
49 template< class TFixedImage, class TMovingImage, class TDisplacementField>
51  public FiniteDifferenceFunction< TDisplacementField >
52 {
53 public:
59 
60  typedef typename Superclass::TimeStepType TimeStepType;
61 
64 
66  itkStaticConstMacro(ImageDimension, unsigned int,Superclass::ImageDimension);
67 
69  typedef TMovingImage MovingImageType;
70  typedef typename MovingImageType::ConstPointer MovingImagePointer;
71 
73  typedef TFixedImage FixedImageType;
74  typedef typename FixedImageType::ConstPointer FixedImagePointer;
75 
77  typedef TFixedImage WarpedImageType;
78  typedef typename WarpedImageType::ConstPointer WarpedImagePointer;
79 
81  typedef TDisplacementField DisplacementFieldType;
82  typedef typename DisplacementFieldType::ConstPointer DisplacementFieldTypePointer;
83 
85  typedef unsigned char MaskImagePixelType;
88 
89  // uncomment the following line to use the standard ITK warper (not recommended)
90  //typedef itk::WarpImageFilter< FixedImageType, WarpedImageType, DisplacementFieldType >
95 
96 
98  virtual void SetMovingImage( const MovingImageType * ptr )
99  { m_MovingImage = ptr; }
100 
102  virtual const MovingImageType * GetMovingImage(void) const
103  { return m_MovingImage; }
104 
106  virtual void SetFixedImage( const FixedImageType * ptr )
107  { m_FixedImage = ptr; }
108 
110  virtual const FixedImageType * GetFixedImage(void) const
111  { return m_FixedImage; }
112 
115  { m_DisplacementField = ptr; }
116 
118  virtual const DisplacementFieldType * GetDisplacementField(void) const
119  { return m_DisplacementField; }
120 
122  virtual void SetMaskImage( const MaskImageType * ptr )
123  { m_MaskImage = ptr; }
124 
126  virtual const MaskImageType * GetMaskImage(void) const
127  { return m_MaskImage; }
128 
131  { m_MovingImageWarper = ptr; }
132 
134  virtual const MovingImageWarperType * GetMovingImageWarper(void) const
135  { return m_MovingImageWarper; }
136 
138  virtual void SetTimeStep( TimeStepType timeStep )
139  { m_TimeStep = timeStep; }
140 
142  virtual const TimeStepType GetTimeStep(void) const
143  { return m_TimeStep; }
144 
148  { m_MaskBackgroundThreshold = threshold; }
149 
153  { return m_MaskBackgroundThreshold; }
154 
156  virtual void InitializeIteration();
157 
161  virtual TimeStepType ComputeGlobalTimeStep(void * itkNotUsed(GlobalData)) const
162  { return m_TimeStep; }
163 
166  virtual void *GetGlobalDataPointer() const;
167 
169  virtual void ReleaseGlobalDataPointer(void *GlobalData) const;
170 
171  //
172  // Metric accessor methods
176  virtual double GetMetric() const
177  { return m_Metric; }
178 
180  virtual double GetRMSChange() const
181  { return m_RMSChange; }
182 
183 protected:
186 
188  virtual void PrintSelf(std::ostream& os, Indent indent) const;
189 
192  virtual void WarpMovingImage(void);
193 
195  virtual const WarpedImagePointer GetWarpedImage(void) const;
196 
200  {
204  };
205 
206 private:
207  VariationalRegistrationFunction(const Self&); //purposely not implemented
208  void operator=(const Self&); //purposely not implemented
209 
212 
215 
218 
221 
224 
227 
230 
234  mutable double m_Metric;
235  mutable double m_SumOfMetricValues;
237  mutable double m_RMSChange;
238  mutable double m_SumOfSquaredChange;
239 
242 };
243 
244 } // end namespace itk
245 
246 #ifndef ITK_MANUAL_INSTANTIATION
247 #include "itkVariationalRegistrationFunction.hxx"
248 #endif
249 
250 #endif
DisplacementFieldType::ConstPointer DisplacementFieldTypePointer
Critical section locking class that can be allocated on the stack.
Base class for force calculation in the variational registration framework.
Light weight base class for most itk classes.
itk::ContinuousBorderWarpImageFilter< FixedImageType, WarpedImageType, DisplacementFieldType > MovingImageWarperType
virtual const MaskImageType * GetMaskImage(void) const
virtual const MovingImageWarperType * GetMovingImageWarper(void) const
virtual const DisplacementFieldType * GetDisplacementField(void) const
FiniteDifferenceFunction< TDisplacementField > Superclass
virtual void SetMaskImage(const MaskImageType *ptr)
virtual void SetMovingImageWarper(MovingImageWarperType *ptr)
unsigned long SizeValueType
Definition: itkIntTypes.h:143
virtual const FixedImageType * GetFixedImage(void) const
virtual const MovingImageType * GetMovingImage(void) const
virtual MaskImagePixelType GetMaskBackgroundThreshold(void) const
virtual const TimeStepType GetTimeStep(void) const
Image< MaskImagePixelType, ImageDimension > MaskImageType
virtual void SetDisplacementField(DisplacementFieldType *ptr)
virtual TimeStepType ComputeGlobalTimeStep(void *) const
Warps an image using an input deformation field with continuous boundary conditions.
Control indentation during Print() invocation.
Definition: itkIndent.h:49
virtual void SetMovingImage(const MovingImageType *ptr)
virtual void SetFixedImage(const FixedImageType *ptr)
Templated n-dimensional image class.
Definition: itkImage.h:75
virtual void SetMaskBackgroundThreshold(MaskImagePixelType threshold)