ITK  4.3.0
Insight Segmentation and Registration Toolkit
itkMeanSquaresImageToImageMetric.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 __itkMeanSquaresImageToImageMetric_h
19 #define __itkMeanSquaresImageToImageMetric_h
20 
21 #include "itkImageToImageMetric.h"
22 #include "itkPoint.h"
23 #include "itkIndex.h"
24 
25 
26 namespace itk
27 {
28 
38 template< class TFixedImage, class TMovingImage >
40  public ImageToImageMetric< TFixedImage, TMovingImage >
41 {
42 public:
43 
49 
51  itkNewMacro(Self);
52 
55 
57  typedef typename Superclass::TransformType TransformType;
58  typedef typename Superclass::TransformPointer TransformPointer;
59  typedef typename Superclass::TransformJacobianType TransformJacobianType;
60  typedef typename Superclass::InterpolatorType InterpolatorType;
61  typedef typename Superclass::MeasureType MeasureType;
62  typedef typename Superclass::DerivativeType DerivativeType;
63  typedef typename Superclass::ParametersType ParametersType;
64  typedef typename Superclass::FixedImageType FixedImageType;
65  typedef typename Superclass::MovingImageType MovingImageType;
66  typedef typename Superclass::MovingImagePointType MovingImagePointType;
67  typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer;
68  typedef typename Superclass::MovingImageConstPointer MovingImageConstPointer;
69  typedef typename Superclass::CoordinateRepresentationType CoordinateRepresentationType;
70  typedef typename Superclass::FixedImageSampleContainer FixedImageSampleContainer;
71  typedef typename Superclass::ImageDerivativesType ImageDerivativesType;
72  typedef typename Superclass::WeightsValueType WeightsValueType;
74 
75  // Needed for evaluation of Jacobian.
76  typedef typename Superclass::FixedImagePointType FixedImagePointType;
77 
79  itkStaticConstMacro(MovingImageDimension, unsigned int,
80  MovingImageType::ImageDimension);
81 
89  virtual void Initialize(void)
90  throw ( ExceptionObject );
91 
93  MeasureType GetValue(const ParametersType & parameters) const;
94 
96  void GetDerivative(const ParametersType & parameters,
97  DerivativeType & Derivative) const;
98 
100  void GetValueAndDerivative(const ParametersType & parameters,
101  MeasureType & Value,
102  DerivativeType & Derivative) const;
103 
104 protected:
105 
107  virtual ~MeanSquaresImageToImageMetric();
108  void PrintSelf(std::ostream & os, Indent indent) const;
109 
110 private:
111 
112  //purposely not implemented
113  MeanSquaresImageToImageMetric(const Self &);
114  //purposely not implemented
115  void operator=(const Self &);
116 
117  inline bool GetValueThreadProcessSample(ThreadIdType threadID,
118  SizeValueType fixedImageSample,
119  const MovingImagePointType & mappedPoint,
120  double movingImageValue) const;
121 
122  inline bool GetValueAndDerivativeThreadProcessSample(ThreadIdType threadID,
123  SizeValueType fixedImageSample,
124  const MovingImagePointType & mappedPoint,
125  double movingImageValue,
126  const ImageDerivativesType &
127  movingImageGradientValue) const;
128 
129  struct PerThreadS
130  {
134  };
135 
136  itkAlignedTypedef( 64, PerThreadS, AlignedPerThreadType );
137  AlignedPerThreadType *m_PerThread;
138 };
139 } // end namespace itk
140 
141 #ifndef ITK_MANUAL_INSTANTIATION
142 #include "itkMeanSquaresImageToImageMetric.hxx"
143 #endif
144 
145 #endif
146