# Saenopy

# Saenopy

## Goal

Measuring force generation of cells in natural environments is essential to understand e.g. tissue healing, tumor metastasis, and immune responses.

Saenopy allows to measure these forces in a naturalistic 3D collagen environment.

## Challenges

The original version of this 3D traction force solver was written in a legacy C code base, which was not maintained anymore and was hard to install and use. I decided that it was crucial to modernize the code base, to make it easy to install and a pleasure to use.

First challenge was to delve into the complex C codebase (which was not well commented) and understand the mathematics behind the method. Then, I needed to rewrite the code in Python and achieve a similar performance relying heavily on vectorisation with numpy and jit compilation with numba. Then, the method needed to be improved to handle the boundary conditions better and be able to work with very small image stacks for fast moving cells.

To make the software accessible to a broader user base, it required to have an easy-to-use interface and be simple to install for users without python experience. I created the interface using Qt and interactive 3D visualisations for all the intermediate steps of the method using VTK. To make the software easy to install, I used Pyinstaller to bundle it.

Working closely together with our lab experimentalists, I got quick feedback on the usability of the software and further requirements on the software and the method.

## Implementation

The force reconstruction is based on a
**Finite Element Solver** original developed by
Steinwachs et al.
The volume is approximated by a grid of tetrahedral elements. Each element is represented by a non-linear stiffness function
representing the fibers of the material, in contrast with most other solvers that only offer linear materials.

Heavy calculations are done using **Numpy** vectorization and
**Numba** jit-compilation. Unlike other 3D traction force methods available, Saenopy does not rely on proprietary third
party software like matlab or abacus, making it easier to access and use for labs.

## Interface & Visualization

A clear and easy to use interface using **Qt** guides the user
through the process and allows to use the software without
specialized knowledge of the algorithm.

I see **visual feedback** as a key element to make sure the
user understands what the software is doing and can spot errors.

Therefore, Saenopy is no black box. Every intermediate step is
visualized in an interactive way using **VTK**.

## Data

Cells are embedded in a 3D collagen matrix and imaged using a
**confocal microscope** with reflection mode. A contrast mode
that visualizes the fibers.

A stack of images is recorded before and after relaxing the cell with a drug.

## Deformations

Deformations are calculated using a
**3D particle image velocimetry (PIV)** algorithm.

This algorithm uses a 3D cross-correlation to find a match of the "relaxed" image stack in the "deformed" image stack.

## Forces

The calculation of the forces from the deformations is the core part of Saenopy.

The iterative algorithm tries to reconstruct the forces in the non-linear material. Tikhonov regularization ensure forces do not diverge.