Skip to content

Commit

Permalink
Merge pull request IMSY-DKFZ#274 from IMSY-DKFZ/develop
Browse files Browse the repository at this point in the history
Merge fix for IMSY-DKFZ#273 from develop
  • Loading branch information
kdreher authored Apr 2, 2024
2 parents c2f30f1 + 22b4c8e commit b2c2461
Show file tree
Hide file tree
Showing 7 changed files with 1,087 additions and 680 deletions.
13 changes: 5 additions & 8 deletions .readthedocs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,13 @@ version: 2

# Set the version of Python and other tools you might need
build:
os: ubuntu-20.04
tools: {python: "3.9"}
os: ubuntu-22.04
tools: {python: "3.10"}
jobs:
pre_create_environment:
- asdf plugin add poetry
- asdf install poetry latest
- asdf global poetry latest
- poetry config virtualenvs.create true
post_create_environment:
- pip install poetry
post_install:
- poetry install
- VIRTUAL_ENV=$READTHEDOCS_VIRTUALENV_PATH poetry install --with docs

# Build documentation in the docs/ directory with Sphinx
sphinx:
Expand Down
16 changes: 7 additions & 9 deletions docs/source/introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ acoustic simulations possible.

### mcx (Optical Forward Model)

Download the latest nightly build of [mcx](http://mcx.space/) for your operating system:
Download the latest nightly build of [mcx](http://mcx.space/) on [this page](http://mcx.space/nightly/github/) for your operating system:

- [Linux](http://mcx.space/nightly/github/mcx-linux-x64-github-latest.zip)
- [MacOS](http://mcx.space/nightly/github/mcx-macos-x64-github-latest.zip)
- [Windows](http://mcx.space/nightly/github/mcx-windows-x64-github-latest.zip)
- 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.

Expand All @@ -55,12 +55,10 @@ for further (and much better) guidance under:
[http://www.k-wave.org/](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
2. Download the kWave toolbox (version >= 1.4)
3. Add the kWave toolbox base path to the toolbox paths in MATLAB
4. Download the kWaveArray addition from the link given in this user forum post [http://www.k-wave.org/forum/topic/alpha-version-of-kwavearray-off-grid-sources](http://www.k-wave.org/forum/topic/alpha-version-of-kwavearray-off-grid-sources)
5. Add the kWaveArray folder to the toolbox paths in MATLAB as well
6. If wanted: Download the CPP and CUDA binary files and place them in the k-Wave/binaries folder
7. Note down the system path to the `matlab` executable file.
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

Expand Down
6 changes: 6 additions & 0 deletions docs/source/simpa.utils.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,12 @@ utils
:show-inheritance:


.. automodule:: simpa.utils.matlab
:members:
:undoc-members:
:show-inheritance:


.. automodule:: simpa.utils.path_manager
:members:
:undoc-members:
Expand Down
8 changes: 4 additions & 4 deletions docs/source/simpa_examples.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ simpa\_examples
.. toctree::
:maxdepth: 2

linear_unmixing
create_a_custom_digital_device_twin
create_custom_tissues
linear_unmixing
minimal_optical_simulation
msot_invision_simulation
perform_image_reconstruction
perform_iterative_qPAI_reconstruction
create_custom_tissues
segmentation_loader
minimal_optical_simulation
perform_image_reconstruction
optical_and_acoustic_simulation
1,710 changes: 1,054 additions & 656 deletions poetry.lock

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "simpa"
version = "0.9.0"
version = "0.9.1"
description = "Simulation and Image Processing for Photonics and Acoustics"
authors = [
"Division of Intelligent Medical Systems (IMSY), DKFZ <k.dreher@dkfz-heidelberg.de>",
Expand Down Expand Up @@ -41,7 +41,7 @@ jdata = ">=0.5.2" # Uses Apache 2.0-License (MIT compatible)
pre-commit = ">=3.2.2" # Uses MIT-License (MIT compatible)

[tool.poetry.group.docs.dependencies]
sphinx-rtd-theme = "^1.0.0"
sphinx-rtd-theme = "^2.0.0"
Sphinx = "^5.1.1"
myst-parser = "0.18.0, <1.1"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from simpa.utils.constants import property_tags
from simpa.io_handling import save_hdf5
import numpy as np
import torch


class SegmentationBasedVolumeCreationAdapter(VolumeCreatorModuleBase):
Expand Down Expand Up @@ -42,8 +43,15 @@ def create_simulation_volume(self) -> dict:
for seg_class in segmentation_classes:
class_properties = class_mapping[seg_class].get_properties_for_wavelength(wavelength)
for prop_tag in property_tags:
volumes[prop_tag][segmentation_volume == seg_class] = class_properties[prop_tag]
assigned_prop = class_properties[prop_tag]
if assigned_prop is None:
assigned_prop = torch.nan
volumes[prop_tag][segmentation_volume == seg_class] = assigned_prop

save_hdf5(self.global_settings, self.global_settings[Tags.SIMPA_OUTPUT_PATH], "/settings/")

# convert volumes back to CPU
for key in volumes.keys():
volumes[key] = volumes[key].cpu().numpy().astype(np.float64, copy=False)

return volumes

0 comments on commit b2c2461

Please sign in to comment.