| |
Program Functions
151
built-in MATLAB function that performs convolution. The returned image has the same size
as the original image, i.e., only the central part of the convolution is returned.
vFindPhaseShift.m
This function is called after the creation of the atlases and when the user presses the button for
automatic phase offset estimation for the ring-stimulus phase image. It estimates the phase
offset between the measured phase image and the corresponding atlas phase image by adding
certain test phase offsets from a given set of phase values to the measured phase image. For
each test phase offset, the function vImageDiff is called to calculate the difference between
the two images. The difference calculation is done in complex space to avoid the wrapping
problem (for example, the difference between the phase values 2 and 0 is 0 and not 2 ) due
to the 2 periodicity. Then, the matrix of real phase differences is calculated from the matrix
of complex values. All elements are squared individually and summed together. The resulting
difference value (error, energy) is returned to vFindPhaseShift. This calculation is done for all
phase offsets in the given set. The smallest difference value and the corresponding offset are
determined. That offset, i.e., the offset that yields to the minimal difference between the two
phase images (according to the definition of the difference) is returned and can be added to the
measured phase image.
vGradient.m
The derivatives of the phase are calculated according to equation 16 in [Fleet and Jepson,
1990 #55] by separating the complex image into real and imaginary parts. The derivatives of
the real and imaginary parts are then calculated separately to avoid the wrapping problem. Fi-
nally, the derivatives in horizontal and vertical directions of the phase are calculated based on
the derivatives of the components. An edge handler for upConv (MATLAB function in the
Stanford toolbox) can be specified. The input image is a matrix of complex values (z), where
these values can be of the form
j ph
z
co e×
=
×
.
Equation 28: Complex value
|  |
|
| |
|
|