edu.mines.jtk.dsp
Class EigenTensors3

java.lang.Object
  extended by edu.mines.jtk.dsp.EigenTensors3
All Implemented Interfaces:
Tensors3, java.io.Serializable

public class EigenTensors3
extends java.lang.Object
implements Tensors3, java.io.Serializable

An array of eigen-decompositions of tensors for 3D image processing. Each tensor is a symmetric positive-semidefinite 3-by-3 matrix:


     |a11 a12 a13|
 A = |a12 a22 a23|
     |a13 a23 a33|
 
Such tensors can be used to parameterize anisotropic image processing.

The eigen-decomposition of the matrix A is


 A = au*u*u' + av*v*v' + aw*w*w' 
   = (au-av)*u*u' + (aw-av)*w*w' + av*I
 
where u, v, and w are orthogonal unit eigenvectors of A. (The notation u' denotes the transpose of u.) The outer products of eigenvectors are scaled by the non-negative eigenvalues au, av, and aw. The second equation exploits the identity u*u' + v*v' + w*w' = I, and makes apparent the redundancy of the vector v.

Only the 1st and 2nd components of the eigenvectors u and w are stored. Except for a sign, the 3rd components may be computed from the 1st and 2nd. Because the tensors are independent of the choice of sign, the eigenvectors u and w are stored with an implied non-negative 3rd component.

Storage may be further reduced by compression, whereby eigenvalues and eigenvectors are quantized. Quantization errors for eigenvalues (au,av,aw) are less than 0.001*(au+av+aw). Quantization errors for eigenvectors are less than one degree of arc on the unit sphere. Memory required to store each tensor is 12 bytes if compressed, and 28 bytes if not compressed.

Version:
2008.06.07
Author:
Dave Hale, Colorado School of Mines
See Also:
Serialized Form

Constructor Summary
EigenTensors3(float[][][] u1, float[][][] u2, float[][][] w1, float[][][] w2, float[][][] au, float[][][] av, float[][][] aw, boolean compressed)
          Constructs tensors for specified array dimensions and eigenvalues.
EigenTensors3(int n1, int n2, int n3, boolean compressed)
          Constructs tensors for specified array dimensions.
 
Method Summary
 void getEigenvalues(float[][][] au, float[][][] av, float[][][] aw)
          Gets eigenvalues for all tensors.
 float[] getEigenvalues(int i1, int i2, int i3)
          Gets eigenvalues for the tensor with specified indices.
 void getEigenvalues(int i1, int i2, int i3, float[] a)
          Gets eigenvalues for the tensor with specified indices.
 float[] getEigenvectorU(int i1, int i2, int i3)
          Gets the eigenvector u for the tensor with specified indices.
 void getEigenvectorU(int i1, int i2, int i3, float[] u)
          Gets the eigenvector u for the tensor with specified indices.
 float[] getEigenvectorV(int i1, int i2, int i3)
          Gets the eigenvector v for the tensor with specified indices.
 void getEigenvectorV(int i1, int i2, int i3, float[] v)
          Gets the eigenvector v for the tensor with specified indices.
 float[] getEigenvectorW(int i1, int i2, int i3)
          Gets the eigenvector w for the tensor with specified indices.
 void getEigenvectorW(int i1, int i2, int i3, float[] w)
          Gets the eigenvector w for the tensor with specified indices.
 int getN1()
          Gets the number of tensors in the 1st dimension.
 int getN2()
          Gets the number of tensors in the 2nd dimension.
 int getN3()
          Gets the number of tensors in the 3rd dimension.
 float[] getTensor(int i1, int i2, int i3)
          Gets tensor elements for specified indices.
 void getTensor(int i1, int i2, int i3, float[] a)
          Gets tensor elements for specified indices.
 void setEigenvalues(float[][][] au, float[][][] av, float[][][] aw)
          Sets eigenvalues for all tensors.
 void setEigenvalues(float au, float av, float aw)
          Sets eigenvalues for all tensors.
 void setEigenvalues(int i1, int i2, int i3, float[] a)
          Sets eigenvalues for the tensor with specified indices.
 void setEigenvalues(int i1, int i2, int i3, float au, float av, float aw)
          Sets eigenvalues for the tensor with specified indices.
 void setEigenvectorU(int i1, int i2, int i3, float[] u)
          Sets the eigenvector u for the tensor with specified indices.
 void setEigenvectorU(int i1, int i2, int i3, float u1, float u2, float u3)
          Sets the eigenvector u for the tensor with specified indices.
 void setEigenvectorW(int i1, int i2, int i3, float[] w)
          Sets the eigenvector w for the tensor with specified indices.
 void setEigenvectorW(int i1, int i2, int i3, float w1, float w2, float w3)
          Sets the eigenvector w for the tensor with specified indices.
 void setTensor(int i1, int i2, int i3, float[] a)
          Sets tensor elements for specified indices.
 void setTensor(int i1, int i2, int i3, float a11, float a12, float a13, float a22, float a23, float a33)
          Sets tensor elements for specified indices.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EigenTensors3

public EigenTensors3(int n1,
                     int n2,
                     int n3,
                     boolean compressed)
Constructs tensors for specified array dimensions. All eigenvalues and eigenvectors u and w are not set and are initially zero.

Parameters:
n1 - number of tensors in 1st dimension.
n2 - number of tensors in 2nd dimension.
n3 - number of tensors in 3rd dimension.
compressed - true, for compressed tensors; false, otherwise.

EigenTensors3

public EigenTensors3(float[][][] u1,
                     float[][][] u2,
                     float[][][] w1,
                     float[][][] w2,
                     float[][][] au,
                     float[][][] av,
                     float[][][] aw,
                     boolean compressed)
Constructs tensors for specified array dimensions and eigenvalues. The 3rd components of eigenvectors u and v are computed from the 1st and 2nd components and are assumed to be non-negative.

Parameters:
u1 - array of 1st components of u.
u2 - array of 2nd components of u.
w1 - array of 1st components of w.
w2 - array of 2nd components of w.
au - array of eigenvalues au.
av - array of eigenvalues av.
aw - array of eigenvalues aw.
compressed - true, for compressed tensors; false, otherwise.
Method Detail

getN1

public int getN1()
Gets the number of tensors in the 1st dimension.

Returns:
the number of tensors in the 1st dimension.

getN2

public int getN2()
Gets the number of tensors in the 2nd dimension.

Returns:
the number of tensors in the 2nd dimension.

getN3

public int getN3()
Gets the number of tensors in the 3rd dimension.

Returns:
the number of tensors in the 3rd dimension.

getTensor

public void getTensor(int i1,
                      int i2,
                      int i3,
                      float[] a)
Gets tensor elements for specified indices.

Specified by:
getTensor in interface Tensors3
Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
a - array {a11,a12,a13,a22,a23,a33} of tensor elements.

getTensor

public float[] getTensor(int i1,
                         int i2,
                         int i3)
Gets tensor elements for specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
Returns:
a array {a11,a12,a13,a22,a23,a33} of tensor elements.

getEigenvalues

public void getEigenvalues(int i1,
                           int i2,
                           int i3,
                           float[] a)
Gets eigenvalues for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
a - array {au,av,aw} of eigenvalues.

getEigenvalues

public float[] getEigenvalues(int i1,
                              int i2,
                              int i3)
Gets eigenvalues for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
Returns:
array {au,av,aw} of eigenvalues.

getEigenvalues

public void getEigenvalues(float[][][] au,
                           float[][][] av,
                           float[][][] aw)
Gets eigenvalues for all tensors.

Parameters:
au - array of eigenvalues au.
av - array of eigenvalues av.
aw - array of eigenvalues aw.

getEigenvectorU

public void getEigenvectorU(int i1,
                            int i2,
                            int i3,
                            float[] u)
Gets the eigenvector u for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
u - array {u1,u2,u3} of eigenvector components.

getEigenvectorU

public float[] getEigenvectorU(int i1,
                               int i2,
                               int i3)
Gets the eigenvector u for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
Returns:
array {u1,u2,u3} of eigenvector components.

getEigenvectorV

public void getEigenvectorV(int i1,
                            int i2,
                            int i3,
                            float[] v)
Gets the eigenvector v for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
v - array {v1,v2,v3} of eigenvector components.

getEigenvectorV

public float[] getEigenvectorV(int i1,
                               int i2,
                               int i3)
Gets the eigenvector v for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
Returns:
array {v1,v2,v3} of eigenvector components.

getEigenvectorW

public void getEigenvectorW(int i1,
                            int i2,
                            int i3,
                            float[] w)
Gets the eigenvector w for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
w - array {w1,w2,w3} of eigenvector components.

getEigenvectorW

public float[] getEigenvectorW(int i1,
                               int i2,
                               int i3)
Gets the eigenvector w for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
Returns:
array {w1,w2,w3} of eigenvector components.

setTensor

public void setTensor(int i1,
                      int i2,
                      int i3,
                      float[] a)
Sets tensor elements for specified indices. This method first computes an eigen-decomposition of the specified tensor, and then stores the computed eigenvectors and eigenvalues. The eigenvalues are ordered such that au >= av >= aw >= 0.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
a - array {a11,a12,a13,a22,a23,a33} of tensor elements.

setTensor

public void setTensor(int i1,
                      int i2,
                      int i3,
                      float a11,
                      float a12,
                      float a13,
                      float a22,
                      float a23,
                      float a33)
Sets tensor elements for specified indices. This method first computes an eigen-decomposition of the specified tensor, and then stores the computed eigenvectors and eigenvalues. The eigenvalues are ordered such that au >= av >= aw >= 0.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
a11 - tensor element a11.
a12 - tensor element a12.
a13 - tensor element a13.
a22 - tensor element a22.
a23 - tensor element a23.
a33 - tensor element a33.

setEigenvalues

public void setEigenvalues(float au,
                           float av,
                           float aw)
Sets eigenvalues for all tensors.

Parameters:
au - eigenvalue au.
av - eigenvalue av.
aw - eigenvalue aw.

setEigenvalues

public void setEigenvalues(float[][][] au,
                           float[][][] av,
                           float[][][] aw)
Sets eigenvalues for all tensors.

Parameters:
au - array of eigenvalues au.
av - array of eigenvalues av.
aw - array of eigenvalues aw.

setEigenvalues

public void setEigenvalues(int i1,
                           int i2,
                           int i3,
                           float au,
                           float av,
                           float aw)
Sets eigenvalues for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
au - eigenvalue au.
av - eigenvalue av.
aw - eigenvalue aw.

setEigenvalues

public void setEigenvalues(int i1,
                           int i2,
                           int i3,
                           float[] a)
Sets eigenvalues for the tensor with specified indices.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
a - array {au,av,aw} of eigenvalues.

setEigenvectorU

public void setEigenvectorU(int i1,
                            int i2,
                            int i3,
                            float u1,
                            float u2,
                            float u3)
Sets the eigenvector u for the tensor with specified indices. The specified vector is assumed to have length one. If the 3rd component is negative, this method stores the negative of the specified vector, so that the 3rd component is positive.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
u1 - 1st component of u.
u2 - 2nd component of u.
u3 - 3nd component of u.

setEigenvectorU

public void setEigenvectorU(int i1,
                            int i2,
                            int i3,
                            float[] u)
Sets the eigenvector u for the tensor with specified indices. The specified vector is assumed to have length one. If the 3rd component is negative, this method stores the negative of the specified vector, so that the 3rd component is positive.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
u - {u1,u2,u3} of eigenvector components.

setEigenvectorW

public void setEigenvectorW(int i1,
                            int i2,
                            int i3,
                            float w1,
                            float w2,
                            float w3)
Sets the eigenvector w for the tensor with specified indices. The specified vector is assumed to have length one. If the 3rd component is negative, this method stores the negative of the specified vector, so that the 3rd component is positive.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
w1 - 1st component of w.
w2 - 2nd component of w.
w3 - 3nd component of w.

setEigenvectorW

public void setEigenvectorW(int i1,
                            int i2,
                            int i3,
                            float[] w)
Sets the eigenvector w for the tensor with specified indices. The specified vector is assumed to have length one. If the 3rd component is negative, this method stores the negative of the specified vector, so that the 3rd component is positive.

Parameters:
i1 - index for 1st dimension.
i2 - index for 2nd dimension.
i3 - index for 3rd dimension.
w - {w1,w2,w3} of eigenvector components.