ITK  4.13.0
Insight Segmentation and Registration Toolkit
itkMutualInformationImageToImageMetric.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 itkMutualInformationImageToImageMetric_h
19 #define itkMutualInformationImageToImageMetric_h
20 
21 #include "itkImageToImageMetric.h"
22 #include "itkPoint.h"
23 
24 #include "itkIndex.h"
25 #include "itkKernelFunctionBase.h"
26 
27 namespace itk
28 {
93 template< typename TFixedImage, typename TMovingImage >
94 class ITK_TEMPLATE_EXPORT MutualInformationImageToImageMetric:
95  public ImageToImageMetric< TFixedImage, TMovingImage >
96 {
97 public:
98 
104 
106  itkNewMacro(Self);
107 
110 
112  typedef typename Superclass::TransformType TransformType;
113  typedef typename Superclass::TransformPointer TransformPointer;
114  typedef typename Superclass::TransformJacobianType TransformJacobianType;
115  typedef typename Superclass::InterpolatorType InterpolatorType;
116  typedef typename Superclass::MeasureType MeasureType;
117  typedef typename Superclass::DerivativeType DerivativeType;
118  typedef typename Superclass::ParametersType ParametersType;
119  typedef typename Superclass::FixedImageType FixedImageType;
120  typedef typename Superclass::MovingImageType MovingImageType;
121  typedef typename Superclass::FixedImageConstPointer FixedImageConstPointer;
122  typedef typename Superclass::MovingImageConstPointer MovingImageCosntPointer;
123 
130 
132 
134  itkStaticConstMacro(MovingImageDimension, unsigned int,
135  MovingImageType::ImageDimension);
136 
138  void GetDerivative(
139  const ParametersType & parameters,
140  DerivativeType & Derivative) const ITK_OVERRIDE;
141 
143  MeasureType GetValue(const ParametersType & parameters) const ITK_OVERRIDE;
144 
146  void GetValueAndDerivative(const ParametersType & parameters,
147  MeasureType & Value, DerivativeType & Derivative) const ITK_OVERRIDE;
148 
153  void SetNumberOfSpatialSamples(unsigned int num);
154 
156  itkGetConstReferenceMacro(NumberOfSpatialSamples, unsigned int);
157 
163  itkSetClampMacro( MovingImageStandardDeviation, double,
165  itkGetConstReferenceMacro(MovingImageStandardDeviation, double);
167 
173  itkSetClampMacro( FixedImageStandardDeviation, double,
175  itkGetConstMacro(FixedImageStandardDeviation, double);
177 
180  itkSetObjectMacro(KernelFunction, KernelFunctionType);
181  itkGetModifiableObjectMacro(KernelFunction, KernelFunctionType);
183 
184 
185 protected:
187  virtual ~MutualInformationImageToImageMetric() ITK_OVERRIDE {}
188  void PrintSelf(std::ostream & os, Indent indent) const ITK_OVERRIDE;
189 
190 private:
191  ITK_DISALLOW_COPY_AND_ASSIGN(MutualInformationImageToImageMetric);
192 
199  {
200 public:
201  SpatialSample():FixedImageValue(0.0), MovingImageValue(0.0)
202  { FixedImagePointValue.Fill(0.0); }
204 
208  };
209 
211  typedef std::vector< SpatialSample > SpatialSampleContainer;
212 
216 
220 
225 
227 
233  virtual void SampleFixedImageDomain(SpatialSampleContainer & samples) const;
234 
238  void CalculateDerivatives(const FixedImagePointType &, DerivativeType &, TransformJacobianType &) const;
239 
240  typedef typename Superclass::CoordinateRepresentationType
244 
246 
247 };
248 } // end namespace itk
249 
250 #ifndef ITK_MANUAL_INSTANTIATION
251 #include "itkMutualInformationImageToImageMetric.hxx"
252 #endif
253 
254 #endif
Array class with size defined at construction time.
Definition: itkArray.h:50
Light weight base class for most itk classes.
Superclass::ParametersValueType CoordinateRepresentationType
ImageToImageMetric< TFixedImage, TMovingImage > Superclass
signed long IndexValueType
Definition: itkIntTypes.h:150
Calculate the derivative by central differencing.
Transform points and vectors from an input space to an output space.
Definition: itkTransform.h:82
Array2D class representing a 2D array with size defined at construction time.
Definition: itkArray2D.h:45
Computes the mutual information between two images to be registered.
KernelFunction is for backward compatibility with ITKv3.
Superclass::CoordinateRepresentationType CoordinateRepresentationType
CentralDifferenceImageFunction< MovingImageType, CoordinateRepresentationType > DerivativeFunctionType
Control indentation during Print() invocation.
Definition: itkIndent.h:49
Define additional traits for native types such as int or float.
Computes similarity between regions of two images.
A templated class holding a geometric point in n-Dimensional space.
Definition: itkPoint.h:52