# Processing on 2D Images

CakeWaveletStack | orientation sensitive wavelets, can be used for OrientationScoreTransform |

GaborWaveletStack | orientation sensitve wavelets, can be used for OrientationScoreTransform |

OrientationScoreTransform | computes an orientation score from an image |

InverseOrientationScoreTransform | applies reconstruction to the orientation score |

LeftInvariantDerivatives | left-invariant derivatives from position and orientation data |

OrientationScoreGaugeFrames | data-adaptive frame |

OrientationScoreTensor | bundles of left invariant derivatives |

FastMarching | shortest path tracking |

GlyphPlot | glyph visualization of the position orientation data |

OrientationScorePlot | Image3D wrapper function for position orientation data |

ColorOrientationProjection | constructs maximum orientation projection |

Functions which can be used in image processing.

In[1]:= |

## Orientation Scores

An orientation score U_{f} 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 N_{o} equally wide samples on the angular axis. To construct a cake wavelet use the function CakeWaveletStack.

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" | False | double or single headed wavelets |

"Design" | N | which design constraints are used |

"SplineOrder" | 3 | spline order that is used in angular direction |

"MnOrder" | 8 | Order of the high frequency window |

"InflectionPoint" | 0.8 | indicate the fractional position of high frequenct window |

"DcStandardDeviation" | 3 | low frequency filter σ |

"OverlapFactor" | 1 | subsample 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.

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" | Automatic | dimensions of the wavelet |

"Epsilon" | 4 | controls anisotropy of the wavelets |

"K0" | {0,3} | controls spatial frequency of the complex exponential |

"Directional" | False | double 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.

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.

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.*

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

#### 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.

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" | False | double or single headed wavelets |

"Orientations" | 12 | the number of orientations |

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

option name | default value | |

"Design" | N | which design constraints are used |

"SplineOrder" | 3 | spline order that is used in angular direction |

"MnOrder" | 8 | Order of the high frequency window |

"InflectionPoint" | 0.8 | indicate the fractional position of high frequenct window |

"DcStandardDeviation" | 3 | low frequency filter σ |

"OverlapFactor" | 1 | subsample factor of the angular component |

Parameters that can be specified for Cake Wavelets.

option name | default value | |

"Epsilon" | 4 | controls 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.

#### 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.

### 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.

Now reconstruct the image using the default settings.

#### 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.

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 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".*

### Visualization

There are several ways included to visualize an orientation score.

## 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.

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 (A_{i}). For example if we would like to compute the A_{2} derivative (perpendicular to the structures in the orientation scores)

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

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.

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.

## 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.

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.

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 |

In[265]:= |

In[271]:= |