Processing on 2D Images

CakeWaveletStackorientation sensitive wavelets, can be used for OrientationScoreTransform
GaborWaveletStackorientation sensitve wavelets, can be used for OrientationScoreTransform
OrientationScoreTransformcomputes an orientation score from an image
InverseOrientationScoreTransformapplies reconstruction to the orientation score
LeftInvariantDerivativesleft-invariant derivatives from position and orientation data
OrientationScoreGaugeFramesdata-adaptive frame
OrientationScoreTensorbundles of left invariant derivatives
FastMarchingshortest path tracking
GlyphPlotglyph visualization of the position orientation data
OrientationScorePlotImage3D wrapper function for position orientation data
ColorOrientationProjectionconstructs maximum orientation projection

Functions which can be used in image processing.

Load the Lie Analysis package
In[1]:=
Click for copyable input

Orientation Scores

An orientation score Uf of a function f can be constructed by means of convolution with some anisotropic filter ψ.

Orientation Sensitive Wavelets

Orientation scores are constructed using anisotropic filters. In this package we use two types of such filters: cake wavelets and Gabor wavelets.

CakeWaveletStack[n, dim]returns a stack of n oriented cake wavelets
GaborWaveletStack[n, scale, dim]returns a stack of n oriente gabor wavelets at scale

Functions to construct orientation sensitive wavelets

Cake Wavelets

Cake wavelets are designed in the Fourier domain. By using polar coordinates, the Fourier domain can be uniformly divided into No equally wide samples on the angular axis. To construct a cake wavelet use the function CakeWaveletStack.

Construct a Cake wavelet and specify that 12 orientations should be used
Click for copyable input

To see all parameters that model the shape of the wavelets, please take a look at the options section in CakeWaveletStack to see their influence on the shape. The parameters are summarized bellow.

option name
default value
"Directional"Falsedouble or single headed wavelets
"Design"Nwhich design constraints are used
"SplineOrder"3spline order that is used in angular direction
"MnOrder"8Order of the high frequency window
"InflectionPoint"0.8indicate the fractional position of high frequenct window
"DcStandardDeviation"3low frequency filter σ
"OverlapFactor"1subsample factor of the angular component

Parameters to control the shape of the wavelets.

The following table shows how these parameters influence the shape of the wavelets in both the spatial and corresponding spatial domain. For more examples please take a look at CakeWaveletStack.

Note that OrientationScoreTransform uses cake wavelets by default if no specific orientation sensitive wavelet is provided. Therefore all options of the cake wavelets can also be supplied to the OrientationScoreTransform function. This also means that it is not necessary to create these wavelets separately.

Gabor wavelets

Gabor wavelets are directional wavelets, and can be tuned to specific spatial frequencies. To construct a Gabor wavelets use the function GaborWaveletStack.

Construction of Gabor wavelets
Click for copyable input

To see how the parameters influence the shape of the wavelet, take a look at the options section in GaborWaveletStack. The following parameters can be specified through options

option name
default value
"WaveletSize"Automaticdimensions of the wavelet
"Epsilon"4controls anisotropy of the wavelets
"K0"{0,3}controls spatial frequency of the complex exponential
"Directional"Falsedouble or single headed wavelets

Construction

Construction of orientation scores is convolution of an image f, with the anisotropic wavelet ψ. The function OrientationScoreTransform can be used to do this. The function can used in different ways.

OrientationScoreTransform[image]constructs an orientation score from image
OrientationScoreTransform[image, options]constructs an orientation score from image using the parameters specified by the options
OrientationScoreTransform[image, waveletObject]constructs an orientation score from image using the supplied waveletObject

Functions to construct an orientation score from images.

Simple Usage

In the most simple case, only the image needs to be specified. Lets load an example image from the Lie Analysis server. Please note that you should have already used this image before or you require an internet connection to download the example data.

Load an Example image from the server
Click for copyable input

This image can be supplied to the OrientationScoreTransform function. This is can either be an image or the ImageData from an image. If the supplied image is non-grayscale it will try to convert the image to grayscale.

Compute an orientation score from the spagetti
Click for copyable input

To extract the Orientation Score from this the element Data can be used. Wherever possible, the Lie Analysis package tries to minimize the stored data by using symmetry in the orientation axis. Note that this object has a symmetry property, thus if you would like to have the full angular domain (from 0 to 2π) you need to used the property FullData.

Compute the dimensions of the Orientation Score
Click for copyable input

The used wavelets can be requested using the element Wavelets. In this

Extract the wavelets used to construct the orientation score
Click for copyable input

Shape the Wavelets that are Used

In previous section no parameters are specified to control the shape of the wavelets that are used for the construction of orientation scores. In most cases, you do want to control the shape and type of the wavelet for your specific application.

Compute Orientation Score using Gabor wavelets
Click for copyable input

If the "Type" has been set to Gabor, then the parameters from GaborWaveletStack can be used to modify the shape of the Gabor wavelets. Likewise if the "Type" has been set to Cake, the parameters from CakeWaveletStack can be used. The following tables indicates which parameters can be set for each of the wavelets.

option name
default value
"Directional"Falsedouble or single headed wavelets
"Orientations"12the number of orientations

Parameters that can be specified for both Cake and Gabor Wavelets.

option name
default value
"Design"Nwhich design constraints are used
"SplineOrder"3spline order that is used in angular direction
"MnOrder"8Order of the high frequency window
"InflectionPoint"0.8indicate the fractional position of high frequenct window
"DcStandardDeviation"3low frequency filter σ
"OverlapFactor"1subsample factor of the angular component

Parameters that can be specified for Cake Wavelets.

option name
default value
"Epsilon"4controls anisotropy of the wavelets
"K0"{0,3}controls spatial frequency of the complex exponential

Parameters that can be specified for Gabor wavelets.

For example if we would like to modify the scale of the Gabor wavelets.

Modify the scale and number of orientations of the Gabor wavelets
Click for copyable input

Providing Precomputed Wavelets

A final method to use the function OrientationScoreTransform is to supply a GaborWaveletStack or CakeWaveletStack instead of options to specify the shape of the wavelets.

Use precomputed wavelets
Click for copyable input

Reconstruction

To apply reconstruction to orientation scores we go from the position-orientation domain to the spatial domain.

InverseOrientationScoreTransform[ObjPositionOrientationData]applies reconstruction to ObjPositionOrientationData by simply integrating in the angular direction
InverseOrientationScoreTransform[ObjPositionOrientationData, Options]applies reconstruction to ObjPositionOrientationData using the options specified

Function to apply reconstruction to the orientation scores.

Load image and compute Orientation Score
Click for copyable input

Now reconstruct the image using the default settings.

Reconstruct the original image
Click for copyable input

Reconstruction Without Low Frequencies

In case that we have used cake wavelets the low frequencies have been removed from the image (controlled by the parameter "DcStandardDeviation"). Thus the center of the cake in the Fourier domain has been removed.

On the left the Fourier cake, the center of the cake (low frequencies) has been removed. On the right the low frequency image that is not used to construct the orientation scores.
Click for copyable input

In the default reconstruction this low frequency image is added after the reconstruction is applied. However if you have performed some processing in the position-orientation domain before reconstructing an image this may not be appropriate. In this case you can set "UseDcComponent" to False.

Reconstruction without the low frequency component
Click for copyable input

Reconstruction Methods

Different methods for reconstruction can be used. The default reconstruction method is simply integrating over the orientation axis. Besides integration, exact and L2-norm preserving reconstruction can be applied by specifying the option "Method".

Reconstruction using different methods
Click for copyable input

Visualization

There are several ways included to visualize an orientation score.

Visualization of the individual slices of an orientation score
Click for copyable input
Maximum intensity projection using a color-scale to indicate what the maximum orientation is.
Click for copyable input
OrientationScorePlot uses the Image3D to show the orientation scores
Click for copyable input
A final method to visualize is using GlyphPlot
Click for copyable input
Click for copyable input

Left-Invariant Derivatives

The function LeftInvariantDerivatives allows to compute gaussian derivatives that respects the left-invariant frame. In other words, the derivative frame also rotates with the orientation axis. The build-in GaussianFilter is used to compute the derivatives.

LeftInvariantDerivatives[ObjPositionOrientationData, {σs,σo},derivativeIndex]Computes the derivativeIndex left-invariant gaussian derivatives from ObjPositionOrientationData using the spatial scale σs and the angular scale σo.
LeftInvariantDerivatives[ObjPositionOrientationData,{σs,σo},{derivativeIndex..}]Compute multiple derivatives specified by the at once
OrientationScoreTensor[ObjPositionOrientationData, {σs,σo},{derivativeIndex..}]Compute multiple derivatives at once an store them in a single object (ObjTensor)

Functions to compute derivatives in the position orientation domain.

Load example data and compute orientation scores
Click for copyable input

Now we can compute the left-invariant Gaussian derivatives by supplying the Orientation Score, Gaussian scales, and obviously in which direction we would like to compute the derivative. The directions are indicated by the indices (i) of the left invariant frame (Ai). For example if we would like to compute the A2 derivative (perpendicular to the structures in the orientation scores)

Compute the A2 Derivative
Click for copyable input

Note that the symmetry has changed to -π. Any order derivative can be computed, and it is also possible to compute multiple derivatives at once.

Computing high order derivative and multiple derivatives at once
Click for copyable input

The output of the function might not what you would expect. In some cases it is more useful to have the derivatives as the last dimension of you Data object (in case of a gradient or hessian). To this purpose the OrientationScoreTensor function can be used.

Compute a tensor object from orientation score derivatives
Click for copyable input

The Hessian and gradient are predefined so that you can specify them as a string instead of the indices. It is recommend to use these predefined strings whenever possible as computation internally is optimized for these specific cases.

Computing the Hessian from an orientation score can be done by supplying a string the function OrientationScoreTensor.
Click for copyable input

Locally Adaptive Frame

The Left-invariant frame aligns with the discrete orientations of the anisotropic kernel used to construct the orientation scores. Each orientation layer has therefore its own derivative frame. However the data in the score is not always perfectly aligned with the kernels used to do the lifting, this is especially the case when a low number of orientations is used. The Gauge frame is constructed in such a way that it is better aligned with the data in the score. Resulting in a different frame for each position x in the score.

Load example image and compute Orientation Score.
Click for copyable input

To compute the Gauge frame the function OrientationScoreGaugeFrames can be used.

OrientationScoreGaugeFrames[ObjTensor]computes a locally adaptive frame using the ObjTensor, which should be the hessian of an orientation score. The returned frame is with respect to the left-invariant frame
OrientationScoreGaugeFrames[ObjPositionOrientationData, {σs,σo}]computes a locally adaptive frame from the ObjPositionOrientationData by internally computing the hessian first using the specified σs and σo

Functions to compute a locally data adaptive frame.

Compute locally adaptive frame (Gauge frame)
Click for copyable input
Click for copyable input

For a more in depth view, see Step by Step Gauge Frames SE(2).

For the an application of the Gauge frame see Diffusions.

Fast Marching (Windows only)

The function FastMarching can be used to compute shortest paths between two points.

FastMarching[costFunction,seeds, tips]computes the distance between the seeds and tips using a costfunction having a certain domain
Isotropic Fast Marching on a image
In[265]:=
Click for copyable input
In[269]:=
Click for copyable input
Out[270]=
Fast Marching in SE(2)
In[271]:=
Click for copyable input
In[275]:=
Click for copyable input
Out[276]=