simpa

The Simulation and Image Processing for Photonics and Acoustics (SIMPA) toolkit.

https://github.com/imsy-dkfz/simpa

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 4 DOI reference(s) in README
  • Academic publication links
  • Committers with academic emails
    1 of 21 committers (4.8%) from academic institutions
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (20.6%) to scientific vocabulary

Keywords

acoustics image-processing photoacoustic-imaging photonics research-software simulation

Keywords from Contributors

mesh interpretability sequences generic projection interactive optim hacking network-simulation
Last synced: 6 months ago · JSON representation ·

Repository

The Simulation and Image Processing for Photonics and Acoustics (SIMPA) toolkit.

Basic Info
Statistics
  • Stars: 101
  • Watchers: 9
  • Forks: 20
  • Open Issues: 133
  • Releases: 1
Topics
acoustics image-processing photoacoustic-imaging photonics research-software simulation
Created about 5 years ago · Last pushed 9 months ago
Metadata Files
Readme Contributing License Citation

README.md

![Logo](https://github.com/IMSY-DKFZ/simpa/raw/main/docs/source/images/simpa_logo.png?raw=true "SIMPA Logo") [![Documentation Status](https://readthedocs.org/projects/simpa/badge/?version=develop)](https://simpa.readthedocs.io/en/develop/?badge=develop) ![Build Status](https://github.com/IMSY-DKFZ/simpa/actions/workflows/automatic_testing.yml/badge.svg) [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://github.com/IMSY-DKFZ/simpa/blob/main/LICENSE.md) [![Pypi Badge](https://img.shields.io/pypi/v/simpa)](https://pypi.org/project/simpa/) [![PyPI downloads](https://img.shields.io/pypi/dw/simpa?color=gr&label=pypi%20downloads)](https://pypi.org/project/simpa/)

The toolkit for Simulation and Image Processing for Photonics and Acoustics (SIMPA)

SIMPA aims to facilitate realistic image simulation for optical and acoustic imaging modalities by providing adapters to crucial modelling steps, such as volume generation; optical modelling; acoustic modelling; and image reconstruction. SIMPA provides a communication layer between various modules that implement optical and acoustic forward and inverse models. Non-experts can use the toolkit to create sensible simulations from default parameters in an end-to-end fashion. Domain experts are provided with the functionality to set up a highly customisable pipeline according to their specific use cases and tool requirements. The paper that introduces SIMPA including visualisations and explanations can be found here: https://doi.org/10.1117/1.JBO.27.8.083010

The toolkit is still under development and is thus not fully tested and may contain bugs. Please report any issues that you find in our Issue Tracker: https://github.com/IMSY-DKFZ/simpa/issues. Also make sure to double check all value ranges of the optical and acoustic tissue properties and to assess all simulation results for plausibility.

Getting started

In order to use SIMPA in your project, SIMPA has to be installed as well as the external tools that make the actual simulations possible. Finally, to connect everything, SIMPA has to find all the binaries of the simulation modules you would like to use. The SIMPA path management takes care of that.

SIMPA installation instructions

The recommended way to install SIMPA is a manual installation from the GitHub repository, please follow steps 1 - 3:

  1. git clone https://github.com/IMSY-DKFZ/simpa.git
  2. cd simpa
  3. git checkout main
  4. git pull

Now open a python instance in the 'simpa' folder that you have just downloaded. Make sure that you have your preferred virtual environment activated (we also recommend python 3.10) 1. pip install . or pip install -e . for an editable mode. 2. Test if the installation worked by using python followed by import simpa then exit()

If no error messages arise, you are now setup to use SIMPA in your project.

You can also install SIMPA with pip. Simply run:

pip install simpa

You also need to manually install the pytorch library to use all features of SIMPA. To this end, use the pytorch website tool to figure out which version to install: https://pytorch.org/get-started/locally/

External tools installation instructions

In order to get the full SIMPA functionality, you should install all third party toolkits that make the optical and acoustic simulations possible.

mcx (Optical Forward Model)

Download the latest nightly build of mcx on this page for your operating system:

  • Linux: mcx-linux-x64-github-latest.zip
  • MacOS: mcx-macos-x64-github-latest.zip
  • Windows: mcx-windows-x64-github-latest.zip

Then extract the files and set MCX_BINARY_PATH=/.../mcx/bin/mcx in your path_config.env.

k-Wave (Acoustic Forward Model)

Please follow the following steps and use the k-Wave install instructions for further (and much better) guidance under:

http://www.k-wave.org/

  1. Install MATLAB with the core, image processing and parallel computing toolboxes activated at the minimum.
  2. Download the kWave toolbox (version >= 1.4)
  3. Add the kWave toolbox base path to the toolbox paths in MATLAB
  4. If wanted: Download the CPP and CUDA binary files and place them in the k-Wave/binaries folder
  5. Note down the system path to the matlab executable file.

Path management

As a pipelining tool that serves as a communication layer between different numerical forward models and processing tools, SIMPA needs to be configured with the paths to these tools on your local hard drive. You have a couple of options to define the required path variables.

Option 1:

Ensure that the environment variables defined in simpa_examples/path_config.env.example are accessible to your script during runtime. This can be done through any method you prefer, as long as the environment variables are accessible through os.environ.

Option 2:

Import the PathManager class to your project using from simpa.utils import PathManager. If a path to a .env file is not provided, the PathManager looks for a path_config.env file (just like the one we provided in the simpa_examples/path_config.env.example) in the following places, in this order: 1. The optional path you give the PathManager 2. Your $HOME$ directory 3. The current working directory 4. The SIMPA home directory path

For this option, please follow the instructions in the simpa_examples/path_config.env.example file.

Run manual tests

To check the success of your installation ot to assess how your contributions affect the Simpa simulation outcomes, you can run the manual tests automatically. Install the testing requirements by doing pip install .[testing] and run the simpa_tests/manual_tests/generate_overview.py file. This script runs all manual tests and generates both a markdown and an HTML file that compare your results with the reference results.

Simulation examples

To get started with actual simulations, SIMPA provides an example package of simple simulation scripts to build your custom simulations upon. The minimal optical simulation is a nice start if you have MCX installed.

Generally, the following pseudo code demonstrates the construction and run of a simulation pipeline:

```python import simpa as sp

Create general settings

settings = sp.Settings(general_settings)

Create specific settings for each pipeline element

in the simulation pipeline

settings.setvolumecreationsettings(volumecreationsettings) settings.setopticalsettings(opticalsettings) settings.setacousticsettings(acousticsettings) settings.setreconstructionsettings(reconstructionsettings)

Set the simulation pipeline

simulation_pipeline = [sp.VolumeCreationModule(settings), sp.OpticalModule(settings), sp.AcousticModule(settings), sp.ReconstructionModule(settings)]

Choose a PA device with device position in the volume

device = sp.CustomDevice()

Simulate the pipeline

sp.simulate(simulation_pipeline, settings, device) ```

Reproducibility

For reproducibility, we provide the exact version number including the commit hash in the simpa output file. This can be accessed via simpa.__version__ or by checking the tag Tags.SIMPA_VERSION in the output file. This way, you can always trace back the exact version of the code that was used to generate the simulation results.

Documentation

The updated version of the SIMPA documentation can be found at https://simpa.readthedocs.io/en/develop.

Building the documentation

It is also easily possible to build the SIMPA documentation from scratch. When the installation succeeded, and you want to make sure that you have the latest documentation you should do the following steps in a command line:

  1. Make sure that you've installed the optional dependencies needed for the documentation by running pip install .[docs]
  2. Navigate to the simpa/docs directory
  3. If you would like the documentation to have the https://readthedocs.org/ style, type pip install sphinx-rtd-theme
  4. Type make html
  5. Open the index.html file in the simpa/docs/build/html directory with your favourite browser.

How to contribute

Please find a more detailed description of how to contribute as well as code style references in our contribution guidelines.

To contribute to SIMPA, please fork the SIMPA github repository and create a pull request with a branch containing your suggested changes. The core developers will then review the suggested changes and integrate these into the code base.

Please make sure that you have included unit tests for your code and that all previous tests still run through. Please also run the pre-commit hooks and make sure they are passing. Details are found in our contribution guidelines.

There is a regular SIMPA status meeting every Friday on even calendar weeks at 10:00 CET/CEST, and you are very welcome to participate and raise any issues or suggest new features. If you want to join this meeting, write one of the core developers.

Please see the github guidelines for creating pull requests: https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/about-pull-requests

Performance profiling

When changing the SIMPA core, e.g., by refactoring/optimizing, or if you are curious about how fast your machine runs SIMPA, you can run the SIMPA benchmarking scripts. Make sure to install the necessary dependencies via pip install .[profile] and then run:

bash bash ./run_benchmark.sh

once for checking if it works and then parse [--number 100] to run it at eg 100 times for actual benchmarking. Please see benchmarking.md for a complete explanation.

Understanding SIMPA

Tags are identifiers in SIMPA used to categorize settings and components within simulations, making configurations modular, readable, and manageable. Tags offer organizational, flexible, and reusable benefits by acting as keys in configuration dictionaries.

Settings in SIMPA control simulation behavior. They include:

  • Global Settings: Apply to the entire simulation, affecting overall properties and parameters.
  • Component Settings: Specific to individual components, allowing for detailed customization and optimization of each part of the simulation.

Settings are defined in a hierarchical structure, where global settings are established first, followed by component-specific settings. This approach ensures comprehensive and precise control over the simulation process. For detailed information, users can refer to the understanding SIMPA documentation.

Troubleshooting

In this section, known problems are listed with their solutions (if available):

1. Error reading hdf5-files when using k-Wave binaries:

If you encounter an error similar to:

Error using h5readc
The filename specified was either not found on the MATLAB path or it contains unsupported characters.

Look up the solution in this thread of the k-Wave forum.

2. KeyError: 'timeseriesdata'

This is the error which will occur for ANY k-Wave problem. For the actual root of the problem, please either look above in the terminal for the source of the bug or run the scripts in Matlab to find it manually.

Citation

If you use the SIMPA tool, we would appreciate if you cite our Journal publication in the Journal of Biomedical Optics:

Gröhl, Janek, Kris K. Dreher, Melanie Schellenberg, Tom Rix, Niklas Holzwarth, Patricia Vieten, Leonardo Ayala, Sarah E. Bohndiek, Alexander Seitel, and Lena Maier-Hein. "SIMPA: an open-source toolkit for simulation and image processing for photonics and acoustics." Journal of Biomedical Optics 27, no. 8 (2022).

Bibtex @article{2022simpatoolkit, title={SIMPA: an open-source toolkit for simulation and image processing for photonics and acoustics}, author={Gr{\"o}hl, Janek and Dreher, Kris K and Schellenberg, Melanie and Rix, Tom and Holzwarth, Niklas and Vieten, Patricia and Ayala, Leonardo and Bohndiek, Sarah E and Seitel, Alexander and Maier-Hein, Lena}, journal={Journal of Biomedical Optics}, volume={27}, number={8}, year={2022}, publisher={SPIE} }

Funding

This project has received funding from the European Research Council (ERC) under the European Union’s Horizon 2020 research and innovation programme (grant agreement No. [101002198]).

ERC

Owner

  • Name: IMSY
  • Login: IMSY-DKFZ
  • Kind: organization
  • Location: Heidelberg, Germany

Division of Intelligent Medical Systems

Citation (CITATION.cff)

cff-version: 1.2.0
message: "If you use the SIMPA tool, we would appreciate if you cite our Journal publication in the Journal of Biomedical Optics."
authors:
- family-names: "Gröhl"
  given-names: "Janek"
- family-names: "Dreher"
  given-names: "Kris K."
- family-names: "Schellenberg"
  given-names: "Melanie"
- family-names: "Rix"
  given-names: "Tom"
- family-names: "Holzwarth"
  given-names: "Niklas"
- family-names: "Vieten"
  given-names: "Patricia"
- family-names: "Ayala"
  given-names: "Leonardo"
- family-names: "Bohndiek"
  given-names: "Sarah E."
- family-names: "Seitel"
  given-names: "Alexander"
- family-names: "Maier-Hein"
  given-names: "Lena"
title: "The toolkit for Simulation and Image Processing for Photonics and Acoustics (SIMPA)"
url: "https://github.com/IMSY-DKFZ/simpa"
preferred-citation:
  type: article
  authors:
  - family-names: "Gröhl"
    given-names: "Janek"
  - family-names: "Dreher"
    given-names: "Kris K."
  - family-names: "Schellenberg"
    given-names: "Melanie"
  - family-names: "Rix"
    given-names: "Tom"
  - family-names: "Holzwarth"
    given-names: "Niklas"
  - family-names: "Vieten"
    given-names: "Patricia"
  - family-names: "Ayala"
    given-names: "Leonardo"
  - family-names: "Bohndiek"
    given-names: "Sarah E."
  - family-names: "Seitel"
    given-names: "Alexander"
  - family-names: "Maier-Hein"
    given-names: "Lena"
  doi: "10.1117/1.JBO.27.8.083010"
  journal: "Journal of Biomedical Optics"
  month: 4
  title: "SIMPA: an open-source toolkit for simulation and image processing for photonics and acoustics"
  issue: 8
  volume: 27
  year: 2022

GitHub Events

Total
  • Issues event: 23
  • Watch event: 29
  • Issue comment event: 25
  • Push event: 15
  • Pull request review event: 2
  • Pull request event: 11
  • Fork event: 6
  • Create event: 7
Last Year
  • Issues event: 23
  • Watch event: 29
  • Issue comment event: 25
  • Push event: 15
  • Pull request review event: 2
  • Pull request event: 11
  • Fork event: 6
  • Create event: 7

Committers

Last synced: 9 months ago

All Time
  • Total Commits: 1,365
  • Total Committers: 21
  • Avg Commits per committer: 65.0
  • Development Distribution Score (DDS): 0.645
Past Year
  • Commits: 215
  • Committers: 11
  • Avg Commits per committer: 19.545
  • Development Distribution Score (DDS): 0.563
Top Committers
Name Email Commits
Kris Dreher k****r@d****e 484
Janek Grohl j****l@c****k 255
Tom Rix t****x@d****e 162
Janek Gröhl j****l@d****e 118
Friso Grace f****e@d****e 94
Patricia Vieten p****n@d****e 54
Jan-Hinrich Nölke j****e@d****e 46
cbender98 c****8@w****e 29
Liam Keegan l****m@k****h 26
Leonardo Menjivar l****r@d****e 22
schellem m****g@d****e 20
Niklas Holzwarth n****h@d****e 13
Viet Tran Ba v****a@d****e 10
schellem m****g@d****e 9
faberno f****9@g****m 7
menjivar m****r@e****e 7
Leonie Boland l****d@d****e 3
Kamkarl 9****l 2
Alexander Seitel a****l@d****e 2
chiarasfour 1****r 1
dependabot[bot] 4****] 1
Committer Domains (Top 20 + Academic)

Dependencies

.github/workflows/automatic_testing.yml actions
  • actions/checkout v2 composite
  • actions/setup-python v2 composite
poetry.lock pypi
  • sphinx-rtd-theme 1.1.1 develop
  • alabaster 0.7.13
  • attrs 22.2.0
  • babel 2.11.0
  • certifi 2022.12.7
  • charset-normalizer 3.0.1
  • colorama 0.4.6
  • contourpy 1.0.6
  • coverage 7.0.5
  • cycler 0.11.0
  • deprecated 1.2.13
  • docutils 0.17.1
  • exceptiongroup 1.1.0
  • fonttools 4.38.0
  • h5py 3.7.0
  • idna 3.4
  • imageio 2.24.0
  • imagesize 1.4.1
  • importlib-metadata 6.0.0
  • iniconfig 2.0.0
  • jdata 0.5.2
  • jinja2 3.1.2
  • kiwisolver 1.4.4
  • markdown-it-py 2.1.0
  • markupsafe 2.1.1
  • matplotlib 3.6.3
  • mdit-py-plugins 0.3.3
  • mdurl 0.1.2
  • myst-parser 0.18.1
  • networkx 3.0
  • nptyping 2.4.1
  • numpy 1.24.1
  • nvidia-cublas-cu11 11.10.3.66
  • nvidia-cuda-nvrtc-cu11 11.7.99
  • nvidia-cuda-runtime-cu11 11.7.99
  • nvidia-cudnn-cu11 8.5.0.96
  • pacfish 0.4.4
  • packaging 23.0
  • pandas 1.5.2
  • pillow 9.4.0
  • pluggy 1.0.0
  • pygments 2.14.0
  • pynrrd 1.0.0
  • pyparsing 3.0.9
  • pytest 7.2.0
  • pytest-cov 4.0.0
  • python-dateutil 2.8.2
  • python-dotenv 0.21.0
  • pytz 2022.7
  • pywavelets 1.4.1
  • pyyaml 6.0
  • requests 2.28.2
  • scikit-image 0.19.3
  • scipy 1.10.0
  • setuptools 65.7.0
  • six 1.16.0
  • snowballstemmer 2.2.0
  • sphinx 5.3.0
  • sphinxcontrib-applehelp 1.0.3
  • sphinxcontrib-devhelp 1.0.2
  • sphinxcontrib-htmlhelp 2.0.0
  • sphinxcontrib-jsmath 1.0.1
  • sphinxcontrib-qthelp 1.0.3
  • sphinxcontrib-serializinghtml 1.1.5
  • tifffile 2022.10.10
  • tomli 2.0.1
  • torch 1.13.1
  • typing-extensions 4.4.0
  • urllib3 1.26.14
  • wget 3.2
  • wheel 0.38.4
  • wrapt 1.14.1
  • xmltodict 0.13.0
  • zipp 3.11.0
pyproject.toml pypi
  • Deprecated >=1.2.13
  • coverage >=6.1.2
  • h5py >=3.6.0
  • jdata >=0.5.2
  • matplotlib >=3.5.0
  • numpy >=1.21.4
  • pacfish >=0.4.4
  • pandas >=1.3.4
  • pynrrd >=0.4.2
  • python >=3.8,<3.11
  • python-dotenv >=0.19.2
  • requests >=2.26.0
  • scikit-image >=0.18.3
  • scipy >=1.7.2
  • torch >=1.10.0
  • wget >=3.2
  • xmltodict >=0.12.0
.github/workflows/pypi.yml actions
  • JRubics/poetry-publish v1.17 composite
  • actions/checkout v3 composite