Class RegistrationMeasureNormalizedMutualInformation
- java.lang.Object
-
- gov.nih.mipav.model.algorithms.registration.RegistrationMeasure
-
- gov.nih.mipav.model.algorithms.registration.RegistrationMeasureNormalizedMutualInformation
-
public class RegistrationMeasureNormalizedMutualInformation extends RegistrationMeasure
Concrete implementation of the RegistrationMeasure class based on the normalized mutual information computed as follows:H(X,Y) / (H(X) + H(Y))
where
- X and Y are the target and registered source images, respectively, or vice versa - H(X) and H(Y) are the standard marginal entropy definition where H(X) = - sum_i { p_i * log(p_i) } for probability p_i in histogram bin i - H(X,Y) is the joint entropy definition where H(X,Y) = - sum_ij { p_ij * log(p_ij) } for joint probability p_ij in histogram bin (i,j).
-
-
Field Summary
Fields Modifier and Type Field Description protected int[]
m_aiBinReg
Bins used to hold the histograms.protected int[]
m_aiBinRegTrg
DOCUMENT ME!protected int[]
m_aiImageBinReg
Image corresponding to the samples in the registered source image which identifies to which bin the sample belongs.protected int[]
m_aiImageBinTrg
Image corresponding to the samples in the target image which identifies to which bin the sample belongs.protected double
m_dEntropyImageTrg
Precomputed entropy for the target image.protected float
m_fSrcMin
Given a value in the registered source image, these values are used in this equation to determine the actual histogram bin: int iBinReg = (int)((value - m_fSrcMin) * m_fSrcScale);.protected float
m_fSrcScale
DOCUMENT ME!protected int
m_iNumBins
Number of bins to use for computation.protected static double[]
s_adIntLog
Table with precalculated logarithms.-
Fields inherited from class gov.nih.mipav.model.algorithms.registration.RegistrationMeasure
m_iNumSamples, m_kImageReg, m_kImageTrg
-
-
Constructor Summary
Constructors Constructor Description RegistrationMeasureNormalizedMutualInformation()
Constructor which sets up for a default number of bins.RegistrationMeasureNormalizedMutualInformation(int iNumBins)
Constructor.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description RegistrationMeasure
createNew()
Create a new instance of this measure.protected static double
getEntropy(int[] aiHistBin, double dNumSamples)
Standard entropy calculation.double
getError()
Return the current error measure between the target image and the registered source image.java.lang.String
getName()
Return the name of the particular registration measure.static java.lang.String
getStaticName()
Return the name of the particular registration measure without having an instance.protected static double[]
getTableIntLog()
DOCUMENT ME!void
setImages(ModelSimpleImage kImageSrc, ModelSimpleImage kImageTrg)
Setup the measure to use information from the target image and the original source image.void
updateRegistration(int iIndex, float fNewValue)
Update the specified value in the registered source image.-
Methods inherited from class gov.nih.mipav.model.algorithms.registration.RegistrationMeasure
createEmptyImage, getImageRegistered
-
-
-
-
Field Detail
-
s_adIntLog
protected static double[] s_adIntLog
Table with precalculated logarithms.
-
m_aiBinReg
protected int[] m_aiBinReg
Bins used to hold the histograms.
-
m_aiBinRegTrg
protected int[] m_aiBinRegTrg
DOCUMENT ME!
-
m_aiImageBinReg
protected int[] m_aiImageBinReg
Image corresponding to the samples in the registered source image which identifies to which bin the sample belongs. This is a linear storage for a 2D array where iBinReg and iBinTrg map to the 1D index by computing iBinReg*m_iNumBins+iBinTrg.
-
m_aiImageBinTrg
protected int[] m_aiImageBinTrg
Image corresponding to the samples in the target image which identifies to which bin the sample belongs.
-
m_dEntropyImageTrg
protected double m_dEntropyImageTrg
Precomputed entropy for the target image.
-
m_fSrcMin
protected float m_fSrcMin
Given a value in the registered source image, these values are used in this equation to determine the actual histogram bin: int iBinReg = (int)((value - m_fSrcMin) * m_fSrcScale);.
-
m_fSrcScale
protected float m_fSrcScale
DOCUMENT ME!
-
m_iNumBins
protected int m_iNumBins
Number of bins to use for computation.
-
-
Constructor Detail
-
RegistrationMeasureNormalizedMutualInformation
public RegistrationMeasureNormalizedMutualInformation()
Constructor which sets up for a default number of bins.
-
RegistrationMeasureNormalizedMutualInformation
public RegistrationMeasureNormalizedMutualInformation(int iNumBins)
Constructor.- Parameters:
iNumBins
- int Number of bins to use for computation.
-
-
Method Detail
-
getStaticName
public static java.lang.String getStaticName()
Return the name of the particular registration measure without having an instance.- Returns:
- String Contains the name of the particular registration measure.
-
createNew
public RegistrationMeasure createNew()
Create a new instance of this measure. That is, the same type and having the same properties. But initially, the target is not defined.- Specified by:
createNew
in classRegistrationMeasure
- Returns:
- RegistrationMeasure Newly created instance.
-
getError
public double getError()
Return the current error measure between the target image and the registered source image.- Specified by:
getError
in classRegistrationMeasure
- Returns:
- double Error measure value. Minimum value is zero. Maximum value depends on the range of values in the target and registered source images.
-
getName
public java.lang.String getName()
Return the name of the particular registration measure.- Specified by:
getName
in classRegistrationMeasure
- Returns:
- String Contains the name of the particular registration measure.
-
setImages
public void setImages(ModelSimpleImage kImageSrc, ModelSimpleImage kImageTrg)
Setup the measure to use information from the target image and the original source image. Each derived class override of this method must call this method.- Overrides:
setImages
in classRegistrationMeasure
- Parameters:
kImageSrc
- ModelSimpleImage Contains information and data about the original source image. This array may be empty but not null.kImageTrg
- ModelSimpleImage Contains information and data about yhe target image. This array may be empty but not null.
-
updateRegistration
public void updateRegistration(int iIndex, float fNewValue)
Update the specified value in the registered source image. Causes a change in the computed error measure.- Specified by:
updateRegistration
in classRegistrationMeasure
- Parameters:
iIndex
- int Linear array index for the value to be updated.fNewValue
- float New registered source image value to store at the specified index.
-
getEntropy
protected static double getEntropy(int[] aiHistBin, double dNumSamples)
Standard entropy calculation.- Parameters:
aiHistBin
- int[] Array of histogram bins. The sum of the the values in each of the array positions should equal the values passed in iNumSamples.dNumSamples
- double Total number of samples in the distribution. Must be a double-precision floating point number because the number can be quite large in the case of the joint entropy.- Returns:
- double Computed entropy value.
-
getTableIntLog
protected static double[] getTableIntLog()
DOCUMENT ME!- Returns:
- DOCUMENT ME!
-
-