edu.mines.jtk.dsp
Class LocalShiftFinder

java.lang.Object
  extended by edu.mines.jtk.dsp.LocalShiftFinder

public class LocalShiftFinder
extends java.lang.Object

Estimates displacement vector fields for two images. For example, given two 2-D images f(x1,x2) and g(x1,x2), a shift finder estimates two vector components of displacement u1(x1,x2) and u2(x1,x2) such that f(x1,x2) ~ g(x1+u1(x1,x2),x2+u2(x1,x2)).

Like the images f and g, the components of displacement are sampled functions of coordinates x1 and x2. That is, displacements may vary from sample to sample. The components u1 and u2 represent displacements in the x1 and x2 coordinate directions, respectively.

This shift finder estimates each component of displacement using local cross-correlations. For each image sample, the estimated shift is that which yields the maximum correlation coefficient. This coefficient is found by quadratic interpolation of correlation functions sampled at integer lags.

Methods are provided to find and compensate for each component of shift sequentially. As each component is found, that component can be removed from the image g before estimating another component. For example, again for 2-D images f(x1,x2) and g(x1,x2), we might first estimate u1(x1,x2). If we then compute an image h(x1,x2) = g(x1+u1(x1,x2),x2), we can use f(x1,x2) and h(x1,x2) to estimate u2(x1,x2). By repeating this process sequentially, we obtain estimates for both u1(x1,x2) and u2(x1,x2) such that f(x1,x2) ~ g(x1+u1(x1,x2),x2+u2(x1,x2)).

Methods are also provided to whiten 2-D and 3-D images before estimating displacement vectors. This (spectral) whitening improves estimates of displacements parallel to image features that may be otherwise poorly resolved. Whitening is performed with local prediction error filters computed from local auto-correlations.

Version:
2006.11.18
Author:
Dave Hale, Colorado School of Mines

Constructor Summary
LocalShiftFinder(double sigma)
          Construct a shift estimator with specified parameters.
LocalShiftFinder(double sigma1, double sigma2)
          Construct a shift estimator with specified parameters.
LocalShiftFinder(double sigma1, double sigma2, double sigma3)
          Construct a shift estimator with specified parameters.
 
Method Summary
 void find1(int min1, int max1, float[][][] f, float[][][] g, float[][][] u)
          Finds shifts in the 1st dimension.
 void find1(int min1, int max1, float[][] f, float[][] g, float[][] u)
          Finds shifts in the 1st dimension.
 void find1(int min1, int max1, float[] f, float[] g, float[] u)
          Finds shifts in the 1st (and only) dimension.
 void find2(int min2, int max2, float[][][] f, float[][][] g, float[][][] u)
          Finds shifts in the 2nd dimension.
 void find2(int min2, int max2, float[][] f, float[][] g, float[][] u)
          Finds shifts in the 2nd dimension.
 void find3(int min3, int max3, float[][][] f, float[][][] g, float[][][] u)
          Finds shifts in the 3rd dimension.
 void setInterpolateDisplacements(boolean enable)
          Enables or disables interpolation of displacements when shifting.
 void shift1(float[][][] du, float[][][] u1, float[][][] u2, float[][][] u3, float[][][] h)
          Applies specified shift in the 1st dimension.
 void shift1(float[][] du, float[][] u1, float[][] u2, float[][] h)
          Applies specified shift in the 1st dimension.
 void shift1(float[] du, float[] u1, float[] h)
          Applies specified shift in the 1st (and only) dimension.
 void shift2(float[][][] du, float[][][] u1, float[][][] u2, float[][][] u3, float[][][] h)
          Applies specified shift in the 2nd dimension.
 void shift2(float[][] du, float[][] u1, float[][] u2, float[][] h)
          Applies specified shift in the 2nd dimension.
 void shift3(float[][][] du, float[][][] u1, float[][][] u2, float[][][] u3, float[][][] h)
          Applies specified shift in the 3rd dimension.
 void whiten(double sigma, float[][][] f, float[][][] g)
          Applies local prediction-error (spectal whitening) filters.
 void whiten(double sigma, float[][] f, float[][] g)
          Applies local prediction-error (spectal whitening) filters.
 void whiten(float[][][] f, float[][][] g)
          Applies local prediction-error (spectal whitening) filters.
 void whiten(float[][] f, float[][] g)
          Applies local prediction-error (spectal whitening) filters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

LocalShiftFinder

public LocalShiftFinder(double sigma)
Construct a shift estimator with specified parameters. When applied to multi-dimensional arrays, the estimator has the same correlation window half-width for all dimensions.

Parameters:
sigma - the correlation window half-width; must not be less than 1.

LocalShiftFinder

public LocalShiftFinder(double sigma1,
                        double sigma2)
Construct a shift estimator with specified parameters. When applied to multi-dimensional arrays, the estimator has half-width sigma1 for the 1st dimension and half-width sigma2 for 2nd and higher dimensions.

Parameters:
sigma1 - correlaton window half-width for 0st dimension; must not be less than 1.
sigma2 - correlation window half-width for 2nd and higher dimensions; must not be less than 1.

LocalShiftFinder

public LocalShiftFinder(double sigma1,
                        double sigma2,
                        double sigma3)
Construct a shift estimator with specified parameters. When applied to multi-dimensional arrays, the estimator has half-width sigma1 for the 1st dimension, half-width sigma2 for the 2nd dimension, and half-width sigma3 for 3rd and higher dimensions.

Parameters:
sigma1 - correlation window half-width for 1st dimension; must not be less than 1.
sigma2 - correlation window half-width for 2nd dimension; must not be less than 1.
sigma3 - correlation window half-width for 3rd and higher dimensions; must not be less than 1.
Method Detail

setInterpolateDisplacements

public void setInterpolateDisplacements(boolean enable)
Enables or disables interpolation of displacements when shifting. The default is to interpolate displacements. This is the most accurate method when sequentially applying non-constant shifts.

Parameters:
enable - true, to enable interpolation; false, to disable.

find1

public void find1(int min1,
                  int max1,
                  float[] f,
                  float[] g,
                  float[] u)
Finds shifts in the 1st (and only) dimension.

Parameters:
min1 - the minimum shift.
max1 - the maximum shift.
f - the input array f.
g - the input array g.
u - output array of shifts.

find1

public void find1(int min1,
                  int max1,
                  float[][] f,
                  float[][] g,
                  float[][] u)
Finds shifts in the 1st dimension.

Parameters:
min1 - the minimum shift.
max1 - the maximum shift.
f - the input array f.
g - the input array g.
u - output array of shifts.

find2

public void find2(int min2,
                  int max2,
                  float[][] f,
                  float[][] g,
                  float[][] u)
Finds shifts in the 2nd dimension.

Parameters:
min2 - the minimum shift.
max2 - the maximum shift.
f - the input array f.
g - the input array g.
u - output array of shifts.

find1

public void find1(int min1,
                  int max1,
                  float[][][] f,
                  float[][][] g,
                  float[][][] u)
Finds shifts in the 1st dimension.

Parameters:
min1 - the minimum shift.
max1 - the maximum shift.
f - the input array f.
g - the input array g.
u - output array of shifts.

find2

public void find2(int min2,
                  int max2,
                  float[][][] f,
                  float[][][] g,
                  float[][][] u)
Finds shifts in the 2nd dimension.

Parameters:
min2 - the minimum shift.
max2 - the maximum shift.
f - the input array f.
g - the input array g.
u - output array of shifts.

find3

public void find3(int min3,
                  int max3,
                  float[][][] f,
                  float[][][] g,
                  float[][][] u)
Finds shifts in the 3rd dimension.

Parameters:
min3 - the minimum shift.
max3 - the maximum shift.
f - the input array f.
g - the input array g.
u - output array of shifts.

shift1

public void shift1(float[] du,
                   float[] u1,
                   float[] h)
Applies specified shift in the 1st (and only) dimension.

Parameters:
du - input array of changes to displacements in 1st dimension.
u1 - input/output array of displacements in 1st dimension.
h - input/output array of image samples.

shift1

public void shift1(float[][] du,
                   float[][] u1,
                   float[][] u2,
                   float[][] h)
Applies specified shift in the 1st dimension.

Parameters:
du - input array of changes to displacements in 1st dimension.
u1 - input/output array of displacements in 1st dimension.
u2 - input/output array of displacements in 2nd dimension.
h - input/output array of image samples.

shift2

public void shift2(float[][] du,
                   float[][] u1,
                   float[][] u2,
                   float[][] h)
Applies specified shift in the 2nd dimension.

Parameters:
du - input array of changes to displacements in 2nd dimension.
u1 - input/output array of displacements in 1st dimension.
u2 - input/output array of displacements in 2nd dimension.
h - input/output array of image samples.

shift1

public void shift1(float[][][] du,
                   float[][][] u1,
                   float[][][] u2,
                   float[][][] u3,
                   float[][][] h)
Applies specified shift in the 1st dimension.

Parameters:
du - input array of changes to displacements in 1st dimension.
u1 - input/output array of displacements in 1st dimension.
u2 - input/output array of displacements in 2nd dimension.
u3 - input/output array of displacements in 3rd dimension.
h - input/output array of image samples.

shift2

public void shift2(float[][][] du,
                   float[][][] u1,
                   float[][][] u2,
                   float[][][] u3,
                   float[][][] h)
Applies specified shift in the 2nd dimension.

Parameters:
du - input array of changes to displacements in 2nd dimension.
u1 - input/output array of displacements in 1st dimension.
u2 - input/output array of displacements in 2nd dimension.
u3 - input/output array of displacements in 3rd dimension.
h - input/output array of image samples.

shift3

public void shift3(float[][][] du,
                   float[][][] u1,
                   float[][][] u2,
                   float[][][] u3,
                   float[][][] h)
Applies specified shift in the 3rd dimension.

Parameters:
du - input array of changes to displacements in 3rd dimension.
u1 - input/output array of displacements in 1st dimension.
u2 - input/output array of displacements in 2nd dimension.
u3 - input/output array of displacements in 3rd dimension.
h - input/output array of image samples.

whiten

public void whiten(float[][] f,
                   float[][] g)
Applies local prediction-error (spectal whitening) filters. The input and output arrays f and g can be the same array.

Parameters:
f - the input array.
g - the output array.

whiten

public void whiten(double sigma,
                   float[][] f,
                   float[][] g)
Applies local prediction-error (spectal whitening) filters. The input and output arrays f and g can be the same array.

Parameters:
sigma - half-width of Gaussian smoothing applied after whitening; less than one for no smoothing.
f - the input array.
g - the output array.

whiten

public void whiten(float[][][] f,
                   float[][][] g)
Applies local prediction-error (spectal whitening) filters. The input and output arrays f and g can be the same array. Smooths the output with a Gaussian filter with half-width sigma = 1.0.

Parameters:
f - the input array.
g - the output array.

whiten

public void whiten(double sigma,
                   float[][][] f,
                   float[][][] g)
Applies local prediction-error (spectal whitening) filters. The input and output arrays f and g can be the same array.

Parameters:
sigma - half-width of Gaussian smoothing applied after whitening; less than one for no smoothing.
f - the input array.
g - the output array.