---Preamble

Path to the fast marching code binaries

SE2_RetinaTracking_1.gif

SE2_RetinaTracking_2.png

SE2_RetinaTracking_3.png

Load the LieAnalysis package

SE2_RetinaTracking_4.png

---Functions

HFM FileIO (The old approach using disk writing)

Data IO (hard-disk <> RAM)

SE2_RetinaTracking_5.png

HFM WLL (The new approach using a direct Wolfram Library Link)

The library link functions

SE2_RetinaTracking_6.png

Back tracking via LieAnalysis`

Back tracking via LieAnalysis`

SE2_RetinaTracking_7.png

---Retinal Vessel Tracking

0. Detect images/test data

SE2_RetinaTracking_8.gif

SE2_RetinaTracking_9.png

SE2_RetinaTracking_10.png

1. Import image

SE2_RetinaTracking_11.gif

SE2_RetinaTracking_12.gif

Load the stored seed points

The format of the seed point data is

SE2_RetinaTracking_13.png

with SE2_RetinaTracking_14.png is the SE2_RetinaTracking_15.png tip belonging to the SE2_RetinaTracking_16.png seed.

In the stored format the coordinates are specified as follows: seed = (k,i,j), with i and j respectively the row and column index of the image ( (1,1) is the upper left pixel in the image ), and k is the discrete index for orientation. The seed points were saved at an angular resolution of sθ=2π/64, and index k=1 corresponds to θ=0. The corresponding angles for each k are given by θ=(k-1)*sθ.

SE2_RetinaTracking_17.gif

SE2_RetinaTracking_18.png

Downsample data

We down sample the data by a factor sx for faster computations.
Then the discrete angle-indices are converted to continuous angles.

Note: usually we use the ordering (x,y,θ), so we would like to have (i,j,k) ordering when working with the discrete data, so we re order the coordinates as well.

SE2_RetinaTracking_19.gif

2. Compute Orientation Score

Here we compute the orientation score transform of input image im. The angular resolution is specified by sθ=2π/Nθ:

Note: In the orientation scores objects (ObjPositionOrientationData), the data array is stored as a 2D multichannel image (hence the Image[ data ] in the Affix statement. The data of the orientation score can be accessed via os[“Data”], this returns a 3D array (not an image object..).

SE2_RetinaTracking_20.gif

SE2_RetinaTracking_21.gif

3. Vessel enhancement via multi-scale LIDOS

Here we apply vessel enhancement by taking the second order derivatives in the perpendicular vessel direction SE2_RetinaTracking_22.png. We do this at multiple Gaussian scales, and sum the responses.

Note: the factor SE2_RetinaTracking_23.png is a scale normalization factor, which ensures equal responses for blobs/lines at different scales. Here we included an additional parameter γ which for γ=1 does not give any bias, but for γ=2 gives a slight bias for larger scales in the reconstruction (summation).
Note: second order derivative SE2_RetinaTracking_24.png of orientation score U is computed with the function LeftInvariantDerivative and derivative specification 22.

SE2_RetinaTracking_25.gif

SE2_RetinaTracking_26.png

SE2_RetinaTracking_27.gif

4. From vesselness not cost/speed function (to be used in the metric/dual metric)

The vesselness function above was only computed from 0 to π, here we construct the full vesselness function V(x,y,θ) stored from 0 to 2π.

The cost function  is then defined as

SE2_RetinaTracking_28.png

with λ a parameter that balances the influence of the cost relative to no data-adaptivity, p is a contrast parameter.

In the end, in the code we only need to specify a “speed function” (dual cost), which is given by speed = 1/cost.

SE2_RetinaTracking_29.png

SE2_RetinaTracking_30.gif

5. Vessel tracking (the experimental set up)

Select a seed point out of the Length[gList] number of seeds.

Here we specify tips normal arrival directions (g1dListForward), and tips with reversed arrival directions (g1dListBackward)).

SE2_RetinaTracking_31.gif

Show setup

Note: in order to plot Graphics as an overlay on an image in Mathematica you have to take the Graphics coordinate system into account. Mathematica uses the convention:
(x,y), with x the horizontal axis, running from left to right, and y along the vertical axis, running from top to bottom.
See the mapping {#[[2]]-0.5,Nx-#[[1]]+0.5}&/@ in the code below to go from array coordinates (i,j) to graphics coordinates.

SE2_RetinaTracking_32.gif

SE2_RetinaTracking_33.gif

6. Vessel tracking

Set-up the parameters

SE2_RetinaTracking_34.gif

Run the experiment

SE2_RetinaTracking_35.png

SE2_RetinaTracking_36.png

SE2_RetinaTracking_37.png

SE2_RetinaTracking_38.png

Show results

SE2_RetinaTracking_39.png

SE2_RetinaTracking_40.gif

---Exercises

1. Experiment with parameters (ξ: flexibility of the curve, λ: influence of the cost, p: contrast of the cost)

2. Experiment with different geodesic models (“ReedsSheppForward2”, “ReedsShepp2”, “ReedsShepp2”-projective)

3. Run the experiment with different end conditions (try to find curves with cusps)

Prepare the data for back tracking via the LieAnalysis` package

Put the data in LieAnalysis` data-objects:

SE2_RetinaTracking_41.png

Pre compute the derivatives which are used in the gradient desent

The actual backtracking (reproducing results of the fast marching algorithm)

Interactive backtracking

---End of notebook

Convert output to bitmap to reduce notebook size

Created with the Wolfram Language