Name

im_diff - Calculate scaled density difference between two images.

Usage

imdiff, A, B = im_diff(image1,image2,[optional: mask, or radius of a circular mask])

or use a tuple to hold the returned values.

S =im_diff(image1,image2,[optional: mask or radius of a circular mask])

Input

image1
The first input image for calculating density difference. It can be either a read-in-core EMData object or a string of file in disk.The image dimension can be 1,2, or 3.
image2
The second input image for calculating density difference. It can be either a read-in-core EMData object or a string of file name in disk. The image dimension can be 1, 2 or 3.
mask
Mask file, the output density difference image will be calculated under this mask. It can be string of file name in the desk, read-in-core EMData object, integer or float number denoting radius of the circular mask.
  • Note: The mask should be of the same dimensions as the input image.
  • The default mask is a circle, or sphere, with the radius of min(nx/2-1, ny/2-1, nz/2-1)

Output

imdiff
image of the density difference between image1 and image2.
A
The linear error scale.
B
The average of total error between image1 and image2.

Description

  1. `A = (N*sumP_1*P_2 -sumP_1*sumP_2 )/(N*sum(P_1)^2 -( sumP_1 )^2`

    • `P_1` and `P_2` are pixel values in image1 and image2, respectively.

    • Summation is over all the pixels under the given mask. N is the total number of pixels under mask.
  2. `B = (A*sumP_1 -sumP_2)/N`

  3. `"""imdiff""" = A*P_1-B -P_2`

  4. When two images are identical, A = 1, B = 0.
  5. Swapping image1 and image2 will give different A, B, and imdiff.

Author / Maintainer

Bharath K Narayanan/Zhong Huang

Keywords

category 1
UTILITIES
category 2
SPATIAL

Files

Maturity

stable
works for most people, has been tested; test cases/examples available.

Bugs

None. It is perfect.

im_diff (last edited 2013-07-01 13:13:03 by localhost)