PixCells
This project is a Cellular Potts Model (CPM) simulator. It was developped during a Master's degree in Physics as a master project.
Loading...
Searching...
No Matches
PixCells

Project

Description

This project is a simulation of cells on a lattice using the Cellular Potts Model (CPM). The CPM is a lattice-based model that allows the simulation of cells and their interactions. The cells are represented by a set of connected pixels on a lattice. The model is based on the Metropolis algorithm, where the energy of the system is minimized by moving the cells on the lattice. The energy of the system is given by a Hamiltonian that takes into account the interactions between the cells and the properties of the cells. The model can be used to study the behavior of cells in different environments and to investigate the mechanisms of cell migration, sorting, and aggregation.

Moreover, this project has the implicit goal to simulate vascularisation of tissues. The cells are moving on a lattice and are interacting with each other. They can elongate, contract, and move. The cells are also interacting with the extracellular matrix (ECM) and with a chemoattractant molecule. The cells are also connected to each other by a force that tries to keep them together.

For more details on the theory behind the model, you can check the Theory page.


The model is implemented in C++ and visualized using the SFML library. The cells are represented by colored pixels on a lattice, and different cell's id are visualized by a border. The simulation can be run with different parameters to study the behavior of cells in different environments.

Visuals

Here we can see an exemple to get a vascular network. Everything can be changed in the config.txt file.

Vascular network

Requirements

  • C++ language for simulation
  • Make for the compilation
  • SMFL library for the visualization
  • Eigen library for the linear algebra
  • Python for the plotting

Installation

You can download the code by cloning the repository:

git clone

Then go in the directory:

cd pixcells

You will need to create a data directory and some image and video directories:

mkdir data
mkdir img/lattice
mkdir img/video

You will need to install the dependencies (if not installed yet):

sudo apt-get install libsfml-dev
sudo apt-get install libeigen3-dev

If not already made, you should use a virtual environment for the python script:

python3 -m venv .venv
source .venv/bin/activate

Then you need to install all the libraries needed for the python script:

pip install -r requirements.txt

Then you can compile the code with the following command:

make

To create the Doxygen documentation, you can run the following command:

make doc

To create a tar.gz file with the code and the documentation, you can run the following command:

make tar

Usage

Configuration file

You should check the Configuration file page to see how to create a config.txt file.

Running the code

You can run the code with:

./run_config_and_plot.sh [name_of_the_batch]

or

make run

for the default config file config.txt and output file data.txt with a render activated.

You can also run the code yourslef with the following command:

./pixcells.exe -i [path_to_the_config_file] -o [path_to_the_output_file] [--render]

Getting the images and videos

And finally you can run the python script:

make cleanimg
python3 plot_lattice.py [path_to_the_output_file]

Then, you can create a video with the following command:

ffmpeg -framerate 30 -i img/lattice/lattice_%04d.png -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -c:v libx264 -r 30 -pix_fmt yuv420p img/lattice/movie.mp4

or a gif with ffmpeg:

ffmpeg -i img/lattice/lattice_%04d.png -vf "fps=10,scale=1600:-1:flags=lanczos" -c:v gif -q:v 1 img/lattice/gif.gif

The ./run_config_and_plot.sh script will do all of this for you.

Analysis of the results

jupyter notebook analysis/analysis.ipynb

Support

You can contact me at lucas.nosp@m.bois.nosp@m.tay@p.nosp@m.roto.nosp@m.n.me for any question or suggestion.

Contributing

I'm eager to any contribution, feel free to make a pull request. The system is not perfect and can be improved in many ways. Moreover, a lot of features can be added to the simulation.

License

This work © 2024 by Lucas BOISTAY is licensed under Creative Commons Attribution-NonCommercial 4.0 International.

Sources

Docs

  • Doxygen documentation.
  • Doxygen Awesome was used for the theme of the documentation.

Youtube videos :

Websites :

Papers :

  1. Merks, R. M. H., Brodsky, S. V., Goligorksy, M. S., Newman, S. A. & Glazier, J. A. Cell elongation is key to in silico replication of in vitro vasculogenesis and subsequent remodeling. Dev Biol 289, 44–54 (2006).
  2. Czirók, A., Varga, K., Méhes, E. & Szabó, A. Collective cell streams in epithelial monolayers depend on cell adhesion. New J. Phys. 15, 075006 (2013).
  3. Merks, R. M. H. & Glazier, J. A. Dynamic mechanisms of blood vessel growth. Nonlinearity 19, C1–C10 (2006).
  4. Köhn-Luque, A. et al. Early Embryonic Vascular Patterning by Matrix-Mediated Paracrine Signalling: A Mathematical Model Study. PLOS ONE 6, e24175 (2011).
  5. Mar e AF, null, Panfilov, A. V. & Hogeweg, P. Migration and thermotaxis of dictyostelium discoideum slugs, a model study. J Theor Biol 199, 297–309 (1999).
  6. Palachanis, D., Szabó, A. & Merks, R. M. H. Particle-based simulation of ellipse-shaped particle aggregation as a model for vascular network formation. Comp. Part. Mech. 2, 371–379 (2015).
  7. Zajac, M., Jones, G. L. & Glazier, J. A. Simulating convergent extension by way of anisotropic differential adhesion. Journal of Theoretical Biology 222, 247–259 (2003).
  8. Zajac, M., Jones, G. L. & Glazier, J. A. Simulating convergent extension by way of anisotropic differential adhesion. Journal of Theoretical Biology 222, 247–259 (2003).
  9. Palm, M. M. & Merks, R. M. H. Vascular networks due to dynamically arrested crystalline ordering of elongated cells. Phys Rev E Stat Nonlin Soft Matter Phys 87, 012725 (2013).