A method and system is presented in image-guided radiosurgery for
determining the measure of similarity of two digital images, for example
a 2D x-ray image and a 2D DRR synthesized from 3D scan data. A
two-dimensional array of pixel values of a difference image may be formed
by subtracting each pixel value of the second image from the
corresponding pixel value of the first image. The pattern intensity
function may be constructed by taking the summation of functions of the
gradients of the difference image. The neighborhood R may be defined so
as to allow the gradients of the difference image to be considered in at
least one direction.