edu.mines.jtk.dsp
Class SteerablePyramid

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

public class SteerablePyramid
extends java.lang.Object

Steerable pyramid for 2D and 3D images. Includes creation of the steerable pyramid, estimation of local orientation and dimensionality attributes, application of steering weights and scaling to enhance locally linear features, and construction of the filtered image.

This implementation of the steerable pyramid transform performs a multi-scale, multi-orientation decomposition of an input image through application of radial and directional filters in wavenumber domain. The basis steerable filter amplitudes are proportional to cos^2(theta). Three basis orientations are used for 2D, and six orientations are used for 3D images. Radial filters are used to partition the data into 1-octave bands, with a cosine taper. Images are subsampled for each pyramid level which greatly reduces processing effort for lower wavenumbers.

Directionally-filtered basis images are used to estimate local orientation and dimensionality. Preprocessing, which includes averaging in space and scale domains, is applied for these estimates. Steering weights can be calculated and applied. Scaling and thresholding can also be applied, based on a local dimensionality attribute. For 3D images, processing can be applied to enhance either locally-linear or locally-planar features.

The number of pyramid levels to use is calculated from the size of the input image, assuming a minimum basis image dimension of 9 samples in x,y or z. The input image is padded before it is transformed to wavenumber domain, where the filters are applied. The main reason for this padding is to avoid losing first or last samples when subsampling. We like the number of samples to be such that, for number of samples n in x, y, or z, (n-1)/2+1 will always yield an integer.

The format of the steerable pyramid is a 4-dimensional array for 2D, and a 5-dimensional array for 3D. The first dimension is level number and second dimension is basis filter orientation. Below these are either 2D or 3D arrays. To illustrate for 2D:

[0][0][0][0] to [0][0][n2][n1] = level 0, theta 0

[0][1][0][0] to [0][1][n2][n1] = level 0, theta PI/3

[0][2][0][0] to [0][2][n2][n1] = level 0, theta 2*PI/3

[1][0][0][0] to [1][0][(n2-1)/2+1][(n1-1)/2+1] = level 1, theta 0

[1][1][0][0] to [1][1][(n2-1)/2+1][(n1-1)/2+1] = level 1, theta PI/3

[1][2][0][0] to [1][2][(n2-1)/2+1][(n1-1)/2+1] = level 1, theta 2*PI/3

...

[NLEVEL-1][2][0][0] to [NLEVEL-1][2][(n2-1)/(2^(NLEVEL-1))+1][(n1-1)/(2^(NLEVEL-1))+1] = level N-1, theta 2*PI/3

[NLEVEL][0][0][0] to [NLEVEL][0][(n2-1)/(2^NLEVEL)+1][(n1-1)/(2^NLEVEL)+1] = residual low-wavenumber image

The 3D steerable pyramid array is the same except that it is arrays of arrays of 3D, rather than 2D arrays.

Version:
2008.12.01
Author:
John Mathewson, Colorado School of Mines

Constructor Summary
SteerablePyramid()
          Construct a steerable pyramid with default cutoff wavenumbers used in the radial low-pass filters.
SteerablePyramid(double ka, double kb)
          Construct a steerable pyramid with specified cutoff wavenumbers used in the radial low-pass filters.
 
Method Summary
 float[][][][][] estimateAttributes(boolean forlinear, double sigma, float[][][][][] spyr)
          Estimation of local orientation and linearity attributes in 3D.
 float[][][][] estimateAttributes(double sigma, float[][][][] spyr)
          Estimation of local orientation and linearity attributes in 2D.
 float[][][][] makePyramid(float[][] x)
          Creates a steerable pyramid representation of an input 2D image.
 float[][][][][] makePyramid(float[][][] x)
          Creates a steerable pyramid representation of an input 3D image.
 void steerScale(boolean forlinear, int linpowr, float k, float thresh, float[][][][][] attr, float[][][][][] spyr)
          Applies steering weights and scaling or thresholding based on linearity attribute to the basis images in the input 3D steerable pyramid array.
 void steerScale(int linpowr, float k, float thresh, float[][][][] attr, float[][][][] spyr)
          Applies steering weights and scaling or thresholding based on linearity attribute to the basis images in the input 2D steerable pyramid.
 float[][] sumPyramid(boolean keeplow, float[][][][] spyr)
          Sums all basis images from an input 2D steerable pyramid to create a filtered output image.
 float[][][] sumPyramid(boolean keeplow, float[][][][][] spyr)
          Sums all basis images from an input 3D steerable pyramid to create a filtered output image.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SteerablePyramid

public SteerablePyramid()
Construct a steerable pyramid with default cutoff wavenumbers used in the radial low-pass filters. Default values are: ka=0.60 and kb=1.00, where ka and kb are wavenumbers at start and end of taper (Amp(ka)=1.0, Amp(kb)=0.0).


SteerablePyramid

public SteerablePyramid(double ka,
                        double kb)
Construct a steerable pyramid with specified cutoff wavenumbers used in the radial low-pass filters.

Parameters:
ka - wavenumber at start of taper. Amp(ka)=1.
kb - wavenumber at end of taper. Amp(ka)=0.
Method Detail

makePyramid

public float[][][][] makePyramid(float[][] x)
Creates a steerable pyramid representation of an input 2D image.

Parameters:
x - input 2D image.
Returns:
array containing steerable pyramid representation of the input 2D image.

makePyramid

public float[][][][][] makePyramid(float[][][] x)
Creates a steerable pyramid representation of an input 3D image.

Parameters:
x - input 3D image.
Returns:
array containing steerable pyramid representation of the input 3D image.

sumPyramid

public float[][] sumPyramid(boolean keeplow,
                            float[][][][] spyr)
Sums all basis images from an input 2D steerable pyramid to create a filtered output image. Optionally, residual low-wavenumber image can be zeroed.

Parameters:
keeplow - if true:keep low-wavenumber energy, if false: zero it.
spyr - input 2D steerable pyramid.
Returns:
array containing output filtered 2D image.

sumPyramid

public float[][][] sumPyramid(boolean keeplow,
                              float[][][][][] spyr)
Sums all basis images from an input 3D steerable pyramid to create a filtered output image. Optionally, residual low-wavenumber image can be zeroed.

Parameters:
keeplow - if true:keep low-wavenumber energy, if false: zero it.
spyr - input 3D steerable pyramid.
Returns:
array containing output filtered 3D image.

estimateAttributes

public float[][][][] estimateAttributes(double sigma,
                                        float[][][][] spyr)
Estimation of local orientation and linearity attributes in 2D. Preprocessing and 2D Gaussian filtering are applied to input basis images before analysis, and averaging of data from adjacent pyramid levels is performed. Gaussian half-widths are varied when averaging adjacent levels to maintain consistent smoothing for the levels being averaged.

The format of the output attributes is a 4-dimensional array. The first dimension is level number and second dimension is type of attribute. Below these are 2D arrays:

[0][0][0][0] to [0][0][n2][n1] = level 0, theta attribute (radians)

[0][1][0][0] to [0][1][n2][n1] = level 0, linearity attribute

[1][0][0][0] to [1][0][(n2-1)/2+1][(n1-1)/2+1] = level 1, theta attribute (radians)

[1][1][0][0] to [1][1][(n2-1)/2+1][(n1-1)/2+1] = level 1, linearity attribute

...

[NLEVEL-1][1][0][0] to [NLEVEL-1][1][(n2-1)/(2^(NLEVEL-1))+1][(n1-1)/(2^(NLEVEL-1))+1] = level N-1, linearity attribute

Parameters:
sigma - half-width of 2D Gaussian smoothing filter.
spyr - input 2D steerable pyramid.
Returns:
array containing local orientation estimate and linearity attribute for all sample locations in every pyramid level. Array consists of numlevels*2 2D sub-arrays. For each level the first sub-array contains orientation theta in radians, and the second contains linearity attribute ranging from 0 to 1.

estimateAttributes

public float[][][][][] estimateAttributes(boolean forlinear,
                                          double sigma,
                                          float[][][][][] spyr)
Estimation of local orientation and linearity attributes in 3D. Preprocessing and 3D Gaussian filtering are applied to input basis images before analysis, and averaging of data from adjacent pyramid levels is performed. Gaussian half-widths are varied when averaging adjacent levels to maintain consistent smoothing for the levels being averaged.

In 3D we have a choice of filtering to enhance locally-planar or locally-linear image features. There is a parameter in this method to select one of these choices. If enhancement of planar features is selected the output orientation attributes define the normal to locally-planar features, and the dimensionality attribute is a measure of planarity. If enhancement of locally-linear features is selected the output orientation attributes define the orientation of a locally-linear feature, and the dimensionality attribute is a local measure of linearity.

The format of the output attributes is a 5-dimensional array. The first dimension is level number and second dimension is type of attribute. Below these are 3D arrays:

[0][0][0][0][0] to [0][0][n3][n2][n1] = level 0, direction cosine a

[0][0][0][0][0] to [0][0][n3][n2][n1] = level 0, direction cosine b

[0][0][0][0][0] to [0][0][n3][n2][n1] = level 0, direction cosine c

[0][1][0][0][0] to [0][1][n3][n2][n1] = level 0, dimensionality attribute

These are repeated for all levels, subsampled for every successive level.

Parameters:
forlinear - true: apply to enhance locally linear, false: apply for planar.
sigma - half-width of 3D Gaussian smoothing filter.
spyr - input 3D steerable pyramid.
Returns:
array containing local orientation estimate and dimensionality attribute for all sample locations in every pyramid level. Array consists of numlevels*4 3D sub-arrays. For each level the first three sub-arrays contain direction cosines, and the fourth contains dimensionality attribute ranging from 0 to 1.

steerScale

public void steerScale(boolean forlinear,
                       int linpowr,
                       float k,
                       float thresh,
                       float[][][][][] attr,
                       float[][][][][] spyr)
Applies steering weights and scaling or thresholding based on linearity attribute to the basis images in the input 3D steerable pyramid array. If "forlinear" option was used when estimateAttributes was run, this method will convert basis images from plane-enhancing cos^2-filtered to line-enhancing sin^2-filtered versions. Scaling options include: No scaling (linpowr=0). Linearity raised to a power (1 ≤ linpowr ≤ 98). Sigmoidal thresholding (linpowr=99) Typical values for thresholding parameters are k=50.0, thresh=0.5.

Parameters:
forlinear - true: apply to enhance locally linear, false: apply for planar.
linpowr - linearity power and scaling type switch.
k - sigmoidal thresholding steepness.
thresh - threshold.
attr - input array containing direction cosines and dimensionality.
spyr - input/output 3D steerable pyramid.

steerScale

public void steerScale(int linpowr,
                       float k,
                       float thresh,
                       float[][][][] attr,
                       float[][][][] spyr)
Applies steering weights and scaling or thresholding based on linearity attribute to the basis images in the input 2D steerable pyramid. Scaling options include: No scaling (linpowr=0). Linearity raised to a power (1 ≤ linpowr ≤ 98). Sigmoidal thresholding (linpowr=99) Typical values for thresholding parameters are k=50.0, thresh=0.5.

Parameters:
linpowr - linearity power and scaling type switch.
k - sigmoidal thresholding steepness.
thresh - threshold.
attr - input array containing local orientation and linearity.
spyr - input/output 2D steerable pyramid.