Lie Analysis Common Functions

Functions that are used across several functions in the LieAnalysis package are stored in the LieAnalysis`Common context. These functions can be useful if you are using the package

Load the package and the common context (do not only load the Common context)
In[1]:=
Click for copyable input
In[2]:=
Click for copyable input

Package Properties and Options

The Lie Analysis Properties
Click for copyable input
The Lie Analysis package options
Click for copyable input

Derivatives

GaussianDerivative[data, sigmas, derivatives]wrapper function to simplify using GaussianFilter
GroupDifferences[data, direction]left invariant finite differences on 2d arrays
GroupDifferences3D[data, {orientations, topology}, direction]left invariant finite differences on 3d arrays

Function to compute derivatives.

A wrapper function to compute Gaussian derivatives
Click for copyable input
Group differences method on position orientation data
Click for copyable input
Group differences method on 3-dimensional position orientation data
Click for copyable input
Click for copyable input
Click for copyable input

Transformations

WaveletTransformreturns a ObjWaveletTransform or an array depending on your input
WaveletTransform3Dreturns a ObjWaveletTransform or an array depending on your input
CenteredFouriercompute the Fourier transform with the zero-frequency in the center
CenteredInverseFouriercomputes the inverse Fourier transform with the zero-frequency in the center

Transformation functions.

Wavelet Transform of 2-dimensional Image

Internally the function WaveletTransform is used in the OrientationScoreTransform.

Compute an orientation score using WaveletTransform
Click for copyable input
Apply a Sobel kernel
Click for copyable input
Use CUDA to compute the transform (Windows only)
Click for copyable input
Same goes for 3-dimensional datasets
Click for copyable input
Click for copyable input

Centered Fourier Transformed

Compute the Fourier spectrum and its inverse having the zero frequency in the center
Click for copyable input
Click for copyable input

Input Preprocessor's

ToImage[input]tries to create a grayscale image (Real32) from the input
ToImage3D[input]tries to create a 3D image (Real32) from the input
InputProcessor[input]tries to convert the input to a 2D packed-array
InputProcessor3D[input]tries to convert the input to a 3D packed-array

Functions to pre-process the input.

Convert to Image

Attempt to convert input to image
Click for copyable input
Click for copyable input
Click for copyable input
Click for copyable input
Attempt to convert input to a 3-dimensional image
Click for copyable input
Click for copyable input

Convert to Packed-array

Attempt to convert input to 2-dimensional array
Click for copyable input
Click for copyable input
Click for copyable input
Click for copyable input
Click for copyable input
Attempt to convert input to 3-dimensional array
Click for copyable input
Click for copyable input
Click for copyable input
Click for copyable input

Sampling of the Sphere

SphereSamplpes[samples]returns a ObjSphereSampling according to your samples specification
ResampleOrientationsresamples an Obj3DPositionOrientationData on the angular axis
ExpandSymmetryexpands the symmetry in the ObjSphereSampling and Obj3DPositionOrientationData which has been used to minimize storage

Functions used for sampling on the sphere.

Sample the Sphere

Use an electrostatic model to uniformly sample the sphere
Click for copyable input
Use number of β and γ samples to sample the sphere
Click for copyable input
Use Icosahedron to sample the sphere
Click for copyable input

Angular Resampling Position Orientation Data

Resample the orientation axis to a different scheme
Click for copyable input
Click for copyable input

Expand Symmetry of the Orientation Axis

To minimize storage of Obj3DPositionOrientationData and ObjSphereSampling (and computation time) the symmetry in the orientation axis is used. However sometimes this is just not what you want. In these cases you can remove all symmetry by using the common function ExpandSymmetry.

Expand the symmetry of the orientation axis
Click for copyable input
Click for copyable input
Click for copyable input
Click for copyable input

Spherical Harmonics

Internally spherical harmonics are used to do computation at the orientation axes in the SE(3) space. This is an involved process therefore a lot of wrapper functions are stored in the Common context to do some work for us.

RealSphericalHarmonicFit[pts, data, lMax]fits spherical harmonic coefficients on 3-dimensional position orientation data
RealSphericalHarmonicOrderList[lMax]returns a list corresponding to the expression orders up to a certain SH order lMax
RealSphericalHarmonicParameterList[lMax]returns a list containing L and M pairs for up to a certain SH order lMax
RealSphericalHarmonicValues[angles, lMax]get the spherical harmonic values up to order lMax for a set of angles
RealSphericalHarmonicY[l,m,θ,ϕ]real Spherical Harmonic Basis function for a specific parameter pair l and m
A4RealSphericalHarmonicYleft-invariant (A4) spherical harmonic derivative basis function
A5RealSphericalHarmonicYleft-invariant (A5) spherical harmonic derivative basis function
A4A4RealSphericalHarmonicYleft-invariant (A4A4) spherical harmonic derivative basis function
A5A5RealSphericalHarmonicYleft-invariant (A5A5) spherical harmonic derivative basis function
A5A4RealSphericalHarmonicYleft-invariant (A5A4) spherical harmonic derivative basis function
SphericalHarmonicsIndexToL[]indexfrom linear index to degree of legendre polynomial
SphericalHarmonicsIndexToMfrom linear index to order of legendre polynomial
SphericalHarmonicsLMaxcompute SH from the number of samples on the sphere
SphericalHarmonicsLMToIndexfrom degree and order (L and M) to linear indexing
SphericalHarmonicsTableexpression table for certain SH order, coefficients and basis functions (optimized for speed)
SphericalHarmonicsAngularBlurAngular Smoothing of position orientation data via SH

Fundamental function for working with Spherical Harmonics.

Spherical Harmonic Expressions

Generate a list of L and M pairs
Click for copyable input
Display a subset of the corresponding spherical harmonic basis functions
Click for copyable input
Get the SH basis functions values for a set of orientations
Click for copyable input
Click for copyable input
Click for copyable input

The function SphericalHarmonicsTable is an optimized function wrapper to go from Spherical Harmonics expressions back to (discrete) orientation data.

It returns a compiled function which can be evaluated for specific β and γ
Click for copyable input
Click for copyable input
It is even faster when you use it in a listable manner
Click for copyable input

The function is also available for the left-invariant derivative basis functions (4,5,44,54, and 55).

Left-invariant derivative basis functions
Click for copyable input
Click for copyable input

From Orientation Data to Spherical Harmonic Coefficients

Compute an orientation score, upon which we can do spherical harmonics stuff.
Click for copyable input

The first step would be to compute Spherical Harmonic (SH) coefficients from the position and orientation data. Before we can do this we need to know which order SH are used. In this section we make use of the Lie Analysis object Obj3DPositionOrientationData, if you are not familiar with it check it out first.

Determine which order SH we can use from the number of samples on the sphere
Click for copyable input
Fit Spherical Harmonic coefficients to the orientation axis from the position orientation data
Click for copyable input

Spherical Harmonic Expression Indexing

Spherical Harmonic expressions are indexed using L and M (for more details see https://en.wikipedia.org/wiki/Spherical_harmonics). Although you can also use linear indexing instead. The following functions are used to convert between these indexes.

Generate a list of L and M parameters for a certain order of SH
Click for copyable input
The linear index would be
Click for copyable input
from linear index to L, M pairs
Click for copyable input

Smoothing of Orientation Axis

Apply smoothing to spherical harmonic coefficients
Click for copyable input
Click for copyable input

Helper Functions

Tiny functions to make our lives easier.

BlockMatrixconstruct a block matrix from two matrices
BooleanToBinaryconverts a boolean to 1 in case of True and 0 in case of False
CartesianToSphericalCoordinatesconverts cartesian to spherical coordinates, not having the β =0 issue that is present in ToSphericalCoordinates
ComplexQreturns a boolean-value whenever a value is complex or not
Reorderwrapper for Transpose
RnWithAlphaIs0rotation in SE(3) in which α is set to 0

Helper functions.

Construct a block matrix from two matrices
Click for copyable input
BooleanToBinary converts a Mathematica Boolean to integer values, useful when calling library functions
Click for copyable input
Numerically convert from Cartesian (x,y,z) to spherical coordinates (r, θ, ϕ)
Click for copyable input
Test whenever a number is complex or not, used for input checking
Click for copyable input

External Functions and Files

DownloadFile[url, local, timeout]function to download any url from the internet to the local folder
LoadCppFunction[name]loads the name Lie Analysis C++ function (Windows only)
LoadCUDAFunction[name]Loads the name Lia Analysis CUDA function (Windows only)

Functions to load external files and functions.

Download a file from the internet
Click for copyable input
Click for copyable input
  • Processing on 2D Images
  • Processing on 3D Images
  • Working with Objects