simind-python-connector 1.1.1__tar.gz → 1.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- simind_python_connector-1.2.0/.dockerignore +17 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/MANIFEST.in +10 -3
- {simind_python_connector-1.1.1/simind_python_connector.egg-info → simind_python_connector-1.2.0}/PKG-INFO +30 -12
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/README.md +27 -8
- simind_python_connector-1.2.0/docker/README.md +95 -0
- simind_python_connector-1.2.0/docker/compose.yaml +76 -0
- simind_python_connector-1.2.0/docker/constraints.txt +8 -0
- simind_python_connector-1.2.0/docker/import_guard/sitecustomize.py +52 -0
- simind_python_connector-1.2.0/docker/python/Dockerfile +39 -0
- simind_python_connector-1.2.0/docker/python/install_mpich_compat.sh +22 -0
- simind_python_connector-1.2.0/docker/pytomography/Dockerfile +33 -0
- simind_python_connector-1.2.0/docker/sirf/Dockerfile +32 -0
- simind_python_connector-1.2.0/docker/stir/Dockerfile +34 -0
- simind_python_connector-1.2.0/docs/_static/.gitkeep +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/backends.rst +2 -1
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/changelog.rst +216 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/conf.py +5 -8
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/contributing.rst +21 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0/docs}/examples/01_basic_simulation.py +4 -2
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0/docs}/examples/02_runtime_switch_comparison.py +5 -3
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0/docs}/examples/03_multi_window.py +3 -1
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0/docs}/examples/05_scattwin_vs_penetrate_comparison.py +8 -3
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0/docs}/examples/07A_stir_adaptor_osem.py +10 -17
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0/docs}/examples/07B_sirf_adaptor_osem.py +6 -13
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/examples/07C_pytomography_adaptor_osem.py +10 -15
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/geometry.rst +42 -6
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/installation.rst +18 -1
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/testing.rst +39 -70
- simind_python_connector-1.2.0/docs/usage.rst +262 -0
- {simind_python_connector-1.1.1/docs → simind_python_connector-1.2.0}/examples/01_basic_simulation.py +4 -2
- {simind_python_connector-1.1.1/docs → simind_python_connector-1.2.0}/examples/02_runtime_switch_comparison.py +5 -3
- {simind_python_connector-1.1.1/docs → simind_python_connector-1.2.0}/examples/03_multi_window.py +3 -1
- {simind_python_connector-1.1.1/docs → simind_python_connector-1.2.0}/examples/05_scattwin_vs_penetrate_comparison.py +8 -3
- {simind_python_connector-1.1.1/docs → simind_python_connector-1.2.0}/examples/07A_stir_adaptor_osem.py +10 -17
- {simind_python_connector-1.1.1/docs → simind_python_connector-1.2.0}/examples/07B_sirf_adaptor_osem.py +6 -13
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/examples/07C_pytomography_adaptor_osem.py +10 -15
- simind_python_connector-1.2.0/examples/run_all_examples.sh +246 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/pyproject.toml +28 -6
- simind_python_connector-1.2.0/scripts/fix.sh +14 -0
- simind_python_connector-1.2.0/scripts/release.sh +127 -0
- simind_python_connector-1.2.0/scripts/run_all_examples.py +270 -0
- simind_python_connector-1.2.0/scripts/run_container_examples.sh +289 -0
- simind_python_connector-1.2.0/scripts/run_container_validation.sh +323 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/__init__.py +2 -11
- simind_python_connector-1.2.0/simind_python_connector/_version.py +3 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/backends/__init__.py +34 -31
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/backends/base.py +7 -52
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/backends/sirf_backend.py +19 -23
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/backends/stir_backend.py +74 -46
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/builders/__init__.py +2 -2
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/builders/acquisition_builder.py +8 -25
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/builders/image_builder.py +4 -4
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/configs/__init__.py +1 -2
- simind_python_connector-1.2.0/simind_python_connector/connectors/_spacing.py +187 -0
- simind_python_connector-1.2.0/simind_python_connector/connectors/base.py +73 -0
- simind_python_connector-1.2.0/simind_python_connector/connectors/python_connector.py +825 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/connectors/pytomography_adaptor.py +62 -29
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/connectors/sirf_adaptor.py +47 -16
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/connectors/stir_adaptor.py +50 -16
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/converters/attenuation.py +1 -10
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/converters/simind_to_stir.py +92 -60
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/core/config.py +420 -108
- simind_python_connector-1.2.0/simind_python_connector/core/executor.py +373 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/core/types.py +21 -8
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/data/__init__.py +5 -3
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/utils/__init__.py +10 -20
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/utils/backend_access.py +4 -4
- simind_python_connector-1.2.0/simind_python_connector/utils/geometry_phantom.py +42 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/utils/import_helpers.py +37 -10
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/utils/interfile_numpy.py +26 -5
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/utils/interfile_parser.py +9 -10
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/utils/simind_utils.py +31 -8
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/utils/sirf_stir_utils.py +11 -11
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/utils/stir_utils.py +12 -18
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0/simind_python_connector.egg-info}/PKG-INFO +30 -12
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector.egg-info/SOURCES.txt +29 -11
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector.egg-info/requires.txt +1 -1
- simind_python_connector-1.2.0/tests/conftest.py +47 -0
- simind_python_connector-1.2.0/tests/fixtures/minimal_variable_sections.smc +36 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_acquisition_builder_unit.py +0 -11
- simind_python_connector-1.2.0/tests/test_adaptor_release_simind.py +159 -0
- simind_python_connector-1.2.0/tests/test_anisotropic_voxels_simind.py +54 -0
- simind_python_connector-1.2.0/tests/test_arithmetic_operations.py +84 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_attenuation_utils.py +5 -2
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_backends.py +58 -177
- simind_python_connector-1.2.0/tests/test_connector_backend_separation.py +211 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_container_library_isolation.py +8 -1
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_container_scripts.py +6 -98
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_dicom_builder.py +18 -4
- simind_python_connector-1.2.0/tests/test_energy_window_filename_simind.py +33 -0
- simind_python_connector-1.2.0/tests/test_executor.py +561 -0
- simind_python_connector-1.2.0/tests/test_integration.py +33 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_interfile_numpy.py +35 -2
- simind_python_connector-1.2.0/tests/test_native_adaptors.py +839 -0
- simind_python_connector-1.2.0/tests/test_native_geometry_real.py +56 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_non_square_slices_simind.py +2 -1
- simind_python_connector-1.2.0/tests/test_packaging_resources.py +118 -0
- simind_python_connector-1.2.0/tests/test_patch_release_simind.py +535 -0
- simind_python_connector-1.2.0/tests/test_python_connector.py +1478 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_pytomography_adaptor.py +111 -24
- simind_python_connector-1.2.0/tests/test_release_versioning.py +71 -0
- simind_python_connector-1.2.0/tests/test_schneider_density.py +104 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_simind_to_stir_converter.py +265 -52
- simind_python_connector-1.2.0/tests/test_simulation_config.py +526 -0
- simind_python_connector-1.2.0/tests/test_single_window_simind.py +49 -0
- simind_python_connector-1.2.0/tests/test_stir_backend_arithmetic.py +181 -0
- simind_python_connector-1.2.0/tests/test_utils.py +99 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_utils_small.py +35 -3
- simind_python_connector-1.1.1/docs/usage.rst +0 -152
- simind_python_connector-1.1.1/requirements-dev.txt +0 -23
- simind_python_connector-1.1.1/requirements.txt +0 -10
- simind_python_connector-1.1.1/simind_python_connector/connectors/_spacing.py +0 -83
- simind_python_connector-1.1.1/simind_python_connector/connectors/base.py +0 -40
- simind_python_connector-1.1.1/simind_python_connector/connectors/python_connector.py +0 -480
- simind_python_connector-1.1.1/simind_python_connector/core/executor.py +0 -136
- simind_python_connector-1.1.1/tests/conftest.py +0 -128
- simind_python_connector-1.1.1/tests/test_arithmetic_operations.py +0 -106
- simind_python_connector-1.1.1/tests/test_connector_backend_separation.py +0 -118
- simind_python_connector-1.1.1/tests/test_connectors_base.py +0 -27
- simind_python_connector-1.1.1/tests/test_example_config_profile.py +0 -66
- simind_python_connector-1.1.1/tests/test_examples_backend_separation.py +0 -74
- simind_python_connector-1.1.1/tests/test_executor.py +0 -246
- simind_python_connector-1.1.1/tests/test_geometry_isolation_forward_projection.py +0 -352
- simind_python_connector-1.1.1/tests/test_integration.py +0 -38
- simind_python_connector-1.1.1/tests/test_legacy_surface_policy.py +0 -20
- simind_python_connector-1.1.1/tests/test_marker_policy.py +0 -117
- simind_python_connector-1.1.1/tests/test_native_adaptors.py +0 -517
- simind_python_connector-1.1.1/tests/test_osem_geometry_diagnostics.py +0 -363
- simind_python_connector-1.1.1/tests/test_package_identity.py +0 -18
- simind_python_connector-1.1.1/tests/test_packaging_resources.py +0 -113
- simind_python_connector-1.1.1/tests/test_python_connector.py +0 -748
- simind_python_connector-1.1.1/tests/test_schneider_density.py +0 -303
- simind_python_connector-1.1.1/tests/test_simulation_config.py +0 -221
- simind_python_connector-1.1.1/tests/test_utils.py +0 -129
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/LICENSE +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/api.rst +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/connector_modernization_plan.rst +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/examples/04_custom_config.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/examples/06_schneider_density_conversion.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/examples/08A_stir_adaptor_from_dicom.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/examples/08B_sirf_adaptor_from_dicom.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/examples/08C_pytomography_adaptor_from_dicom.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/examples/_python_connector_helpers.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/examples.rst +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/index.rst +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/docs/intro.rst +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/examples/04_custom_config.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/examples/06_schneider_density_conversion.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/examples/08A_stir_adaptor_from_dicom.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/examples/08B_sirf_adaptor_from_dicom.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/examples/08C_pytomography_adaptor_from_dicom.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/examples/_python_connector_helpers.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/setup.cfg +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/configs/AnyScan.yaml +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/configs/Discovery670.yaml +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/configs/Example.yaml +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/configs/MLD001_SCAN0.yaml +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/configs/input.smc +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/connectors/__init__.py +2 -2
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/converters/__init__.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/converters/dicom_to_stir.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/core/__init__.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/data/Schneider2000.json +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/data/bone.atn +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/data/h2o.atn +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector/utils/io_utils.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector.egg-info/dependency_links.txt +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/simind_python_connector.egg-info/top_level.txt +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/__init__.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_image_builder_unit.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_interfile_parser.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_sirf_stir_utils.py +0 -0
- {simind_python_connector-1.1.1 → simind_python_connector-1.2.0}/tests/test_stir_utils_backend_choice_unit.py +0 -0
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
include README.md
|
|
2
2
|
include LICENSE
|
|
3
|
-
include
|
|
4
|
-
include requirements-dev.txt
|
|
3
|
+
include .dockerignore
|
|
5
4
|
recursive-include simind_python_connector/data *.atn
|
|
6
5
|
recursive-include simind_python_connector/data *.json
|
|
7
6
|
recursive-include simind_python_connector/configs *.smc *.yaml
|
|
8
7
|
recursive-include docs *.rst *.py
|
|
8
|
+
include docs/_static/.gitkeep
|
|
9
9
|
recursive-include tests *.py
|
|
10
|
-
recursive-include
|
|
10
|
+
recursive-include tests/fixtures *.smc
|
|
11
|
+
recursive-include examples *.py *.sh
|
|
12
|
+
recursive-include scripts *.py *.sh
|
|
13
|
+
recursive-include docker Dockerfile *.md *.txt *.yaml *.yml *.py *.sh
|
|
14
|
+
exclude simind_manual.pdf
|
|
15
|
+
prune simind
|
|
16
|
+
prune docs/_build
|
|
17
|
+
prune docs/_generated
|
|
11
18
|
global-exclude __pycache__
|
|
12
19
|
global-exclude *.py[co]
|
|
13
20
|
global-exclude .DS_Store
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: simind-python-connector
|
|
3
|
-
Version: 1.
|
|
3
|
+
Version: 1.2.0
|
|
4
4
|
Summary: Python SIMIND Monte Carlo connector with STIR/SIRF/PyTomography adaptors
|
|
5
5
|
Author-email: Sam Porter <sam.porter.18@ucl.ac.uk>, Rebecca Gillen <rebecca.gillen.18@ucl.ac.uk>, "Efstathios (Stahis) Varzakis" <efstathios.varzakis.22@ucl.ac.uk>
|
|
6
6
|
Maintainer-email: Sam Porter <sam.porter.18@ucl.ac.uk>
|
|
@@ -15,14 +15,13 @@ Classifier: Development Status :: 4 - Beta
|
|
|
15
15
|
Classifier: Intended Audience :: Science/Research
|
|
16
16
|
Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
|
|
17
17
|
Classifier: Programming Language :: Python :: 3
|
|
18
|
-
Classifier: Programming Language :: Python :: 3.9
|
|
19
18
|
Classifier: Programming Language :: Python :: 3.10
|
|
20
19
|
Classifier: Programming Language :: Python :: 3.11
|
|
21
20
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
-
Requires-Python: >=3.
|
|
21
|
+
Requires-Python: >=3.10
|
|
23
22
|
Description-Content-Type: text/markdown
|
|
24
23
|
License-File: LICENSE
|
|
25
|
-
Requires-Dist: numpy
|
|
24
|
+
Requires-Dist: numpy<2.0,>=1.20.0
|
|
26
25
|
Requires-Dist: pydicom>=2.0.0
|
|
27
26
|
Requires-Dist: pyyaml>=5.4.0
|
|
28
27
|
Provides-Extra: dev
|
|
@@ -48,7 +47,7 @@ Python SIMIND Monte Carlo Connector.
|
|
|
48
47
|
[](https://github.com/samdporter/simind-python-connector/actions)
|
|
49
48
|
[](https://simind-python-connector.readthedocs.io/en/latest/?badge=latest)
|
|
50
49
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
51
|
-
[](https://www.python.org/downloads/)
|
|
52
51
|
|
|
53
52
|
A Python toolkit that lets you run SIMIND from Python and use the outputs in
|
|
54
53
|
common reconstruction ecosystems (STIR, SIRF, PyTomography).
|
|
@@ -62,6 +61,9 @@ University.
|
|
|
62
61
|
SIMIND is **not distributed** with this package. You must separately obtain and
|
|
63
62
|
install a licensed SIMIND installation.
|
|
64
63
|
|
|
64
|
+
**Supported SIMIND version:** SIMIND V8.0. SIMIND V9.0 is not supported yet;
|
|
65
|
+
V9 support will follow in a later release.
|
|
66
|
+
|
|
65
67
|
## Quick Links
|
|
66
68
|
- [Full Documentation](https://simind-python-connector.readthedocs.io/)
|
|
67
69
|
- [Installation](https://simind-python-connector.readthedocs.io/en/latest/installation.html)
|
|
@@ -99,6 +101,12 @@ For example plotting dependencies:
|
|
|
99
101
|
pip install "simind-python-connector[examples]"
|
|
100
102
|
```
|
|
101
103
|
|
|
104
|
+
**NumPy**: the package requires `numpy>=1.20.0,<2.0`. The `<2.0` cap is a
|
|
105
|
+
binary-ABI / backend-compatibility guard for the legacy 1.1.x line: the STIR
|
|
106
|
+
and SIRF bindings are compiled against NumPy 1.x and crash with NumPy 2, so the
|
|
107
|
+
cap applies package-wide. It is not a Python-version constraint; interpreter
|
|
108
|
+
support is stated separately as Python 3.10+.
|
|
109
|
+
|
|
102
110
|
### Adaptor Dependencies
|
|
103
111
|
|
|
104
112
|
`SimindPythonConnector` works without SIRF/STIR/PyTomography.
|
|
@@ -116,7 +124,7 @@ Install from conda:
|
|
|
116
124
|
conda install -c conda-forge stir "numpy<2.0"
|
|
117
125
|
```
|
|
118
126
|
|
|
119
|
-
**Important**: As of November 2025, the STIR conda package (v6.3.0) requires NumPy < 2.0 due to binary compatibility issues with NumPy 2.x. The package was compiled against NumPy 1.x and will crash with memory errors if NumPy 2.x is installed. This should be resolved in future STIR releases.
|
|
127
|
+
**Important**: As of November 2025, the STIR conda package (v6.3.0) requires NumPy < 2.0 due to binary compatibility issues with NumPy 2.x. The package was compiled against NumPy 1.x and will crash with memory errors if NumPy 2.x is installed. This should be resolved in future STIR releases. Like the package-wide pin, this is a backend binary-ABI compatibility guard, not a Python-version constraint.
|
|
120
128
|
|
|
121
129
|
Or build from source:
|
|
122
130
|
```bash
|
|
@@ -182,6 +190,7 @@ executable is available as `simind` on `PATH`.
|
|
|
182
190
|
import numpy as np
|
|
183
191
|
from simind_python_connector import SimindPythonConnector
|
|
184
192
|
from simind_python_connector.configs import get
|
|
193
|
+
from simind_python_connector.core.types import DEFAULT_QUANTIZATION_SCALE
|
|
185
194
|
|
|
186
195
|
source = np.zeros((32, 32, 32), dtype=np.float32) # z, y, x
|
|
187
196
|
source[12:20, 12:20, 12:20] = 1.0
|
|
@@ -192,7 +201,7 @@ connector = SimindPythonConnector(
|
|
|
192
201
|
config_source=get("Example.yaml"),
|
|
193
202
|
output_dir="output/basic",
|
|
194
203
|
output_prefix="case01",
|
|
195
|
-
quantization_scale=0.05,
|
|
204
|
+
quantization_scale=0.05 * DEFAULT_QUANTIZATION_SCALE,
|
|
196
205
|
)
|
|
197
206
|
|
|
198
207
|
connector.configure_voxel_phantom(
|
|
@@ -247,11 +256,20 @@ For minimal toy runs with smaller projection/image settings, use
|
|
|
247
256
|
`quantization_scale` controls source integer quantization before writing SIMIND
|
|
248
257
|
`.smi` files:
|
|
249
258
|
|
|
250
|
-
- `
|
|
251
|
-
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
259
|
+
- the default (`500 / 32767`) preserves the legacy 500-weight source budget;
|
|
260
|
+
- `1.0` uses the full signed 16-bit source range (`32767`), the best numeric
|
|
261
|
+
precision;
|
|
262
|
+
- `< 1.0` reduces the integer scale for faster toy runs but increases rounding
|
|
263
|
+
error.
|
|
264
|
+
|
|
265
|
+
SIMIND reads the source and density maps as signed 16-bit integers, so values
|
|
266
|
+
of `32768` and above wrap negative and silently corrupt the map; the connector
|
|
267
|
+
caps both maps at `32767`. Explicit `quantization_scale` values are used as
|
|
268
|
+
given, with no automatic migration of scales calibrated for the former
|
|
269
|
+
500-weight maximum: rescale an old scale with
|
|
270
|
+
`old_scale * DEFAULT_QUANTIZATION_SCALE`. SIMIND treats source maps as integer
|
|
271
|
+
weights; absolute activity/time scaling is controlled separately by simulation
|
|
272
|
+
settings.
|
|
255
273
|
|
|
256
274
|
## Docker Environments
|
|
257
275
|
|
|
@@ -5,7 +5,7 @@ Python SIMIND Monte Carlo Connector.
|
|
|
5
5
|
[](https://github.com/samdporter/simind-python-connector/actions)
|
|
6
6
|
[](https://simind-python-connector.readthedocs.io/en/latest/?badge=latest)
|
|
7
7
|
[](https://opensource.org/licenses/Apache-2.0)
|
|
8
|
-
[](https://www.python.org/downloads/)
|
|
9
9
|
|
|
10
10
|
A Python toolkit that lets you run SIMIND from Python and use the outputs in
|
|
11
11
|
common reconstruction ecosystems (STIR, SIRF, PyTomography).
|
|
@@ -19,6 +19,9 @@ University.
|
|
|
19
19
|
SIMIND is **not distributed** with this package. You must separately obtain and
|
|
20
20
|
install a licensed SIMIND installation.
|
|
21
21
|
|
|
22
|
+
**Supported SIMIND version:** SIMIND V8.0. SIMIND V9.0 is not supported yet;
|
|
23
|
+
V9 support will follow in a later release.
|
|
24
|
+
|
|
22
25
|
## Quick Links
|
|
23
26
|
- [Full Documentation](https://simind-python-connector.readthedocs.io/)
|
|
24
27
|
- [Installation](https://simind-python-connector.readthedocs.io/en/latest/installation.html)
|
|
@@ -56,6 +59,12 @@ For example plotting dependencies:
|
|
|
56
59
|
pip install "simind-python-connector[examples]"
|
|
57
60
|
```
|
|
58
61
|
|
|
62
|
+
**NumPy**: the package requires `numpy>=1.20.0,<2.0`. The `<2.0` cap is a
|
|
63
|
+
binary-ABI / backend-compatibility guard for the legacy 1.1.x line: the STIR
|
|
64
|
+
and SIRF bindings are compiled against NumPy 1.x and crash with NumPy 2, so the
|
|
65
|
+
cap applies package-wide. It is not a Python-version constraint; interpreter
|
|
66
|
+
support is stated separately as Python 3.10+.
|
|
67
|
+
|
|
59
68
|
### Adaptor Dependencies
|
|
60
69
|
|
|
61
70
|
`SimindPythonConnector` works without SIRF/STIR/PyTomography.
|
|
@@ -73,7 +82,7 @@ Install from conda:
|
|
|
73
82
|
conda install -c conda-forge stir "numpy<2.0"
|
|
74
83
|
```
|
|
75
84
|
|
|
76
|
-
**Important**: As of November 2025, the STIR conda package (v6.3.0) requires NumPy < 2.0 due to binary compatibility issues with NumPy 2.x. The package was compiled against NumPy 1.x and will crash with memory errors if NumPy 2.x is installed. This should be resolved in future STIR releases.
|
|
85
|
+
**Important**: As of November 2025, the STIR conda package (v6.3.0) requires NumPy < 2.0 due to binary compatibility issues with NumPy 2.x. The package was compiled against NumPy 1.x and will crash with memory errors if NumPy 2.x is installed. This should be resolved in future STIR releases. Like the package-wide pin, this is a backend binary-ABI compatibility guard, not a Python-version constraint.
|
|
77
86
|
|
|
78
87
|
Or build from source:
|
|
79
88
|
```bash
|
|
@@ -139,6 +148,7 @@ executable is available as `simind` on `PATH`.
|
|
|
139
148
|
import numpy as np
|
|
140
149
|
from simind_python_connector import SimindPythonConnector
|
|
141
150
|
from simind_python_connector.configs import get
|
|
151
|
+
from simind_python_connector.core.types import DEFAULT_QUANTIZATION_SCALE
|
|
142
152
|
|
|
143
153
|
source = np.zeros((32, 32, 32), dtype=np.float32) # z, y, x
|
|
144
154
|
source[12:20, 12:20, 12:20] = 1.0
|
|
@@ -149,7 +159,7 @@ connector = SimindPythonConnector(
|
|
|
149
159
|
config_source=get("Example.yaml"),
|
|
150
160
|
output_dir="output/basic",
|
|
151
161
|
output_prefix="case01",
|
|
152
|
-
quantization_scale=0.05,
|
|
162
|
+
quantization_scale=0.05 * DEFAULT_QUANTIZATION_SCALE,
|
|
153
163
|
)
|
|
154
164
|
|
|
155
165
|
connector.configure_voxel_phantom(
|
|
@@ -204,11 +214,20 @@ For minimal toy runs with smaller projection/image settings, use
|
|
|
204
214
|
`quantization_scale` controls source integer quantization before writing SIMIND
|
|
205
215
|
`.smi` files:
|
|
206
216
|
|
|
207
|
-
- `
|
|
208
|
-
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
217
|
+
- the default (`500 / 32767`) preserves the legacy 500-weight source budget;
|
|
218
|
+
- `1.0` uses the full signed 16-bit source range (`32767`), the best numeric
|
|
219
|
+
precision;
|
|
220
|
+
- `< 1.0` reduces the integer scale for faster toy runs but increases rounding
|
|
221
|
+
error.
|
|
222
|
+
|
|
223
|
+
SIMIND reads the source and density maps as signed 16-bit integers, so values
|
|
224
|
+
of `32768` and above wrap negative and silently corrupt the map; the connector
|
|
225
|
+
caps both maps at `32767`. Explicit `quantization_scale` values are used as
|
|
226
|
+
given, with no automatic migration of scales calibrated for the former
|
|
227
|
+
500-weight maximum: rescale an old scale with
|
|
228
|
+
`old_scale * DEFAULT_QUANTIZATION_SCALE`. SIMIND treats source maps as integer
|
|
229
|
+
weights; absolute activity/time scaling is controlled separately by simulation
|
|
230
|
+
settings.
|
|
212
231
|
|
|
213
232
|
## Docker Environments
|
|
214
233
|
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
Docker Environments
|
|
2
|
+
===================
|
|
3
|
+
|
|
4
|
+
This directory provides dedicated container setups for:
|
|
5
|
+
|
|
6
|
+
- Core Python workflows (no SIRF/STIR/PyTomography)
|
|
7
|
+
- STIR workflows
|
|
8
|
+
- SIRF workflows
|
|
9
|
+
- PyTomography workflows
|
|
10
|
+
|
|
11
|
+
Quick start
|
|
12
|
+
-----------
|
|
13
|
+
|
|
14
|
+
Build and run a specific environment:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
docker compose -f docker/compose.yaml build stir
|
|
18
|
+
docker compose -f docker/compose.yaml run --rm stir
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
Run the dedicated connector + OSEM examples directly:
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
docker compose -f docker/compose.yaml run --rm stir python examples/07A_stir_adaptor_osem.py
|
|
25
|
+
docker compose -f docker/compose.yaml run --rm sirf python examples/07B_sirf_adaptor_osem.py
|
|
26
|
+
docker compose -f docker/compose.yaml run --rm pytomography python examples/07C_pytomography_adaptor_osem.py
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Run the containerized test matrix:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
bash scripts/run_container_validation.sh
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
Include SIMIND-dependent examples/integration tests:
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
bash scripts/run_container_validation.sh --with-simind
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Run selected example groups:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
bash scripts/run_container_examples.sh --only-core
|
|
45
|
+
bash scripts/run_container_examples.sh --only-pytomography
|
|
46
|
+
bash scripts/run_container_examples.sh --only-osem
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Set a specific Docker platform when needed:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
bash scripts/run_container_examples.sh --only-core --docker-platform linux/amd64
|
|
53
|
+
bash scripts/run_container_validation.sh --with-simind --docker-platform linux/amd64
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
Require SIMIND explicitly (fail fast if missing):
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
bash scripts/run_container_examples.sh --only-osem --require-simind
|
|
60
|
+
bash scripts/run_container_validation.sh --with-simind --require-simind
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Services
|
|
64
|
+
--------
|
|
65
|
+
|
|
66
|
+
- `python`: Core Python image for non-backend examples/tests.
|
|
67
|
+
- `stir`: STIR-focused image (based on `synerbi/sirf`) with this repository installed.
|
|
68
|
+
- `sirf`: SIRF-focused image (based on `synerbi/sirf`) with this repository installed.
|
|
69
|
+
- `pytomography`: Python image with PyTomography + this repository installed.
|
|
70
|
+
- Each service enables an import guard so only its target library is importable
|
|
71
|
+
during tests/examples (`stir`, `sirf.STIR`, or `pytomography` respectively;
|
|
72
|
+
`python` blocks all three backend libraries).
|
|
73
|
+
|
|
74
|
+
Notes
|
|
75
|
+
-----
|
|
76
|
+
|
|
77
|
+
- The container scripts run the `python` service as the invoking host user
|
|
78
|
+
(`HOST_UID`/`HOST_GID`); direct `docker compose run python` runs as root.
|
|
79
|
+
The SIRF-based services always run as uid 1000 (`jovyan`).
|
|
80
|
+
- The SIRF container build arg is `SIRF_BASE_IMAGE`.
|
|
81
|
+
- The STIR container build arg is `STIR_BASE_IMAGE`.
|
|
82
|
+
- Install SIMIND by following the official installation instructions on the SIMIND website.
|
|
83
|
+
- For quick local use with these containers, put SIMIND at `./simind` in this repo
|
|
84
|
+
so the executable is available as `./simind/simind`.
|
|
85
|
+
- SIMIND-dependent examples require the `simind` executable inside the container.
|
|
86
|
+
Runner scripts now auto-check `./simind/simind` and skip SIMIND-dependent checks
|
|
87
|
+
when missing (or fail fast if `--require-simind` is used).
|
|
88
|
+
- For mixed host/runtime architectures, the runner scripts auto-detect SIMIND
|
|
89
|
+
binary architecture (`x86_64`/`aarch64`) and set Docker platform automatically;
|
|
90
|
+
use `--docker-platform` to override.
|
|
91
|
+
- `input.smc` is bundled in `simind_python_connector/configs`; SIMIND runtime checks
|
|
92
|
+
only gate external executable availability.
|
|
93
|
+
- The toy adaptor examples use `simind_python_connector/configs/Example.yaml`,
|
|
94
|
+
a reduced projection-space profile derived from `AnyScan.yaml`.
|
|
95
|
+
- These images are intended to run examples and interactive exploration.
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
services:
|
|
2
|
+
python:
|
|
3
|
+
build:
|
|
4
|
+
context: ..
|
|
5
|
+
dockerfile: docker/python/Dockerfile
|
|
6
|
+
image: simind-python-connector/python:dev
|
|
7
|
+
# The container scripts run this service as the invoking host user so its
|
|
8
|
+
# outputs in the shared mount stay writable; direct use runs as root.
|
|
9
|
+
user: "${HOST_UID:-0}:${HOST_GID:-0}"
|
|
10
|
+
working_dir: /workspace
|
|
11
|
+
environment:
|
|
12
|
+
HOME: /tmp
|
|
13
|
+
SIMIND_CONNECTOR_BACKEND: python
|
|
14
|
+
SIMIND_ROOT: /workspace/simind
|
|
15
|
+
SIMIND_BIN: ${SIMIND_BIN:-/workspace/simind/simind}
|
|
16
|
+
SIMIND_MPI_BIN: ${SIMIND_MPI_BIN:-/workspace/simind/simind_mpi}
|
|
17
|
+
SIMIND_SMC_DIR: ${SIMIND_SMC_DIR:-/workspace/simind/smc_dir/}
|
|
18
|
+
SIMIND_DATA_DIR: /workspace/simind/smc_dir/
|
|
19
|
+
SMC_DIR: /workspace/simind/smc_dir/
|
|
20
|
+
volumes:
|
|
21
|
+
- ..:/workspace
|
|
22
|
+
command: python examples/06_schneider_density_conversion.py
|
|
23
|
+
|
|
24
|
+
stir:
|
|
25
|
+
build:
|
|
26
|
+
context: ..
|
|
27
|
+
dockerfile: docker/stir/Dockerfile
|
|
28
|
+
image: simind-python-connector/stir:dev
|
|
29
|
+
working_dir: /workspace
|
|
30
|
+
environment:
|
|
31
|
+
SIMIND_CONNECTOR_BACKEND: stir
|
|
32
|
+
SIMIND_ROOT: /workspace/simind
|
|
33
|
+
SIMIND_BIN: ${SIMIND_BIN:-/workspace/simind/simind}
|
|
34
|
+
SIMIND_MPI_BIN: ${SIMIND_MPI_BIN:-/workspace/simind/simind_mpi}
|
|
35
|
+
SIMIND_SMC_DIR: ${SIMIND_SMC_DIR:-/workspace/simind/smc_dir/}
|
|
36
|
+
SIMIND_DATA_DIR: /workspace/simind/smc_dir/
|
|
37
|
+
SMC_DIR: /workspace/simind/smc_dir/
|
|
38
|
+
volumes:
|
|
39
|
+
- ..:/workspace
|
|
40
|
+
command: python examples/07A_stir_adaptor_osem.py
|
|
41
|
+
|
|
42
|
+
sirf:
|
|
43
|
+
build:
|
|
44
|
+
context: ..
|
|
45
|
+
dockerfile: docker/sirf/Dockerfile
|
|
46
|
+
image: simind-python-connector/sirf:dev
|
|
47
|
+
working_dir: /workspace
|
|
48
|
+
environment:
|
|
49
|
+
SIMIND_CONNECTOR_BACKEND: sirf
|
|
50
|
+
SIMIND_ROOT: /workspace/simind
|
|
51
|
+
SIMIND_BIN: ${SIMIND_BIN:-/workspace/simind/simind}
|
|
52
|
+
SIMIND_MPI_BIN: ${SIMIND_MPI_BIN:-/workspace/simind/simind_mpi}
|
|
53
|
+
SIMIND_SMC_DIR: ${SIMIND_SMC_DIR:-/workspace/simind/smc_dir/}
|
|
54
|
+
SIMIND_DATA_DIR: /workspace/simind/smc_dir/
|
|
55
|
+
SMC_DIR: /workspace/simind/smc_dir/
|
|
56
|
+
volumes:
|
|
57
|
+
- ..:/workspace
|
|
58
|
+
command: python examples/07B_sirf_adaptor_osem.py
|
|
59
|
+
|
|
60
|
+
pytomography:
|
|
61
|
+
build:
|
|
62
|
+
context: ..
|
|
63
|
+
dockerfile: docker/pytomography/Dockerfile
|
|
64
|
+
image: simind-python-connector/pytomography:dev
|
|
65
|
+
working_dir: /workspace
|
|
66
|
+
environment:
|
|
67
|
+
SIMIND_CONNECTOR_BACKEND: pytomography
|
|
68
|
+
SIMIND_ROOT: /workspace/simind
|
|
69
|
+
SIMIND_BIN: ${SIMIND_BIN:-/workspace/simind/simind}
|
|
70
|
+
SIMIND_MPI_BIN: ${SIMIND_MPI_BIN:-/workspace/simind/simind_mpi}
|
|
71
|
+
SIMIND_SMC_DIR: ${SIMIND_SMC_DIR:-/workspace/simind/smc_dir/}
|
|
72
|
+
SIMIND_DATA_DIR: /workspace/simind/smc_dir/
|
|
73
|
+
SMC_DIR: /workspace/simind/smc_dir/
|
|
74
|
+
volumes:
|
|
75
|
+
- ..:/workspace
|
|
76
|
+
command: python examples/07C_pytomography_adaptor_osem.py
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
# Version constraints shared by backend Dockerfiles.
|
|
2
|
+
# NumPy is capped below 2.x: the STIR/SIRF binaries in the synerbi/sirf base
|
|
3
|
+
# images are compiled against NumPy 1.x and crash with NumPy 2 (see README
|
|
4
|
+
# "NumPy ABI" notes).
|
|
5
|
+
# Backend installs also resolve the base image's imagecodecs and tifffile so
|
|
6
|
+
# their NumPy requirements stay compatible with this cap.
|
|
7
|
+
numpy<2.0
|
|
8
|
+
pytest==8.4.2
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
"""
|
|
2
|
+
Import guard used by backend-isolated Docker environments.
|
|
3
|
+
|
|
4
|
+
Set SIMIND_PYTHON_CONNECTOR_BLOCK_IMPORTS to a comma-separated list of top-level module
|
|
5
|
+
names. Any import matching one of those module roots will raise ImportError.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
from __future__ import annotations
|
|
9
|
+
|
|
10
|
+
import builtins
|
|
11
|
+
import importlib.abc
|
|
12
|
+
import os
|
|
13
|
+
import sys
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
BLOCKED_IMPORTS = {
|
|
17
|
+
entry.strip()
|
|
18
|
+
for entry in os.environ.get("SIMIND_PYTHON_CONNECTOR_BLOCK_IMPORTS", "").split(",")
|
|
19
|
+
if entry.strip()
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if BLOCKED_IMPORTS:
|
|
23
|
+
_ORIGINAL_IMPORT = builtins.__import__
|
|
24
|
+
|
|
25
|
+
class _BlockedModuleFinder(importlib.abc.MetaPathFinder):
|
|
26
|
+
"""Prevent loading blocked module roots through all import paths."""
|
|
27
|
+
|
|
28
|
+
def find_spec(self, fullname, path=None, target=None):
|
|
29
|
+
root = fullname.split(".", 1)[0]
|
|
30
|
+
if root in BLOCKED_IMPORTS:
|
|
31
|
+
raise ModuleNotFoundError(
|
|
32
|
+
f"Module '{root}' is blocked in this backend-isolated container.",
|
|
33
|
+
name=root,
|
|
34
|
+
)
|
|
35
|
+
return None
|
|
36
|
+
|
|
37
|
+
for module_name in list(sys.modules):
|
|
38
|
+
if module_name.split(".", 1)[0] in BLOCKED_IMPORTS:
|
|
39
|
+
del sys.modules[module_name]
|
|
40
|
+
|
|
41
|
+
sys.meta_path.insert(0, _BlockedModuleFinder())
|
|
42
|
+
|
|
43
|
+
def _guarded_import(name, globals=None, locals=None, fromlist=(), level=0):
|
|
44
|
+
root = name.split(".", 1)[0]
|
|
45
|
+
if root in BLOCKED_IMPORTS:
|
|
46
|
+
raise ModuleNotFoundError(
|
|
47
|
+
f"Module '{root}' is blocked in this backend-isolated container.",
|
|
48
|
+
name=root,
|
|
49
|
+
)
|
|
50
|
+
return _ORIGINAL_IMPORT(name, globals, locals, fromlist, level)
|
|
51
|
+
|
|
52
|
+
builtins.__import__ = _guarded_import
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
ARG PYTHON_BASE_IMAGE=python:3.12-slim
|
|
2
|
+
FROM ${PYTHON_BASE_IMAGE}
|
|
3
|
+
|
|
4
|
+
ENV PYTHONDONTWRITEBYTECODE=1
|
|
5
|
+
ENV PYTHONUNBUFFERED=1
|
|
6
|
+
ENV SIMIND_ROOT=/workspace/simind
|
|
7
|
+
ENV SIMIND_BIN=${SIMIND_ROOT}/simind
|
|
8
|
+
ENV SIMIND_MPI_BIN=${SIMIND_ROOT}/simind_mpi
|
|
9
|
+
ENV SIMIND_SMC_DIR=${SIMIND_ROOT}/smc_dir/
|
|
10
|
+
ENV SIMIND_DATA_DIR=${SIMIND_ROOT}/smc_dir/
|
|
11
|
+
ENV SMC_DIR=${SIMIND_ROOT}/smc_dir/
|
|
12
|
+
ENV SIMIND_PYTHON_CONNECTOR_BLOCK_IMPORTS=sirf,stir,stirextra,pytomography
|
|
13
|
+
ENV PYTHONPATH=/workspace/docker/import_guard:${PYTHONPATH}
|
|
14
|
+
ENV PATH=${SIMIND_ROOT}/bin:${SIMIND_ROOT}:${PATH}
|
|
15
|
+
|
|
16
|
+
# MPICH runtime for SIMIND's MPI binary; the compat script exposes the library
|
|
17
|
+
# names that binary was built against. See docker/python/install_mpich_compat.sh.
|
|
18
|
+
RUN apt-get update \
|
|
19
|
+
&& apt-get install -y --no-install-recommends git mpich \
|
|
20
|
+
&& rm -rf /var/lib/apt/lists/*
|
|
21
|
+
|
|
22
|
+
COPY docker/python/install_mpich_compat.sh /usr/local/bin/install_mpich_compat.sh
|
|
23
|
+
RUN chmod +x /usr/local/bin/install_mpich_compat.sh \
|
|
24
|
+
&& install_mpich_compat.sh
|
|
25
|
+
|
|
26
|
+
WORKDIR /workspace
|
|
27
|
+
|
|
28
|
+
COPY . /workspace
|
|
29
|
+
|
|
30
|
+
RUN python -m pip install --upgrade pip \
|
|
31
|
+
&& pip install --constraint /workspace/docker/constraints.txt -e ".[dev,examples]" \
|
|
32
|
+
&& python - <<'PY'
|
|
33
|
+
import importlib
|
|
34
|
+
for module in ("numpy", "matplotlib", "pytest"):
|
|
35
|
+
importlib.import_module(module)
|
|
36
|
+
print("Core Python modules available")
|
|
37
|
+
PY
|
|
38
|
+
|
|
39
|
+
CMD ["python", "examples/06_schneider_density_conversion.py"]
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
#!/bin/sh
|
|
2
|
+
# SIMIND's Linux binary links against the historical MPICH names
|
|
3
|
+
# libmpi.so.12 / libmpifort.so.12. Debian's mpich package ships
|
|
4
|
+
# libmpich.so.12 / libmpichfort.so.12; expose the expected names when the
|
|
5
|
+
# loader cannot find them.
|
|
6
|
+
set -eu
|
|
7
|
+
|
|
8
|
+
multiarch="$(python3 -c 'import sysconfig; print(sysconfig.get_config_var("MULTIARCH"))')"
|
|
9
|
+
libdir="/usr/lib/${multiarch}"
|
|
10
|
+
|
|
11
|
+
link_if_missing() {
|
|
12
|
+
target="$1"
|
|
13
|
+
link_name="$2"
|
|
14
|
+
if [ ! -e "${libdir}/${link_name}" ] && [ -e "${libdir}/${target}" ]; then
|
|
15
|
+
ln -s "${target}" "${libdir}/${link_name}"
|
|
16
|
+
fi
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
link_if_missing libmpich.so.12 libmpi.so.12
|
|
20
|
+
link_if_missing libmpichfort.so.12 libmpifort.so.12
|
|
21
|
+
|
|
22
|
+
ldconfig
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
ARG PYTOMO_BASE_IMAGE=synerbi/sirf:latest
|
|
2
|
+
FROM ${PYTOMO_BASE_IMAGE}
|
|
3
|
+
|
|
4
|
+
ENV PYTHONDONTWRITEBYTECODE=1
|
|
5
|
+
ENV PYTHONUNBUFFERED=1
|
|
6
|
+
ENV SIRF_INSTALL_PATH=/opt/SIRF-SuperBuild/INSTALL
|
|
7
|
+
ENV SIMIND_ROOT=/workspace/simind
|
|
8
|
+
ENV SIMIND_BIN=${SIMIND_ROOT}/simind
|
|
9
|
+
ENV SIMIND_MPI_BIN=${SIMIND_ROOT}/simind_mpi
|
|
10
|
+
ENV SIMIND_SMC_DIR=${SIMIND_ROOT}/smc_dir/
|
|
11
|
+
ENV SIMIND_DATA_DIR=${SIMIND_ROOT}/smc_dir/
|
|
12
|
+
ENV SMC_DIR=${SIMIND_ROOT}/smc_dir/
|
|
13
|
+
ENV SIMIND_PYTHON_CONNECTOR_BLOCK_IMPORTS=sirf,stir,stirextra
|
|
14
|
+
ENV PYTHONPATH=/workspace/docker/import_guard:${SIRF_INSTALL_PATH}/python
|
|
15
|
+
ENV LD_LIBRARY_PATH=/opt/conda/lib:${SIRF_INSTALL_PATH}/lib:${SIRF_INSTALL_PATH}/lib64:${LD_LIBRARY_PATH}
|
|
16
|
+
ENV PATH=${SIMIND_ROOT}/bin:${SIMIND_ROOT}:${SIRF_INSTALL_PATH}/bin:${PATH}
|
|
17
|
+
|
|
18
|
+
WORKDIR /workspace
|
|
19
|
+
|
|
20
|
+
COPY --chown=1000:100 . /workspace
|
|
21
|
+
|
|
22
|
+
RUN python -m pip install --upgrade pip \
|
|
23
|
+
&& pip install --index-url https://download.pytorch.org/whl/cpu torch \
|
|
24
|
+
&& pip install --constraint /workspace/docker/constraints.txt \
|
|
25
|
+
-e ".[dev,examples]" pytomography imagecodecs tifffile \
|
|
26
|
+
&& python - <<'PY'
|
|
27
|
+
import importlib
|
|
28
|
+
for module in ("torch", "pytomography", "pytest"):
|
|
29
|
+
importlib.import_module(module)
|
|
30
|
+
print("PyTomography modules available")
|
|
31
|
+
PY
|
|
32
|
+
|
|
33
|
+
CMD ["python", "examples/07C_pytomography_adaptor_osem.py"]
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
ARG SIRF_BASE_IMAGE=synerbi/sirf:latest
|
|
2
|
+
FROM ${SIRF_BASE_IMAGE}
|
|
3
|
+
|
|
4
|
+
ENV PYTHONDONTWRITEBYTECODE=1
|
|
5
|
+
ENV PYTHONUNBUFFERED=1
|
|
6
|
+
ENV SIRF_INSTALL_PATH=/opt/SIRF-SuperBuild/INSTALL
|
|
7
|
+
ENV SIMIND_ROOT=/workspace/simind
|
|
8
|
+
ENV SIMIND_BIN=${SIMIND_ROOT}/simind
|
|
9
|
+
ENV SIMIND_MPI_BIN=${SIMIND_ROOT}/simind_mpi
|
|
10
|
+
ENV SIMIND_SMC_DIR=${SIMIND_ROOT}/smc_dir/
|
|
11
|
+
ENV SIMIND_DATA_DIR=${SIMIND_ROOT}/smc_dir/
|
|
12
|
+
ENV SMC_DIR=${SIMIND_ROOT}/smc_dir/
|
|
13
|
+
ENV SIMIND_PYTHON_CONNECTOR_BLOCK_IMPORTS=stir,stirextra,pytomography
|
|
14
|
+
ENV PYTHONPATH=/workspace/docker/import_guard:${SIRF_INSTALL_PATH}/python:${PYTHONPATH}
|
|
15
|
+
ENV LD_LIBRARY_PATH=/opt/conda/lib:${SIRF_INSTALL_PATH}/lib:${SIRF_INSTALL_PATH}/lib64:${LD_LIBRARY_PATH}
|
|
16
|
+
ENV PATH=${SIMIND_ROOT}/bin:${SIMIND_ROOT}:${SIRF_INSTALL_PATH}/bin:${PATH}
|
|
17
|
+
|
|
18
|
+
WORKDIR /workspace
|
|
19
|
+
|
|
20
|
+
COPY --chown=1000:100 . /workspace
|
|
21
|
+
|
|
22
|
+
RUN python -m pip install --upgrade pip \
|
|
23
|
+
&& pip install --constraint /workspace/docker/constraints.txt \
|
|
24
|
+
-e ".[dev,examples]" imagecodecs tifffile \
|
|
25
|
+
&& python - <<'PY'
|
|
26
|
+
import importlib
|
|
27
|
+
for module in ("sirf.STIR", "pytest"):
|
|
28
|
+
importlib.import_module(module)
|
|
29
|
+
print("SIRF Python modules available")
|
|
30
|
+
PY
|
|
31
|
+
|
|
32
|
+
CMD ["python", "examples/07B_sirf_adaptor_osem.py"]
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
ARG STIR_BASE_IMAGE=synerbi/sirf:latest
|
|
2
|
+
FROM ${STIR_BASE_IMAGE}
|
|
3
|
+
|
|
4
|
+
ENV PYTHONDONTWRITEBYTECODE=1
|
|
5
|
+
ENV PYTHONUNBUFFERED=1
|
|
6
|
+
ENV SIRF_INSTALL_PATH=/opt/SIRF-SuperBuild/INSTALL
|
|
7
|
+
ENV SIMIND_ROOT=/workspace/simind
|
|
8
|
+
ENV SIMIND_BIN=${SIMIND_ROOT}/simind
|
|
9
|
+
ENV SIMIND_MPI_BIN=${SIMIND_ROOT}/simind_mpi
|
|
10
|
+
ENV SIMIND_SMC_DIR=${SIMIND_ROOT}/smc_dir/
|
|
11
|
+
ENV SIMIND_DATA_DIR=${SIMIND_ROOT}/smc_dir/
|
|
12
|
+
ENV SMC_DIR=${SIMIND_ROOT}/smc_dir/
|
|
13
|
+
ENV SIMIND_PYTHON_CONNECTOR_BLOCK_IMPORTS=sirf,pytomography
|
|
14
|
+
ENV PYTHONPATH=/workspace/docker/import_guard:${SIRF_INSTALL_PATH}/python:${PYTHONPATH}
|
|
15
|
+
ENV LD_LIBRARY_PATH=/opt/conda/lib:${SIRF_INSTALL_PATH}/lib:${SIRF_INSTALL_PATH}/lib64:${LD_LIBRARY_PATH}
|
|
16
|
+
ENV PATH=${SIMIND_ROOT}/bin:${SIMIND_ROOT}:${SIRF_INSTALL_PATH}/bin:${PATH}
|
|
17
|
+
|
|
18
|
+
WORKDIR /workspace
|
|
19
|
+
|
|
20
|
+
COPY --chown=1000:100 . /workspace
|
|
21
|
+
|
|
22
|
+
RUN python -m pip install --upgrade pip \
|
|
23
|
+
&& pip install --constraint /workspace/docker/constraints.txt \
|
|
24
|
+
-e ".[dev,examples]" imagecodecs tifffile \
|
|
25
|
+
&& python - <<'PY'
|
|
26
|
+
import stir # noqa: F401
|
|
27
|
+
import pytest # noqa: F401
|
|
28
|
+
from simind_python_connector.utils.import_helpers import _import_stir_extra
|
|
29
|
+
|
|
30
|
+
_import_stir_extra()
|
|
31
|
+
print("STIR Python modules available")
|
|
32
|
+
PY
|
|
33
|
+
|
|
34
|
+
CMD ["python", "examples/07A_stir_adaptor_osem.py"]
|
|
File without changes
|
|
@@ -16,7 +16,8 @@ Dependency Matrix
|
|
|
16
16
|
* - ``SimindPythonConnector``
|
|
17
17
|
- SIMIND executable on ``PATH`` (no SIRF/STIR/PyTomography requirement)
|
|
18
18
|
* - ``StirSimindAdaptor``
|
|
19
|
-
- STIR Python (``stir``
|
|
19
|
+
- STIR Python (``stir`` plus ``stir.extra``, with the legacy ``stirextra``
|
|
20
|
+
module as a fallback)
|
|
20
21
|
* - ``SirfSimindAdaptor``
|
|
21
22
|
- SIRF (``sirf.STIR``)
|
|
22
23
|
* - ``PyTomographySimindAdaptor``
|