Skip to content

Classification of points in images of retinal cells using persistence diagrams.

License

Notifications You must be signed in to change notification settings

eloialonso/persistence-diagrams-retinal-cells

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Persistence diagrams for corner detection in images of retinal cells

Getting startedPrinciplePersistence Diagram

Persistence diagram

Getting started

Dependencies are in requirements.txt.

Basic use

python src/main.py

This will display a default image of cells. Select a point to run the analysis on. The output images are stored in out/.

GIF of animated persistence diagram

python src/main.py --gif

The GIF is stored at out/persistence_diagram.gif.

See python src/main.py -h for available options (change the image, hyperparameters values, etc).

Principle

Image of cells, chosen point and ring

Goal: classify the selected pixel (red) as belonging to a corner, an edge or simply background.

We use persistence diagrams to count the number of peaks of significant intensity in the blue ring around the selected pixel.

We then apply the following classification rule:

  • if the intensity in the ring has two main peaks, then our point belongs to an edge
  • if the intensity in the ring has three or more major peaks, our point belongs to a corner
  • else, our point belongs to background.

Persistence Diagram

Intensity in the ring and corresponding persistence diagram

Left: The intensity of the pixels in the ring as a function of their angle in the ring. Right: The corresponding persistence diagram.

Let $f:[0, 360] \rightarrow [0, 255]$ be the function mapping angle to intensity (left plot). For a given intensity y in [0, 255], we consider the connected components (CCs) of the preimage set { $x \in [0, 360]: f(x) \in [y, +\infty)$ }.

We then vary the intensity $y$ from 255 down to 0. At each step, we compute the CCs of the preimage and keep track of the intensity at which each CC appears ( $y_{birth}$ ) and disappears ( $y_{death}$ ). The persistence diagram is the graphical representation of these events: each CC is a plotted as a point with coordinates $[y_{birth}, y_{death}]$.

In the example above, the persistence diagram shows that 4 CCs have a significant lifetime. We then apply the classification rule and deduce that the point of interest is located on a corner (4 major intensity peaks).


Intuition of persistence diagrams

In the ring, consider the mapping angle --> intensity as a mountain relief, where the angle is the horizontal position and the intensity is the altitude.

Fill this landscape with water until the highest mountain is covered up. Then, slowly empty the water and keep track of two events:

  • The birth of a mountain: the water level when it first emerges.
  • The death of a mountain: the water level when it merges with another moutain (when the level becomes too low to separate the two islands).

We plot these two events in the persistence diagram, where each mountain is graphically representation as a point [birth, death].

Intuitively, during the water descent, noisy peaks will emerge and quickly be merged with a higher peak: they have a small persistence. On the contrary, major peaks are characterized by a longer persistence.

Therefore, noisy peaks end up close to the diagonal, while major peaks lay further away from it.

About

Classification of points in images of retinal cells using persistence diagrams.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages