Functions

Image Statistics

Some simple statistics measurements on single or pair of images. More...

Functions

template<class VOXEL >
double NormalizedSquareError (i3d::Image3d< VOXEL > const &test, i3d::Image3d< VOXEL > const &ref)
template<class VOXEL >
double Mean (i3d::Image3d< VOXEL > const &img, const i3d::Image3d< VOXEL > *mask=NULL)
template<class VOXEL >
double Variance (i3d::Image3d< VOXEL > const &img)
template<class VOXEL >
double Covariance (i3d::Image3d< VOXEL > const &imgx, i3d::Image3d< VOXEL > const &imgy)
template<class VOXEL >
double Correlation (i3d::Image3d< VOXEL > const &imgx, i3d::Image3d< VOXEL > const &imgy)
template<class VOXEL >
double MeanAbsoluteError (i3d::Image3d< VOXEL > const &imgx, i3d::Image3d< VOXEL > const &imgy)
template<class VOXEL >
double MaxAbsoluteError (i3d::Image3d< VOXEL > const &imgx, i3d::Image3d< VOXEL > const &imgy)
template<class VOXEL >
double MeanRelativeAbsoluteError (i3d::Image3d< VOXEL > const &test, i3d::Image3d< VOXEL > const &ref)
template<class VOXEL >
double RootMeanSquareError (i3d::Image3d< VOXEL > const &imgx, i3d::Image3d< VOXEL > const &imgy)
template<class VOXEL >
double RootMaxSquareError (i3d::Image3d< VOXEL > const &imgx, i3d::Image3d< VOXEL > const &imgy)
template<class VOXEL >
int VoxelVariabilities (std::vector< const i3d::Image3d< VOXEL > * > const &imgs, i3d::Image3d< double > &vars, i3d::Image3d< double > *means=NULL)
template<class VOXEL >
double TotalVariability (std::vector< const i3d::Image3d< VOXEL > * > const &imgs)

Detailed Description

Some simple statistics measurements on single or pair of images.

You can find here, for instance, Mean, Covariance, Correlation, Variance, RMSE, Maximum absolute error and few others more.


Function Documentation

template<class VOXEL >
double NormalizedSquareError ( i3d::Image3d< VOXEL > const &  test,
i3d::Image3d< VOXEL > const &  ref 
)

Maximum absolute error between the two input 2D or 3D images.

This computes the SER[dB] in the section VII. Results of [Bernardion and Santos-Victor, 2006].

Basicaly, the sum of squared differences between the test test and the reference ref image is divided by the sum of squared intensities (the total image energy) of the reference image ref. The 10 times logarithm of the division is returned, finally.

The unit of returned number is considered to be dB (deciBells).

Parameters:
[in] test first input image, the compared image
[in] ref second input image, the reference (aka source, original or correct) image

The function returns the normalized squared error in deciBells or -1 when the value couldn't be computed.

Literature: A. Bernardino and J. Santos-Victor. Fast IIR Isotropic 2-D Complex Gabor Filters With Boundary Initialization. In Transactions on Image Processing 15, 11. Pages 3338-3348. 2006.

Note:
The input images must be of the same dimension because the computation is voxelwise.
Owing to the divisor, which is always drawn from the reference image ref, the function will return different values when the input parameters are exchanged.
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2008
template<class VOXEL >
double Mean ( i3d::Image3d< VOXEL > const &  img,
const i3d::Image3d< VOXEL > *  mask = NULL 
)

It computes the mean from 2D or 3D image img.

If the last parameter mask is supplied, the mean is computed only within this mask (i.e. within the area of non-zero values in the mask image).

Parameters:
[in] img input image
[in] mask mask image

The function returns the mean value or -1 when the value couldn't be computed.

Author:
Jan Hubený (xhubeny@fi.muni.cz)
Date:
2006
template<class VOXEL >
double Variance ( i3d::Image3d< VOXEL > const &  img  ) 

Variance of voxel values within entire 2D or 3D image.

Parameters:
[in] img input image

The function returns the value of variance.

Author:
Jan Hubený (xhubeny@fi.muni.cz)
Date:
2006
template<class VOXEL >
double Covariance ( i3d::Image3d< VOXEL > const &  imgx,
i3d::Image3d< VOXEL > const &  imgy 
)

Covariance between the two input 2D or 3D images.

Parameters:
[in] imgx input image
[in] imgy input image

The function returns the value of covariance or -1 when the value couldn't be computed.

Note:
The input images must be of the same dimension because the computation is voxelwise.
Author:
Jan Hubený (xhubeny@fi.muni.cz)
Date:
2006
template<class VOXEL >
double Correlation ( i3d::Image3d< VOXEL > const &  imgx,
i3d::Image3d< VOXEL > const &  imgy 
)

Correlation between the two input 2D or 3D images.

Parameters:
[in] imgx first input image
[in] imgy second input image

The function returns the value of correlation or -1 when the value couldn't be computed.

Note:
The input images must be of the same dimension because the computation is voxelwise.
Author:
Jan Hubený (xhubeny@fi.muni.cz)
Date:
2006
template<class VOXEL >
double MeanAbsoluteError ( i3d::Image3d< VOXEL > const &  imgx,
i3d::Image3d< VOXEL > const &  imgy 
)

Mean absolute error between the two input 2D or 3D images.

Parameters:
[in] imgx first input image
[in] imgy second input image

The function returns the mean absolute difference value or -1 when the value couldn't be computed.

Note:
The input images must be of the same dimension because the computation is voxelwise.
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2008
template<class VOXEL >
double MaxAbsoluteError ( i3d::Image3d< VOXEL > const &  imgx,
i3d::Image3d< VOXEL > const &  imgy 
)

Maximum absolute error between the two input 2D or 3D images.

This computes the max_abs_err() in equation (23) of [Vliet, Young and Ginkel, 2002].

Parameters:
[in] imgx first input image
[in] imgy second input image

The function returns the maximum absolute difference value or -1 when the value couldn't be computed.

Literature: I. T. Young, L. J. van Vliet and M. van Ginkel. Recursive Gabor filtering. In Signal processing 50, 11. Pages 2798-2805. 2002.

Note:
The input images must be of the same dimension because the computation is voxelwise.
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2008
template<class VOXEL >
double MeanRelativeAbsoluteError ( i3d::Image3d< VOXEL > const &  test,
i3d::Image3d< VOXEL > const &  ref 
)

Mean relative absolute error between the two input 2D or 3D images.

This is an implementation of equation (30) in [Tan et. al., 2003] where it is called "normalized root mean square."

Several comments need to be stated. In the implementation we have replaced the root of squared X by the absolute value of X. That should be harmless theoretically but may make a difference in the floating-point arithmetics.

Also the name of the measure is a little bit misleading. The authors of the cited paper have called this "normalized root mean square" -- no matter how inappropriate name it is.

In fact, the measure computes, for each voxel, the absolute difference between corresponding voxels' intensities which is then divided by the intensity belonging to the ref image. That serves as the normalization factor. Perhaps, the word "relative" error is more appropriate instead of talking about "normalization". The summation of such values goes over all voxel positions. Finally, the sum is "averaged" by dividing it with the size (= number of voxels) of the image ref (the number of terms summed together). This satisfies the word "mean" in the name of the measure.

The unit of returned number can be considered to be % (the percentage sign) -- the difference is, in average, the returned percent of input voxel intensities.

Parameters:
[in] test first input image, the compared image
[in] ref second input image, the reference (aka source, original or correct) image

Literature: S. Tan, J. L. Dale and A. Johnston. Performance of three recursive algorithms for fast space-variant Gaussian filtering. In Real-time Imaging 9. Pages 215-228. 2003.

The function returns the mean of normalized absolute errors or -1 when the value couldn't be computed.

Note:
The input images must be of the same dimension because the computation is voxelwise.
Owing to the divisor of each summand, which is always drawn from the reference image ref, the function will return different values when the input parameters are exchanged.
Vlada's opinion: Think of it as the Mean relative/normalized absolute error between the two images.
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2008
template<class VOXEL >
double RootMeanSquareError ( i3d::Image3d< VOXEL > const &  imgx,
i3d::Image3d< VOXEL > const &  imgy 
)

Root mean square error between the two input 2D or 3D images.

Parameters:
[in] imgx first input image
[in] imgy second input image

The function returns the root of mean squared error or -1 when the value couldn't be computed.

Note:
The input images must be of the same dimension because the computation is voxelwise.
Author:
Jan Hubený (xhubeny@fi.muni.cz)
Date:
2006
template<class VOXEL >
double RootMaxSquareError ( i3d::Image3d< VOXEL > const &  imgx,
i3d::Image3d< VOXEL > const &  imgy 
)

Root mean square error between the two input 2D or 3D images.

Parameters:
[in] imgx first input image
[in] imgy second input image

The function returns the root of maximum squared error or -1 when the value couldn't be computed.

Note:
The input images must be of the same dimension because the computation is voxelwise.
This function should return the same value as the MaxAbsoluteError().
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2008
template<class VOXEL >
int VoxelVariabilities ( std::vector< const i3d::Image3d< VOXEL > * > const &  imgs,
i3d::Image3d< double > &  vars,
i3d::Image3d< double > *  means = NULL 
)

Voxel variabilities of the set of input 2D or 3D images.

This measure was inspired by the recipe found in the caption of the Figure 1. in [Lam and Shi, 2007].

Basicaly, pick a particular voxel position and compute the variance of intensities found in the image set imgs at this given position. The variance is evaluated against the mean image, discussed in the next paragraph. We compute variances over all voxel positions in the image. Hence, the result of this function is stored in the output image vars. The size of the output image is the same as the size of any input image in the input set.

The eventual output mean image mean is a by-product of the computation. In the given voxel position, it stores the mean intensity of the set at this particular position. When non-NULL pointer to the image is supplied, the image shall be filled with position-dependent means.

Parameters:
[in] imgs the C++ vector of input images
[out] vars the output image with voxel-dependent variances
[out] means pointer to the output image with voxel-dependent means

The return value is 0 when everything went well. An error is indicated otherwise.

Literature: S. Y. M. Lam and B. E. Shi. Recursive Anisotropic 2-D Gaussian Filtering Based on a Triple-Axis Decomposition. In Transactions on Image Processing 16, 7. Pages 1925-1930. 2007.

Note:
All input images in the input set imgs must be of the same dimension because the computation is voxelwise.
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2008
template<class VOXEL >
double TotalVariability ( std::vector< const i3d::Image3d< VOXEL > * > const &  imgs  ) 

Total variability in the set of input 2D or 3D images.

This measure was inspired by the recipe found in the caption of the Figure 1. in [Lam and Shi, 2007].

It is, in fact, the function VoxelVariabilities() pushed one step further. And that is, the position-dependent voxel variabilities are first summed over all voxel positions and then normalized with respect to (i.e. divided by) the total energy of the mean image.

The mean image is a by-product of the computation. In the given voxel position, it stores the mean intensity of the set at this particular position. The total energy is simply the sum of squared values over the mean image.

The logarithm of the division multiplied by 10 is returned what suggests that dB (deciBells) is the unit of returned value.

Parameters:
[in] imgs the C++ vector of input images

The return value is some negative number (result of logarithm) when everything went well. An error is indicated by zero value.

Literature: S. Y. M. Lam and B. E. Shi. Recursive Anisotropic 2-D Gaussian Filtering Based on a Triple-Axis Decomposition. In Transactions on Image Processing 16, 7. Pages 1925-1930. 2007.

Note:
All input images in the input set imgs must be of the same dimension because the computation is voxelwise.
When zero variabilities are present everywhere, the total variablity is 10*log(0/X) which is minus infinity. We've modified the program so that, in this case, it returns 10*log(10^-9/X) what should be defined (when X > 0).
Regarding the previous note, X is checked against zero in the program. In the case of X < 0.0001, an error is reported.
Author:
Vladimír Ulman (xulman@fi.muni.cz)
Date:
2008