pyRadPlan 0.2.0__tar.gz → 0.2.1__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.
- {pyradplan-0.2.0/pyRadPlan.egg-info → pyradplan-0.2.1}/PKG-INFO +1 -1
- {pyradplan-0.2.0 → pyradplan-0.2.1}/examples/carbon_pencilbeam.py +3 -9
- {pyradplan-0.2.0 → pyradplan-0.2.1}/examples/helium_pencilbeam.py +3 -8
- {pyradplan-0.2.0 → pyradplan-0.2.1}/examples/import_matrad_patient.py +4 -3
- {pyradplan-0.2.0 → pyradplan-0.2.1}/examples/photon_pencilbeam.py +3 -9
- {pyradplan-0.2.0 → pyradplan-0.2.1}/examples/proton_pencilbeam.py +3 -9
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/__init__.py +2 -1
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/dose/engines/__init__.py +1 -1
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/dose/engines/_base.py +5 -3
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/dose/engines/_base_pencilbeam.py +5 -1
- pyradplan-0.2.1/pyRadPlan/io/__init__.py +4 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/io/_patient_loader.py +22 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/machines/_load.py +4 -3
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/raytracer/__init__.py +2 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/raytracer/_base.py +17 -32
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/raytracer/_perf.py +4 -2
- {pyradplan-0.2.0 → pyradplan-0.2.1/pyRadPlan.egg-info}/PKG-INFO +1 -1
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyproject.toml +1 -1
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/conftest.py +4 -3
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/core/test_coordinates.py +4 -3
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/cst/conftest.py +4 -3
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/stf/test_stf.py +4 -3
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/stf/test_stf_gen.py +4 -3
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/test_fileHandling.py +16 -5
- pyradplan-0.2.0/pyRadPlan/io/__init__.py +0 -4
- {pyradplan-0.2.0 → pyradplan-0.2.1}/LICENSE +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/README.md +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/docs/conf.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/core/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/core/_exceptions.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/core/_grids.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/core/datamodel.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/core/np2sitk.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/core/resample.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/cst/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/cst/_cst.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/cst/_voi.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/ct/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/ct/_ct.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/ct/_hlut.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/data/machines/carbon_Generic.mat +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/data/machines/helium_Generic.mat +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/data/machines/photons_Generic.mat +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/data/machines/protons_Generic.mat +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/data/phantoms/TG119.mat +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/data/stf/matRad_stf.mat +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/data/stf/matRad_stf_onebeam.mat +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/data/stf/matrad_stf_onebeam.mat +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/dij/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/dij/_dij.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/dose/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/dose/_calc_dose.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/dose/engines/_base_pencilbeam_particle.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/dose/engines/_factory.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/dose/engines/_hongpb.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/dose/engines/_svdpb.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/geometry/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/geometry/lps.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/io/_matlab_file_handler.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/io/matfile.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/machines/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/machines/_base.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/machines/_ions.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/machines/_photons.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/machines/_validate.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/matRad/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/matRad/_engine.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/matRad/_matlab.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/matRad/_octave.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/_fluence_optimization.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_eud.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_factory.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_max_dvh.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_mean.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_min_dvh.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_objective.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_squared_dev.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_squared_over.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_squared_under.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_std.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/problems/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/problems/_factory.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/problems/_nonlin_fluence.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/problems/_optiprob.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/problems/_simple_least_squares.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/solvers/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/solvers/_base_solvers.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/solvers/_factory.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/solvers/_ipopt.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/solvers/_scipy_solver.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/plan/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/plan/_plans.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/quantities/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/quantities/_base.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/quantities/_dose.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/raytracer/_siddon.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/scenarios/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/scenarios/_base.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/scenarios/_nominal.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/stf/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/stf/_beam.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/stf/_beamlet.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/stf/_exceptions.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/stf/_generate_stf.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/stf/_rangeshifter.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/stf/_ray.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/stf/_steeringinformation.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/stf/generators/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/stf/generators/_base.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/stf/generators/_externalbeam.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/stf/generators/_factory.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/stf/generators/_ions.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/stf/generators/_photons.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/util/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/util/helpers.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/visualization/__init__.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/visualization/_plot_slice.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan.egg-info/SOURCES.txt +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan.egg-info/dependency_links.txt +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan.egg-info/requires.txt +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan.egg-info/top_level.txt +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/setup.cfg +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/core/test_np2sitk.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/core/test_resample.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/cst/test_VOI.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/cst/test_cst.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/ct/test_ct.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/ct/test_hlut.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/dose/test_dose_particle.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/dose/test_dose_photon.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/geometry/test_lps.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/optimization/test_fluence_optiprob.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/optimization/test_ipopt_solver.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/optimization/test_objectives.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/optimization/test_problem_factory.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/optimization/test_scipy_solver.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/optimization/test_solver_factory.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/quantities/test_dose_quantity.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/stf/test_beamlet.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/test_dij.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/test_grid.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/test_helpers.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/test_machine_model.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/test_matlabEngine.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/test_octaveEngine.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/test_plan.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/test_raytracersiddon.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/test_scenarios.py +0 -0
- {pyradplan-0.2.0 → pyradplan-0.2.1}/test/visualization/test_plot_slice.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: pyRadPlan
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: A python interface and reimplementation to matRad
|
|
5
5
|
Author-email: Niklas Wahl <n.wahl@dkfz-heidelberg.de>, Goran Stanic <goran.stanic@dkfz-heidelberg.de>, Tim Ortkamp <tim.ortkamp@kit.edu>, Tobias Becher <t.becher@dkfz-heidelberg.de>, Lina Bucher <lina.bucher@dkfz-heidelberg.de>, Florian Leininger <florian.leininger@dkfz-heidelberg.de>, Antonios Kontopoulos <antonios.kontopoulos@dkfz-heidelberg.de>
|
|
6
6
|
Maintainer-email: Niklas Wahl <n.wahl@dkfz-heidelberg.de>, Goran Stanic <goran.stanic@dkfz-heidelberg.de>, Tim Ortkamp <tim.ortkamp@kit.edu>, Tobias Becher <t.becher@dkfz-heidelberg.de>
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
-
try:
|
|
4
|
-
from importlib import resources # Standard from Python 3.9+
|
|
5
|
-
except ImportError:
|
|
6
|
-
import importlib_resources as resources # Backport for older versions
|
|
7
|
-
|
|
8
3
|
import numpy as np
|
|
9
4
|
|
|
10
5
|
from pyRadPlan import (
|
|
11
6
|
IonPlan,
|
|
12
|
-
|
|
7
|
+
load_tg119,
|
|
13
8
|
generate_stf,
|
|
14
9
|
calc_dose_influence,
|
|
15
10
|
fluence_optimization,
|
|
@@ -18,9 +13,8 @@ from pyRadPlan import (
|
|
|
18
13
|
|
|
19
14
|
logging.basicConfig(level=logging.INFO)
|
|
20
15
|
|
|
21
|
-
#
|
|
22
|
-
|
|
23
|
-
ct, cst = load_patient(path)
|
|
16
|
+
# Load TG119 (provided within pyRadPlan)
|
|
17
|
+
ct, cst = load_tg119()
|
|
24
18
|
|
|
25
19
|
# Create a plan object
|
|
26
20
|
pln = IonPlan(radiation_mode="carbon", machine="Generic")
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
-
try:
|
|
4
|
-
from importlib import resources # Standard from Python 3.9+
|
|
5
|
-
except ImportError:
|
|
6
|
-
import importlib_resources as resources # Backport for older versions
|
|
7
3
|
import numpy as np
|
|
8
4
|
|
|
9
5
|
from pyRadPlan import (
|
|
10
6
|
IonPlan,
|
|
11
|
-
|
|
7
|
+
load_tg119,
|
|
12
8
|
generate_stf,
|
|
13
9
|
calc_dose_influence,
|
|
14
10
|
fluence_optimization,
|
|
@@ -17,9 +13,8 @@ from pyRadPlan import (
|
|
|
17
13
|
|
|
18
14
|
logging.basicConfig(level=logging.INFO)
|
|
19
15
|
|
|
20
|
-
#
|
|
21
|
-
|
|
22
|
-
ct, cst = load_patient(path)
|
|
16
|
+
# Load TG119 (provided within pyRadPlan)
|
|
17
|
+
ct, cst = load_tg119()
|
|
23
18
|
|
|
24
19
|
# Create a plan object
|
|
25
20
|
pln = IonPlan(radiation_mode="helium", machine="Generic")
|
|
@@ -8,11 +8,12 @@ calling the RayTracer.
|
|
|
8
8
|
|
|
9
9
|
# Standard Library Imports
|
|
10
10
|
import logging
|
|
11
|
+
import sys
|
|
11
12
|
|
|
12
|
-
|
|
13
|
-
from importlib import resources # Standard from Python 3.9+
|
|
14
|
-
except ImportError:
|
|
13
|
+
if sys.version_info < (3, 10):
|
|
15
14
|
import importlib_resources as resources # Backport for older versions
|
|
15
|
+
else:
|
|
16
|
+
from importlib import resources # Standard from Python 3.9+
|
|
16
17
|
|
|
17
18
|
# Third Party Imports from pyRadPlan requirements
|
|
18
19
|
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
-
try:
|
|
4
|
-
from importlib import resources # Standard from Python 3.9+
|
|
5
|
-
except ImportError:
|
|
6
|
-
import importlib_resources as resources # Backport for older versions
|
|
7
|
-
|
|
8
3
|
import numpy as np
|
|
9
4
|
|
|
10
5
|
from pyRadPlan import (
|
|
11
6
|
PhotonPlan,
|
|
12
|
-
|
|
7
|
+
load_tg119,
|
|
13
8
|
generate_stf,
|
|
14
9
|
calc_dose_influence,
|
|
15
10
|
fluence_optimization,
|
|
@@ -20,9 +15,8 @@ from pyRadPlan.optimization.objectives import SquaredDeviation, SquaredOverdosin
|
|
|
20
15
|
|
|
21
16
|
logging.basicConfig(level=logging.INFO)
|
|
22
17
|
|
|
23
|
-
#
|
|
24
|
-
|
|
25
|
-
ct, cst = load_patient(path)
|
|
18
|
+
# Load TG119 (provided within pyRadPlan)
|
|
19
|
+
ct, cst = load_tg119()
|
|
26
20
|
|
|
27
21
|
# Create a plan object
|
|
28
22
|
pln = PhotonPlan(machine="Generic")
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
|
|
3
|
-
try:
|
|
4
|
-
from importlib import resources # Standard from Python 3.9+
|
|
5
|
-
except ImportError:
|
|
6
|
-
import importlib_resources as resources # Backport for older versions
|
|
7
|
-
|
|
8
3
|
import numpy as np
|
|
9
4
|
|
|
10
5
|
from pyRadPlan import (
|
|
@@ -13,16 +8,15 @@ from pyRadPlan import (
|
|
|
13
8
|
calc_dose_influence,
|
|
14
9
|
fluence_optimization,
|
|
15
10
|
plot_slice,
|
|
16
|
-
|
|
11
|
+
load_tg119,
|
|
17
12
|
)
|
|
18
13
|
|
|
19
14
|
from pyRadPlan.optimization.objectives import SquaredDeviation, SquaredOverdosing, MeanDose
|
|
20
15
|
|
|
21
16
|
logging.basicConfig(level=logging.INFO)
|
|
22
17
|
|
|
23
|
-
#
|
|
24
|
-
|
|
25
|
-
ct, cst = load_patient(path)
|
|
18
|
+
# Load TG119 (provided within pyRadPlan)
|
|
19
|
+
ct, cst = load_tg119()
|
|
26
20
|
|
|
27
21
|
# Create a plan object
|
|
28
22
|
pln = IonPlan(radiation_mode="protons", machine="Generic")
|
|
@@ -11,7 +11,7 @@ from .stf import SteeringInformation, validate_stf
|
|
|
11
11
|
from .dose._calc_dose import calc_dose_influence, calc_dose_forward
|
|
12
12
|
from .optimization._fluence_optimization import fluence_optimization
|
|
13
13
|
from .visualization import plot_slice
|
|
14
|
-
from .io import load_patient
|
|
14
|
+
from .io import load_patient, load_tg119
|
|
15
15
|
|
|
16
16
|
try:
|
|
17
17
|
__version__ = version(__name__)
|
|
@@ -40,4 +40,5 @@ __all__ = [
|
|
|
40
40
|
"validate_stf",
|
|
41
41
|
"plot_slice",
|
|
42
42
|
"load_patient",
|
|
43
|
+
"load_tg119",
|
|
43
44
|
]
|
|
@@ -2,10 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
if sys.version_info < (3, 10):
|
|
8
8
|
import importlib_resources as resources # Backport for older versions
|
|
9
|
+
else:
|
|
10
|
+
from importlib import resources # Standard from Python 3.9+
|
|
9
11
|
|
|
10
12
|
import warnings
|
|
11
13
|
import time
|
|
@@ -300,6 +300,8 @@ class PencilBeamEngineAbstract(DoseEngineBase):
|
|
|
300
300
|
|
|
301
301
|
self._computed_quantities.append(q_name)
|
|
302
302
|
|
|
303
|
+
self._effective_lateral_cutoff = self.geometric_lateral_cutoff
|
|
304
|
+
|
|
303
305
|
return dij
|
|
304
306
|
|
|
305
307
|
def _init_beam(
|
|
@@ -592,7 +594,9 @@ class PencilBeamEngineAbstract(DoseEngineBase):
|
|
|
592
594
|
return scen_ray
|
|
593
595
|
|
|
594
596
|
def _get_ray_geometry_from_beam(self, ray: dict[str], beam_info: dict[str]):
|
|
595
|
-
ray["effective_lateral_cut_off"] = beam_info
|
|
597
|
+
ray["effective_lateral_cut_off"] = beam_info.get(
|
|
598
|
+
"effective_lateral_cut_off", self._effective_lateral_cutoff
|
|
599
|
+
)
|
|
596
600
|
lateral_ray_cutoff = self._get_lateral_distance_from_dose_cutoff_on_ray(ray)
|
|
597
601
|
|
|
598
602
|
# Ray tracing for beam i and ray j
|
|
@@ -2,6 +2,12 @@ from typing import Optional
|
|
|
2
2
|
import os
|
|
3
3
|
import warnings
|
|
4
4
|
import logging
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
if sys.version_info < (3, 10):
|
|
8
|
+
import importlib_resources as resources # Backport for older versions
|
|
9
|
+
else:
|
|
10
|
+
from importlib import resources # Standard from Python 3.9+
|
|
5
11
|
|
|
6
12
|
from pyRadPlan.ct import validate_ct, CT
|
|
7
13
|
from pyRadPlan.cst import validate_cst, StructureSet
|
|
@@ -13,6 +19,22 @@ from . import matfile
|
|
|
13
19
|
logger = logging.getLogger(__name__)
|
|
14
20
|
|
|
15
21
|
|
|
22
|
+
def load_tg119() -> tuple[CT, StructureSet]:
|
|
23
|
+
"""
|
|
24
|
+
Load the included TG119 phantom.
|
|
25
|
+
|
|
26
|
+
This is a helper function to load the TG119 phantom included in the
|
|
27
|
+
package data using importlib.resources.
|
|
28
|
+
|
|
29
|
+
Returns
|
|
30
|
+
-------
|
|
31
|
+
tuple[CT, StructureSet]
|
|
32
|
+
The CT and StructureSet objects.
|
|
33
|
+
"""
|
|
34
|
+
phantom_data_str = resources.files("pyRadPlan.data.phantoms").joinpath("TG119.mat")
|
|
35
|
+
return load_patient(phantom_data_str)
|
|
36
|
+
|
|
37
|
+
|
|
16
38
|
def load_patient(
|
|
17
39
|
filename: os.PathLike,
|
|
18
40
|
extra_plan_data: Optional[dict] = None,
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import os
|
|
2
|
+
import sys
|
|
2
3
|
from typing import Union
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
from importlib import resources # Standard from Python 3.9+
|
|
6
|
-
except ImportError:
|
|
5
|
+
if sys.version_info < (3, 10):
|
|
7
6
|
import importlib_resources as resources # Backport for older versions
|
|
7
|
+
else:
|
|
8
|
+
from importlib import resources # Standard from Python 3.9+
|
|
8
9
|
|
|
9
10
|
from pymatreader import read_mat
|
|
10
11
|
from pyRadPlan.machines import Machine, validate_machine
|
|
@@ -4,10 +4,11 @@ from abc import ABC, abstractmethod
|
|
|
4
4
|
from typing import Union, Any
|
|
5
5
|
import logging
|
|
6
6
|
import time
|
|
7
|
-
|
|
7
|
+
|
|
8
8
|
import numpy as np
|
|
9
9
|
import SimpleITK as sitk
|
|
10
10
|
|
|
11
|
+
from pyRadPlan.core.np2sitk import linear_indices_to_image_coordinates
|
|
11
12
|
from pyRadPlan.geometry import lps
|
|
12
13
|
from pyRadPlan.stf._beam import Beam
|
|
13
14
|
|
|
@@ -140,17 +141,13 @@ class RayTracerBase(ABC):
|
|
|
140
141
|
the supplied images.
|
|
141
142
|
"""
|
|
142
143
|
|
|
143
|
-
if not isinstance(beam, Beam)
|
|
144
|
+
if not isinstance(beam, Beam):
|
|
144
145
|
beam = Beam.model_validate(beam)
|
|
145
|
-
else:
|
|
146
|
-
raise ValueError("Beam invalid. Must be dictionary or Beam object!")
|
|
147
146
|
|
|
148
147
|
logger.debug("Initializing geometry...")
|
|
149
148
|
t_trace_start = time.perf_counter()
|
|
150
149
|
self._initialize_geometry()
|
|
151
150
|
|
|
152
|
-
iso_center = beam.iso_center
|
|
153
|
-
|
|
154
151
|
# Obtain coordinates
|
|
155
152
|
cube_ix = np.arange(self.cubes[0].GetNumberOfPixels(), dtype=np.int64)
|
|
156
153
|
coords = linear_indices_to_image_coordinates(cube_ix, self.cubes[0], index_type="sitk")
|
|
@@ -159,19 +156,18 @@ class RayTracerBase(ABC):
|
|
|
159
156
|
rot_mat = lps.get_beam_rotation_matrix(beam.gantry_angle, beam.couch_angle)
|
|
160
157
|
|
|
161
158
|
# rotate coordinates
|
|
162
|
-
coords = (coords - iso_center) @ rot_mat - beam.source_point_bev
|
|
159
|
+
coords = (coords - beam.iso_center) @ rot_mat - beam.source_point_bev
|
|
163
160
|
t_trace_end = time.perf_counter()
|
|
164
161
|
logger.debug("took %s seconds!", t_trace_end - t_trace_start)
|
|
165
162
|
|
|
166
163
|
# central_ray_vector = np.array(iso_center) - np.array(source_point).reshape
|
|
167
164
|
logger.debug("Setting up Ray matrix...")
|
|
168
165
|
t_trace_start = time.perf_counter()
|
|
169
|
-
source_point = beam.source_point
|
|
170
|
-
# source_point_bev = beam["source_point_bev"]
|
|
171
166
|
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
167
|
+
ray_spacing = np.min(self._resolution) / np.sqrt(2.0, dtype=self.precision)
|
|
168
|
+
ray_matrix_bev_y = (
|
|
169
|
+
np.max(coords[:, 1]) + np.max(self._resolution) + beam.source_point_bev[1]
|
|
170
|
+
)
|
|
175
171
|
ray_matrix_scale = 1 + ray_matrix_bev_y / beam.sad
|
|
176
172
|
|
|
177
173
|
# num_candidate_rays = 2 * np.ceil(500.0 / ray_spacing).astype(np.int64) + 1
|
|
@@ -182,7 +178,9 @@ class RayTracerBase(ABC):
|
|
|
182
178
|
candidate_ray_coords_x, candidate_ray_coords_z = np.meshgrid(spacing_range, spacing_range)
|
|
183
179
|
|
|
184
180
|
# If we have reference positions, we use them to restrict the raytracing region
|
|
185
|
-
reference_positions_bev = ray_matrix_scale * np.array(
|
|
181
|
+
reference_positions_bev = ray_matrix_scale * np.array(
|
|
182
|
+
[ray.ray_pos_bev for ray in beam.rays]
|
|
183
|
+
)
|
|
186
184
|
|
|
187
185
|
# use a precompiled numba function to speed up the spatial lookup
|
|
188
186
|
candidate_ray_mx = fast_spatial_circle_lookup(
|
|
@@ -218,7 +216,7 @@ class RayTracerBase(ABC):
|
|
|
218
216
|
|
|
219
217
|
t_trace_start = time.perf_counter()
|
|
220
218
|
_, lengths, rho, d12, ix = self.trace_rays(
|
|
221
|
-
iso_center.reshape(1, 3), source_point.reshape(1, 3), ray_matrix_lps
|
|
219
|
+
beam.iso_center.reshape(1, 3), beam.source_point.reshape(1, 3), ray_matrix_lps
|
|
222
220
|
)
|
|
223
221
|
t_trace_end = time.perf_counter()
|
|
224
222
|
|
|
@@ -227,15 +225,6 @@ class RayTracerBase(ABC):
|
|
|
227
225
|
# Now we compute which rays will respectively give the voxel value for radiological depth
|
|
228
226
|
valid_ix = np.isfinite(ix)
|
|
229
227
|
|
|
230
|
-
# Obtain Voxel coordinates
|
|
231
|
-
t_index_transformation = time.perf_counter()
|
|
232
|
-
|
|
233
|
-
t_index_transformation_end = time.perf_counter()
|
|
234
|
-
logger.debug(
|
|
235
|
-
"Index transformation took %s seconds...",
|
|
236
|
-
t_index_transformation_end - t_index_transformation,
|
|
237
|
-
)
|
|
238
|
-
|
|
239
228
|
scale_factor = np.zeros_like(ix, dtype=self.precision)
|
|
240
229
|
scale_factor[valid_ix] = (ray_matrix_bev_y + beam.sad) / coords[ix[valid_ix], 1]
|
|
241
230
|
|
|
@@ -250,15 +239,11 @@ class RayTracerBase(ABC):
|
|
|
250
239
|
|
|
251
240
|
ray_selection = ray_spacing / 2.0
|
|
252
241
|
|
|
253
|
-
ix_remember_from_tracing =
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
ix_remember_from_tracing, z_dist > -ray_selection, out=ix_remember_from_tracing
|
|
259
|
-
)
|
|
260
|
-
np.logical_and(
|
|
261
|
-
ix_remember_from_tracing, z_dist <= ray_selection, out=ix_remember_from_tracing
|
|
242
|
+
ix_remember_from_tracing = (
|
|
243
|
+
(x_dist > -ray_selection)
|
|
244
|
+
& (x_dist <= ray_selection)
|
|
245
|
+
& (z_dist > -ray_selection)
|
|
246
|
+
& (z_dist <= ray_selection)
|
|
262
247
|
)
|
|
263
248
|
|
|
264
249
|
logger.debug(
|
|
@@ -26,8 +26,10 @@ def fast_spatial_circle_lookup(
|
|
|
26
26
|
"""
|
|
27
27
|
candidate_ray_mx = np.full(mesh_x.shape, False, dtype=np.bool_)
|
|
28
28
|
for i in prange(lookup_pos.shape[0]):
|
|
29
|
-
ix = (mesh_x - lookup_pos[i, 0]) ** 2 + (
|
|
30
|
-
|
|
29
|
+
ix = (mesh_x.ravel() - lookup_pos[i, 0]) ** 2 + (
|
|
30
|
+
mesh_z.ravel() - lookup_pos[i, 2]
|
|
31
|
+
) ** 2 <= radius**2
|
|
32
|
+
candidate_ray_mx.ravel()[ix] = 1
|
|
31
33
|
return candidate_ray_mx
|
|
32
34
|
|
|
33
35
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: pyRadPlan
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.1
|
|
4
4
|
Summary: A python interface and reimplementation to matRad
|
|
5
5
|
Author-email: Niklas Wahl <n.wahl@dkfz-heidelberg.de>, Goran Stanic <goran.stanic@dkfz-heidelberg.de>, Tim Ortkamp <tim.ortkamp@kit.edu>, Tobias Becher <t.becher@dkfz-heidelberg.de>, Lina Bucher <lina.bucher@dkfz-heidelberg.de>, Florian Leininger <florian.leininger@dkfz-heidelberg.de>, Antonios Kontopoulos <antonios.kontopoulos@dkfz-heidelberg.de>
|
|
6
6
|
Maintainer-email: Niklas Wahl <n.wahl@dkfz-heidelberg.de>, Goran Stanic <goran.stanic@dkfz-heidelberg.de>, Tim Ortkamp <tim.ortkamp@kit.edu>, Tobias Becher <t.becher@dkfz-heidelberg.de>
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
import pymatreader
|
|
3
|
+
import sys
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
from importlib import resources # Standard from Python 3.9+
|
|
6
|
-
except ImportError:
|
|
5
|
+
if sys.version_info < (3, 10):
|
|
7
6
|
import importlib_resources as resources # Backport for older versions
|
|
7
|
+
else:
|
|
8
|
+
from importlib import resources # Standard from Python 3.9+
|
|
8
9
|
|
|
9
10
|
|
|
10
11
|
@pytest.fixture
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
from typing import cast
|
|
2
2
|
import pytest
|
|
3
|
+
import sys
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
from importlib import resources # Standard from Python 3.9+
|
|
6
|
-
except ImportError:
|
|
5
|
+
if sys.version_info < (3, 10):
|
|
7
6
|
import importlib_resources as resources # Backport for older versions
|
|
7
|
+
else:
|
|
8
|
+
from importlib import resources # Standard from Python 3.9+
|
|
8
9
|
|
|
9
10
|
import SimpleITK as sitk
|
|
10
11
|
import numpy as np
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import pytest
|
|
2
|
+
import sys
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
from importlib import resources # Standard from Python 3.9+
|
|
5
|
-
except ImportError:
|
|
4
|
+
if sys.version_info < (3, 10):
|
|
6
5
|
import importlib_resources as resources # Backport for older versions
|
|
6
|
+
else:
|
|
7
|
+
from importlib import resources # Standard from Python 3.9+
|
|
7
8
|
import pymatreader
|
|
8
9
|
import numpy as np
|
|
9
10
|
import SimpleITK as sitk
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import pytest
|
|
2
|
+
import sys
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
from importlib import resources # Standard from Python 3.9+
|
|
5
|
-
except ImportError:
|
|
4
|
+
if sys.version_info < (3, 10):
|
|
6
5
|
import importlib_resources as resources # Backport for older versions
|
|
6
|
+
else:
|
|
7
|
+
from importlib import resources # Standard from Python 3.9+
|
|
7
8
|
|
|
8
9
|
import pymatreader
|
|
9
10
|
import numpy as np
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import pytest
|
|
2
|
+
import sys
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
from importlib import resources # Standard from Python 3.9+
|
|
5
|
-
except ImportError:
|
|
4
|
+
if sys.version_info < (3, 10):
|
|
6
5
|
import importlib_resources as resources # Backport for older versions
|
|
6
|
+
else:
|
|
7
|
+
from importlib import resources # Standard from Python 3.9+
|
|
7
8
|
|
|
8
9
|
import numpy as np
|
|
9
10
|
import SimpleITK as sitk
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import pytest
|
|
2
2
|
import os
|
|
3
|
+
import sys
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
from importlib import resources # Standard from Python 3.9+
|
|
6
|
-
except ImportError:
|
|
5
|
+
if sys.version_info < (3, 10):
|
|
7
6
|
import importlib_resources as resources # Backport for older versions
|
|
7
|
+
else:
|
|
8
|
+
from importlib import resources # Standard from Python 3.9+
|
|
8
9
|
|
|
9
10
|
from pyRadPlan.io._matlab_file_handler import MatlabFileHandler
|
|
10
11
|
import pyRadPlan.io.matfile as matfile
|
|
11
|
-
from pyRadPlan.io import load_patient
|
|
12
|
+
from pyRadPlan.io import load_patient, load_tg119
|
|
12
13
|
from pyRadPlan.ct import CT
|
|
13
14
|
from pyRadPlan.cst import StructureSet
|
|
14
15
|
|
|
@@ -45,13 +46,23 @@ def test_file_handler(tmp_path, tg119_path):
|
|
|
45
46
|
assert not os.path.exists(tmp_path.joinpath("cst.mat"))
|
|
46
47
|
|
|
47
48
|
|
|
48
|
-
def
|
|
49
|
+
def test_load_patient_from_file(tg119_path):
|
|
49
50
|
ct, cst = load_patient(tg119_path)
|
|
50
51
|
|
|
51
52
|
assert isinstance(ct, CT)
|
|
52
53
|
assert isinstance(cst, StructureSet)
|
|
53
54
|
|
|
54
55
|
|
|
56
|
+
def test_load_tg119(tg119_path):
|
|
57
|
+
ct, cst = load_patient(tg119_path)
|
|
58
|
+
ct2, cst2 = load_tg119()
|
|
59
|
+
|
|
60
|
+
assert isinstance(ct2, CT)
|
|
61
|
+
assert isinstance(cst2, StructureSet)
|
|
62
|
+
assert ct == ct2
|
|
63
|
+
assert cst == cst2
|
|
64
|
+
|
|
65
|
+
|
|
55
66
|
def test_load_file_extradata(tg119_path):
|
|
56
67
|
extra_data = {}
|
|
57
68
|
extra_plan_data = {}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{pyradplan-0.2.0 → pyradplan-0.2.1}/pyRadPlan/optimization/problems/_simple_least_squares.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|