ITK  4.13.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< typename TFixedImage, typename TMovingImage >
39 class ITK_TEMPLATE_EXPORT MeanSquaresImageToImageMetric:
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) ITK_OVERRIDE;
90 
92  MeasureType GetValue(const ParametersType & parameters) const ITK_OVERRIDE;
93 
95  void GetDerivative(const ParametersType & parameters,
96  DerivativeType & Derivative) const ITK_OVERRIDE;
97 
99  void GetValueAndDerivative(const ParametersType & parameters,
100  MeasureType & Value,
101  DerivativeType & Derivative) const ITK_OVERRIDE;
102 
103 protected:
104 
106  virtual ~MeanSquaresImageToImageMetric() ITK_OVERRIDE;
107  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
108 
109 private:
110 
111  ITK_DISALLOW_COPY_AND_ASSIGN(MeanSquaresImageToImageMetric);
112 
113  bool GetValueThreadProcessSample(ThreadIdType threadId,
114  SizeValueType fixedImageSample,
115  const MovingImagePointType & mappedPoint,
116  double movingImageValue) const ITK_OVERRIDE;
117 
118  bool GetValueAndDerivativeThreadProcessSample(ThreadIdType threadId,
119  SizeValueType fixedImageSample,
120  const MovingImagePointType & mappedPoint,
121  double movingImageValue,
122  const ImageDerivativesType &
123  movingImageGradientValue) const ITK_OVERRIDE;
124 
125  struct PerThreadS
126  {
130  };
131 
132  itkAlignedTypedef( 64, PerThreadS, AlignedPerThreadType );
133  AlignedPerThreadType *m_PerThread;
134 };
135 } // end namespace itk
136 
137 #ifndef ITK_MANUAL_INSTANTIATION
138 #include "itkMeanSquaresImageToImageMetric.hxx"
139 #endif
140 
141 #endif
Array class with size defined at construction time.
Definition: itkArray.h:50
Superclass::CoordinateRepresentationType CoordinateRepresentationType
Light weight base class for most itk classes.
signed long IndexValueType
Definition: itkIntTypes.h:150
Superclass::TransformJacobianType TransformJacobianType
Superclass::FixedImagePointType FixedImagePointType
unsigned long SizeValueType
Definition: itkIntTypes.h:143
Array2D class representing a 2D array with size defined at construction time.
Definition: itkArray2D.h:45
Superclass::MovingImageConstPointer MovingImageConstPointer
Superclass::ImageDerivativesType ImageDerivativesType
Superclass::MovingImagePointType MovingImagePointType
unsigned int ThreadIdType
Definition: itkIntTypes.h:159
Control indentation during Print() invocation.
Definition: itkIndent.h:49
ImageToImageMetric< TFixedImage, TMovingImage > Superclass
Computes similarity between regions of two images.
Superclass::FixedImageConstPointer FixedImageConstPointer
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52
Superclass::FixedImageSampleContainer FixedImageSampleContainer
A templated class holding a n-Dimensional covariant vector.