NormalizedMutualImageInformation.h
1 /*
2  * Medical Image Registration ToolKit (MIRTK)
3  *
4  * Copyright 2013-2015 Imperial College London
5  * Copyright 2013-2015 Andreas Schuh
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 
20 #ifndef MIRTK_NormalizedMutualImageInformation_H
21 #define MIRTK_NormalizedMutualImageInformation_H
22 
23 #include "mirtk/HistogramImageSimilarity.h"
24 
25 #include "mirtk/Histogram1D.h"
26 
27 
28 namespace mirtk {
29 
30 
31 /**
32  * Normalized mutual information image similarity measure
33  */
35 {
36  mirtkEnergyTermMacro(NormalizedMutualImageInformation, EM_NMI);
37 
38  // ---------------------------------------------------------------------------
39  // Types
40 
41  /// Type of marginal histograms
43 
44  // ---------------------------------------------------------------------------
45  // Attributes
46 
47  /// Marginal histogram w.r.t. target image intensities
48  mirtkAttributeMacro(MarginalHistogram, TargetHistogram);
49 
50  /// Marginal histogram w.r.t. source image intensities
51  mirtkAttributeMacro(MarginalHistogram, SourceHistogram);
52 
53  /// Marginal entropy w.r.t. target image intensities
54  mirtkAttributeMacro(double, TargetEntropy);
55 
56  /// Marginal entropy w.r.t. source image intensities
57  mirtkAttributeMacro(double, SourceEntropy);
58 
59  /// Joint entropy of target and source image intensities
60  mirtkAttributeMacro(double, JointEntropy);
61 
62  /// Copy attributes of this class from another instance
63  void CopyAttributes(const NormalizedMutualImageInformation &);
64 
65  // ---------------------------------------------------------------------------
66  // Construction/Destruction
67 public:
68 
69  /// Constructor
70  NormalizedMutualImageInformation(const char * = "");
71 
72  /// Copy constructor
74 
75  /// Assignment operator
77 
78  /// Destructor
80 
81  // ---------------------------------------------------------------------------
82  // Evaluation
83 
84  /// Update moving image and internal state of similarity measure
85  virtual void Update(bool = true);
86 
87 protected:
88 
89  /// Evaluate similarity of images
90  virtual double Evaluate();
91 
92  /// Evaluate non-parametric similarity gradient w.r.t the given image
94 
95  // ---------------------------------------------------------------------------
96  // Debugging
97 public:
98 
99  /// Return unweighted and unnormalized raw energy term value
100  /// \remarks Use for progress reporting only.
101  virtual double RawValue(double) const;
102 
103 };
104 
105 
106 } // namespace mirtk
107 
108 #endif // MIRTK_NormalizedMutualImageInformation_H
NormalizedMutualImageInformation & operator=(const NormalizedMutualImageInformation &)
Assignment operator.
Definition: IOConfig.h:41
virtual bool NonParametricGradient(const RegisteredImage *, GradientImageType *)
Evaluate non-parametric similarity gradient w.r.t the given image.
virtual double Evaluate()
Evaluate similarity of images.
NormalizedMutualImageInformation(const char *="")
Constructor.
Normalized mutual information.
Definition: EnergyMeasure.h:42
virtual void Update(bool=true)
Update moving image and internal state of similarity measure.