pyRadPlan 0.1.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.1.0/pyRadPlan.egg-info → pyradplan-0.2.1}/PKG-INFO +4 -5
- {pyradplan-0.1.0 → pyradplan-0.2.1}/README.md +3 -4
- pyradplan-0.2.1/examples/carbon_pencilbeam.py +56 -0
- pyradplan-0.2.1/examples/helium_pencilbeam.py +46 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/examples/import_matrad_patient.py +21 -29
- pyradplan-0.2.1/examples/photon_pencilbeam.py +58 -0
- pyradplan-0.2.1/examples/proton_pencilbeam.py +54 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/__init__.py +7 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/core/__init__.py +2 -2
- pyradplan-0.2.1/pyRadPlan/core/_exceptions.py +5 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/ct/_ct.py +6 -9
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/ct/_hlut.py +1 -1
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/dij/_dij.py +13 -74
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/dose/__init__.py +2 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/dose/engines/__init__.py +1 -1
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/dose/engines/_base.py +51 -55
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/dose/engines/_base_pencilbeam.py +33 -33
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/dose/engines/_base_pencilbeam_particle.py +23 -32
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/dose/engines/_hongpb.py +6 -8
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/dose/engines/_svdpb.py +25 -19
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/geometry/__init__.py +2 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/geometry/lps.py +3 -0
- pyradplan-0.2.1/pyRadPlan/io/__init__.py +4 -0
- pyradplan-0.2.1/pyRadPlan/io/_matlab_file_handler.py +31 -0
- pyradplan-0.2.1/pyRadPlan/io/_patient_loader.py +135 -0
- pyradplan-0.2.1/pyRadPlan/io/matfile.py +35 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/machines/_load.py +4 -3
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/_fluence_optimization.py +1 -2
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/problems/_optiprob.py +3 -1
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/solvers/_base_solvers.py +5 -13
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/solvers/_ipopt.py +3 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/raytracer/__init__.py +2 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/raytracer/_base.py +30 -42
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/raytracer/_perf.py +4 -2
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/raytracer/_siddon.py +7 -40
- pyradplan-0.2.1/pyRadPlan/stf/__init__.py +23 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/stf/_beam.py +2 -2
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/stf/_beamlet.py +2 -3
- pyradplan-0.2.1/pyRadPlan/stf/_exceptions.py +10 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/stf/_generate_stf.py +7 -11
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/stf/_rangeshifter.py +2 -3
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/stf/_ray.py +9 -13
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/stf/_steeringinformation.py +6 -6
- {pyradplan-0.1.0/pyRadPlan/stf → pyradplan-0.2.1/pyRadPlan/stf/generators}/__init__.py +13 -16
- {pyradplan-0.1.0/pyRadPlan/stf → pyradplan-0.2.1/pyRadPlan/stf/generators}/_base.py +5 -18
- {pyradplan-0.1.0/pyRadPlan/stf → pyradplan-0.2.1/pyRadPlan/stf/generators}/_externalbeam.py +27 -5
- pyradplan-0.2.1/pyRadPlan/stf/generators/_factory.py +110 -0
- {pyradplan-0.1.0/pyRadPlan/stf → pyradplan-0.2.1/pyRadPlan/stf/generators}/_ions.py +24 -11
- {pyradplan-0.1.0/pyRadPlan/stf → pyradplan-0.2.1/pyRadPlan/stf/generators}/_photons.py +6 -36
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/util/helpers.py +3 -3
- pyradplan-0.2.1/pyRadPlan/visualization/__init__.py +5 -0
- pyradplan-0.2.1/pyRadPlan/visualization/_plot_slice.py +105 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1/pyRadPlan.egg-info}/PKG-INFO +4 -5
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan.egg-info/SOURCES.txt +13 -10
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyproject.toml +3 -3
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/conftest.py +4 -3
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/core/test_coordinates.py +6 -9
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/cst/conftest.py +4 -3
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/cst/test_cst.py +3 -3
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/stf/test_stf.py +8 -9
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/stf/test_stf_gen.py +33 -11
- pyradplan-0.2.1/test/test_fileHandling.py +79 -0
- pyradplan-0.2.1/test/visualization/test_plot_slice.py +85 -0
- pyradplan-0.1.0/examples/carbon_pencilbeam.py +0 -92
- pyradplan-0.1.0/examples/helium_pencilbeam.py +0 -84
- pyradplan-0.1.0/examples/photon_pencilbeam.py +0 -98
- pyradplan-0.1.0/examples/proton_pencilbeam.py +0 -94
- pyradplan-0.1.0/pyRadPlan/core/_exceptions.py +0 -9
- pyradplan-0.1.0/pyRadPlan/io/__init__.py +0 -3
- pyradplan-0.1.0/pyRadPlan/io/matLabFileHandler.py +0 -25
- pyradplan-0.1.0/pyRadPlan/io/matRad.py +0 -22
- pyradplan-0.1.0/pyRadPlan/io/readHLUT.py +0 -16
- pyradplan-0.1.0/pyRadPlan/stf/_exceptions.py +0 -14
- pyradplan-0.1.0/pyRadPlan/stf/base_matrad.py +0 -9
- pyradplan-0.1.0/pyRadPlan/stf/loadHLUT.py +0 -62
- pyradplan-0.1.0/test/test_fileHandling.py +0 -39
- {pyradplan-0.1.0 → pyradplan-0.2.1}/LICENSE +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/docs/conf.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/core/_grids.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/core/datamodel.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/core/np2sitk.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/core/resample.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/cst/__init__.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/cst/_cst.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/cst/_voi.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/ct/__init__.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/data/machines/carbon_Generic.mat +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/data/machines/helium_Generic.mat +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/data/machines/photons_Generic.mat +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/data/machines/protons_Generic.mat +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/data/phantoms/TG119.mat +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/data/stf/matRad_stf.mat +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/data/stf/matRad_stf_onebeam.mat +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/data/stf/matrad_stf_onebeam.mat +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/dij/__init__.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/dose/_calc_dose.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/dose/engines/_factory.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/machines/__init__.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/machines/_base.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/machines/_ions.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/machines/_photons.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/machines/_validate.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/matRad/__init__.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/matRad/_engine.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/matRad/_matlab.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/matRad/_octave.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/__init__.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/__init__.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_eud.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_factory.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_max_dvh.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_mean.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_min_dvh.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_objective.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_squared_dev.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_squared_over.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_squared_under.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/objectives/_std.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/problems/__init__.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/problems/_factory.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/problems/_nonlin_fluence.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/problems/_simple_least_squares.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/solvers/__init__.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/solvers/_factory.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/optimization/solvers/_scipy_solver.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/plan/__init__.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/plan/_plans.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/quantities/__init__.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/quantities/_base.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/quantities/_dose.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/scenarios/__init__.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/scenarios/_base.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/scenarios/_nominal.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan/util/__init__.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan.egg-info/dependency_links.txt +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan.egg-info/requires.txt +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/pyRadPlan.egg-info/top_level.txt +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/setup.cfg +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/core/test_np2sitk.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/core/test_resample.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/cst/test_VOI.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/ct/test_ct.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/ct/test_hlut.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/dose/test_dose_particle.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/dose/test_dose_photon.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/geometry/test_lps.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/optimization/test_fluence_optiprob.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/optimization/test_ipopt_solver.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/optimization/test_objectives.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/optimization/test_problem_factory.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/optimization/test_scipy_solver.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/optimization/test_solver_factory.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/quantities/test_dose_quantity.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/stf/test_beamlet.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/test_dij.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/test_grid.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/test_helpers.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/test_machine_model.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/test_matlabEngine.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/test_octaveEngine.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/test_plan.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/test_raytracersiddon.py +0 -0
- {pyradplan-0.1.0 → pyradplan-0.2.1}/test/test_scenarios.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.2
|
|
2
2
|
Name: pyRadPlan
|
|
3
|
-
Version: 0.1
|
|
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>
|
|
@@ -63,12 +63,11 @@ A minimal script is very similar to matRad's example [`matRad.m`](https://github
|
|
|
63
63
|
```python
|
|
64
64
|
from importlib import resources
|
|
65
65
|
import pymatreader
|
|
66
|
-
from pyRadPlan import
|
|
66
|
+
from pyRadPlan import load_patient, IonPlan, generate_stf, calc_dose_influence, fluence_optimization
|
|
67
67
|
|
|
68
68
|
# Read patient from provided TG119.mat file and validate data
|
|
69
|
-
|
|
70
|
-
ct =
|
|
71
|
-
cst = validate_cst(phantom["cst"], ct=ct)
|
|
69
|
+
tg119_path = resources.files("pyRadPlan.data.phantoms").joinpath("TG119.mat")
|
|
70
|
+
ct, cst = load_patient(tg119_path)
|
|
72
71
|
|
|
73
72
|
# Create a plan object
|
|
74
73
|
pln = IonPlan(radiation_mode="protons", machine="Generic")
|
|
@@ -19,12 +19,11 @@ A minimal script is very similar to matRad's example [`matRad.m`](https://github
|
|
|
19
19
|
```python
|
|
20
20
|
from importlib import resources
|
|
21
21
|
import pymatreader
|
|
22
|
-
from pyRadPlan import
|
|
22
|
+
from pyRadPlan import load_patient, IonPlan, generate_stf, calc_dose_influence, fluence_optimization
|
|
23
23
|
|
|
24
24
|
# Read patient from provided TG119.mat file and validate data
|
|
25
|
-
|
|
26
|
-
ct =
|
|
27
|
-
cst = validate_cst(phantom["cst"], ct=ct)
|
|
25
|
+
tg119_path = resources.files("pyRadPlan.data.phantoms").joinpath("TG119.mat")
|
|
26
|
+
ct, cst = load_patient(tg119_path)
|
|
28
27
|
|
|
29
28
|
# Create a plan object
|
|
30
29
|
pln = IonPlan(radiation_mode="protons", machine="Generic")
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
from pyRadPlan import (
|
|
6
|
+
IonPlan,
|
|
7
|
+
load_tg119,
|
|
8
|
+
generate_stf,
|
|
9
|
+
calc_dose_influence,
|
|
10
|
+
fluence_optimization,
|
|
11
|
+
plot_slice,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
logging.basicConfig(level=logging.INFO)
|
|
15
|
+
|
|
16
|
+
# Load TG119 (provided within pyRadPlan)
|
|
17
|
+
ct, cst = load_tg119()
|
|
18
|
+
|
|
19
|
+
# Create a plan object
|
|
20
|
+
pln = IonPlan(radiation_mode="carbon", machine="Generic")
|
|
21
|
+
pln.prop_stf = {"bixel_width": 4}
|
|
22
|
+
pln.prop_dose_calc = {"calc_bio_dose": True}
|
|
23
|
+
pln.prop_opt = {"solver": "scipy"}
|
|
24
|
+
|
|
25
|
+
# Generate Steering Geometry ("stf")
|
|
26
|
+
stf = generate_stf(ct, cst, pln)
|
|
27
|
+
|
|
28
|
+
# Calculate Dose Influence Matrix ("dij")
|
|
29
|
+
dij = calc_dose_influence(ct, cst, stf, pln)
|
|
30
|
+
|
|
31
|
+
# Optimize
|
|
32
|
+
fluence = fluence_optimization(ct, cst, stf, dij, pln)
|
|
33
|
+
|
|
34
|
+
# Result
|
|
35
|
+
result = dij.compute_result_ct_grid(fluence)
|
|
36
|
+
|
|
37
|
+
# Choose a slice to visualize
|
|
38
|
+
view_slice = int(np.round(ct.size[2] / 2))
|
|
39
|
+
|
|
40
|
+
# Visualize
|
|
41
|
+
plot_slice(
|
|
42
|
+
ct=ct,
|
|
43
|
+
cst=cst,
|
|
44
|
+
overlay=result["physical_dose"],
|
|
45
|
+
view_slice=view_slice,
|
|
46
|
+
plane="axial",
|
|
47
|
+
overlay_unit="Gy",
|
|
48
|
+
)
|
|
49
|
+
plot_slice(
|
|
50
|
+
ct=ct,
|
|
51
|
+
cst=cst,
|
|
52
|
+
overlay=result["effect"],
|
|
53
|
+
view_slice=view_slice,
|
|
54
|
+
plane="axial",
|
|
55
|
+
overlay_unit="dimensionless",
|
|
56
|
+
)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
from pyRadPlan import (
|
|
6
|
+
IonPlan,
|
|
7
|
+
load_tg119,
|
|
8
|
+
generate_stf,
|
|
9
|
+
calc_dose_influence,
|
|
10
|
+
fluence_optimization,
|
|
11
|
+
plot_slice,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
logging.basicConfig(level=logging.INFO)
|
|
15
|
+
|
|
16
|
+
# Load TG119 (provided within pyRadPlan)
|
|
17
|
+
ct, cst = load_tg119()
|
|
18
|
+
|
|
19
|
+
# Create a plan object
|
|
20
|
+
pln = IonPlan(radiation_mode="helium", machine="Generic")
|
|
21
|
+
pln.prop_stf = {"bixel_width": 4}
|
|
22
|
+
|
|
23
|
+
# Generate Steering Geometry ("stf")
|
|
24
|
+
stf = generate_stf(ct, cst, pln)
|
|
25
|
+
|
|
26
|
+
# Calculate Dose Influence Matrix ("dij")
|
|
27
|
+
dij = calc_dose_influence(ct, cst, stf, pln)
|
|
28
|
+
|
|
29
|
+
# Optimize
|
|
30
|
+
fluence = fluence_optimization(ct, cst, stf, dij, pln)
|
|
31
|
+
|
|
32
|
+
# Result
|
|
33
|
+
result = dij.compute_result_ct_grid(fluence)
|
|
34
|
+
|
|
35
|
+
# Choose a slice to visualize
|
|
36
|
+
view_slice = int(np.round(ct.size[2] / 2))
|
|
37
|
+
|
|
38
|
+
# Visualize
|
|
39
|
+
plot_slice(
|
|
40
|
+
ct=ct,
|
|
41
|
+
cst=cst,
|
|
42
|
+
overlay=result["physical_dose"],
|
|
43
|
+
view_slice=view_slice,
|
|
44
|
+
plane="axial",
|
|
45
|
+
overlay_unit="Gy",
|
|
46
|
+
)
|
|
@@ -8,37 +8,34 @@ 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
|
+
|
|
19
20
|
import numpy as np
|
|
20
21
|
import SimpleITK as sitk
|
|
21
22
|
import matplotlib.pyplot as plt
|
|
22
23
|
|
|
23
24
|
# pyRadPlan Module Imports
|
|
24
|
-
from pyRadPlan.ct import
|
|
25
|
-
from pyRadPlan.cst import validate_cst
|
|
25
|
+
from pyRadPlan.ct import default_hlut
|
|
26
26
|
from pyRadPlan.plan import IonPlan
|
|
27
|
-
from pyRadPlan.stf import StfGeneratorIMPT
|
|
27
|
+
from pyRadPlan.stf.generators import StfGeneratorIMPT
|
|
28
28
|
from pyRadPlan.raytracer import RayTracerSiddon
|
|
29
|
+
from pyRadPlan.visualization import plot_slice
|
|
30
|
+
from pyRadPlan.io import load_patient
|
|
29
31
|
|
|
30
32
|
# Configure the Logger to show you debug information
|
|
31
33
|
logging.basicConfig(level=logging.INFO)
|
|
32
34
|
logging.getLogger("pyRadPlan").setLevel(logging.DEBUG)
|
|
33
35
|
|
|
34
|
-
#
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
tmp = pymatreader.read_mat(path)
|
|
38
|
-
|
|
39
|
-
# The validation functions for ct and cst allow us to create valid CTs and StructureSets
|
|
40
|
-
ct = validate_ct(tmp["ct"])
|
|
41
|
-
cst = validate_cst(tmp["cst"], ct=ct)
|
|
36
|
+
# Read patient from provided TG119.mat file and validate data
|
|
37
|
+
path = resources.files("pyRadPlan.data.phantoms").joinpath("TG119.mat")
|
|
38
|
+
ct, cst = load_patient(path)
|
|
42
39
|
|
|
43
40
|
# Choose a slice to visualize
|
|
44
41
|
view_slice = int(np.round(ct.size[2] / 2))
|
|
@@ -89,18 +86,13 @@ min_rad_depth = np.min(rd_np)
|
|
|
89
86
|
max_rad_depth = np.nanmax(rd_np)
|
|
90
87
|
print(f"Minimum rad depth: {min_rad_depth}Maximum rad depth: {max_rad_depth}")
|
|
91
88
|
|
|
92
|
-
#
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
89
|
+
# Visualize
|
|
90
|
+
plot_slice(
|
|
91
|
+
ct=ct,
|
|
92
|
+
cst=cst,
|
|
93
|
+
overlay=rd_np,
|
|
94
|
+
view_slice=view_slice,
|
|
95
|
+
plane="axial",
|
|
96
|
+
overlay_unit="mm",
|
|
97
|
+
overlay_rel_threshold=1e-3,
|
|
101
98
|
)
|
|
102
|
-
|
|
103
|
-
# And finally, output!
|
|
104
|
-
plt.draw()
|
|
105
|
-
plt.pause(0.001)
|
|
106
|
-
plt.show()
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
from pyRadPlan import (
|
|
6
|
+
PhotonPlan,
|
|
7
|
+
load_tg119,
|
|
8
|
+
generate_stf,
|
|
9
|
+
calc_dose_influence,
|
|
10
|
+
fluence_optimization,
|
|
11
|
+
plot_slice,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
from pyRadPlan.optimization.objectives import SquaredDeviation, SquaredOverdosing, MeanDose
|
|
15
|
+
|
|
16
|
+
logging.basicConfig(level=logging.INFO)
|
|
17
|
+
|
|
18
|
+
# Load TG119 (provided within pyRadPlan)
|
|
19
|
+
ct, cst = load_tg119()
|
|
20
|
+
|
|
21
|
+
# Create a plan object
|
|
22
|
+
pln = PhotonPlan(machine="Generic")
|
|
23
|
+
num_of_beams = 5
|
|
24
|
+
pln.prop_stf = {
|
|
25
|
+
"gantry_angles": np.linspace(0, 360, num_of_beams, endpoint=False),
|
|
26
|
+
"couch_angles": np.zeros((num_of_beams,)),
|
|
27
|
+
}
|
|
28
|
+
# Generate Steering Geometry ("stf")
|
|
29
|
+
stf = generate_stf(ct, cst, pln)
|
|
30
|
+
|
|
31
|
+
# Calculate Dose Influence Matrix ("dij")
|
|
32
|
+
dij = calc_dose_influence(ct, cst, stf, pln)
|
|
33
|
+
|
|
34
|
+
# Optimize
|
|
35
|
+
cst.vois[1].objectives = [SquaredDeviation(priority=1000.0, d_ref=3.0)] # Target
|
|
36
|
+
cst.vois[0].objectives = [SquaredOverdosing(priority=100.0, d_max=1.0)] # OAR
|
|
37
|
+
cst.vois[2].objectives = [
|
|
38
|
+
MeanDose(priority=1.0, d_ref=0.0),
|
|
39
|
+
SquaredOverdosing(priority=10.0, d_max=2.0),
|
|
40
|
+
] # BODY
|
|
41
|
+
|
|
42
|
+
fluence = fluence_optimization(ct, cst, stf, dij, pln)
|
|
43
|
+
|
|
44
|
+
# Result
|
|
45
|
+
result = dij.compute_result_ct_grid(fluence)
|
|
46
|
+
|
|
47
|
+
# Choose a slice to visualize
|
|
48
|
+
view_slice = int(np.round(ct.size[2] / 2))
|
|
49
|
+
|
|
50
|
+
# Visualize
|
|
51
|
+
plot_slice(
|
|
52
|
+
ct=ct,
|
|
53
|
+
cst=cst,
|
|
54
|
+
overlay=result["physical_dose"],
|
|
55
|
+
view_slice=view_slice,
|
|
56
|
+
plane="axial",
|
|
57
|
+
overlay_unit="Gy",
|
|
58
|
+
)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import logging
|
|
2
|
+
|
|
3
|
+
import numpy as np
|
|
4
|
+
|
|
5
|
+
from pyRadPlan import (
|
|
6
|
+
IonPlan,
|
|
7
|
+
generate_stf,
|
|
8
|
+
calc_dose_influence,
|
|
9
|
+
fluence_optimization,
|
|
10
|
+
plot_slice,
|
|
11
|
+
load_tg119,
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
from pyRadPlan.optimization.objectives import SquaredDeviation, SquaredOverdosing, MeanDose
|
|
15
|
+
|
|
16
|
+
logging.basicConfig(level=logging.INFO)
|
|
17
|
+
|
|
18
|
+
# Load TG119 (provided within pyRadPlan)
|
|
19
|
+
ct, cst = load_tg119()
|
|
20
|
+
|
|
21
|
+
# Create a plan object
|
|
22
|
+
pln = IonPlan(radiation_mode="protons", machine="Generic")
|
|
23
|
+
pln.prop_opt = {"solver": "scipy"}
|
|
24
|
+
|
|
25
|
+
# Generate Steering Geometry ("stf")
|
|
26
|
+
stf = generate_stf(ct, cst, pln)
|
|
27
|
+
|
|
28
|
+
# Calculate Dose Influence Matrix ("dij")
|
|
29
|
+
dij = calc_dose_influence(ct, cst, stf, pln)
|
|
30
|
+
|
|
31
|
+
# Optimization
|
|
32
|
+
cst.vois[1].objectives = [SquaredDeviation(priority=100.0, d_ref=3.0)] # Target
|
|
33
|
+
cst.vois[0].objectives = [SquaredOverdosing(priority=10.0, d_max=1.0)] # OAR
|
|
34
|
+
cst.vois[2].objectives = [
|
|
35
|
+
MeanDose(priority=1.0, d_ref=0.0),
|
|
36
|
+
SquaredOverdosing(priority=10.0, d_max=2.0),
|
|
37
|
+
] # BODY
|
|
38
|
+
fluence = fluence_optimization(ct, cst, stf, dij, pln)
|
|
39
|
+
|
|
40
|
+
# Result
|
|
41
|
+
result = dij.compute_result_ct_grid(fluence)
|
|
42
|
+
|
|
43
|
+
# Choose a slice to visualize
|
|
44
|
+
view_slice = int(np.round(ct.size[2] / 2))
|
|
45
|
+
|
|
46
|
+
# Visualize
|
|
47
|
+
plot_slice(
|
|
48
|
+
ct=ct,
|
|
49
|
+
cst=cst,
|
|
50
|
+
overlay=result["physical_dose"],
|
|
51
|
+
view_slice=view_slice,
|
|
52
|
+
plane="axial",
|
|
53
|
+
overlay_unit="Gy",
|
|
54
|
+
)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"""pyRadPlan is a Python package for radiation therapy treatment planning.""" # noqa: N999
|
|
2
|
+
|
|
1
3
|
from importlib.metadata import version, PackageNotFoundError
|
|
2
4
|
import logging
|
|
3
5
|
|
|
@@ -8,6 +10,8 @@ from .stf._generate_stf import generate_stf
|
|
|
8
10
|
from .stf import SteeringInformation, validate_stf
|
|
9
11
|
from .dose._calc_dose import calc_dose_influence, calc_dose_forward
|
|
10
12
|
from .optimization._fluence_optimization import fluence_optimization
|
|
13
|
+
from .visualization import plot_slice
|
|
14
|
+
from .io import load_patient, load_tg119
|
|
11
15
|
|
|
12
16
|
try:
|
|
13
17
|
__version__ = version(__name__)
|
|
@@ -34,4 +38,7 @@ __all__ = [
|
|
|
34
38
|
"fluence_optimization",
|
|
35
39
|
"SteeringInformation",
|
|
36
40
|
"validate_stf",
|
|
41
|
+
"plot_slice",
|
|
42
|
+
"load_patient",
|
|
43
|
+
"load_tg119",
|
|
37
44
|
]
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"""Core module with fundamental classes and functions for pyRadPlan."""
|
|
2
2
|
|
|
3
|
-
from ._exceptions import
|
|
3
|
+
from ._exceptions import PyRadPlanError
|
|
4
4
|
from .datamodel import PyRadPlanBaseModel
|
|
5
5
|
from .resample import resample_image, resample_numpy_array
|
|
6
6
|
from ._grids import Grid
|
|
7
7
|
|
|
8
8
|
__all__ = [
|
|
9
|
-
"
|
|
9
|
+
"PyRadPlanError",
|
|
10
10
|
"np2sitk",
|
|
11
11
|
"resample_image",
|
|
12
12
|
"resample_numpy_array",
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
"""Module for handling CT images in pyRadPlan.
|
|
2
|
-
|
|
1
|
+
"""Module for handling CT images in pyRadPlan.
|
|
2
|
+
|
|
3
|
+
Defines a CT pydantic model and factories.
|
|
3
4
|
"""
|
|
4
5
|
|
|
5
6
|
import os
|
|
@@ -318,19 +319,15 @@ class CT(PyRadPlanBaseModel, ABC):
|
|
|
318
319
|
-------
|
|
319
320
|
np.ndarray
|
|
320
321
|
The converted cube coordinates.
|
|
321
|
-
|
|
322
|
-
Example Usage
|
|
323
|
-
-------------
|
|
324
|
-
>>> worlds_coords = beam.iso_center
|
|
325
322
|
"""
|
|
326
323
|
|
|
327
324
|
return np.array(self.cube_hu.TransformPhysicalPointToIndex(world_coords))
|
|
328
325
|
|
|
329
326
|
def compute_wet(self, hlut: np.ndarray) -> sitk.Image:
|
|
330
327
|
"""
|
|
331
|
-
Compute the water equivalent thickness (WET)
|
|
332
|
-
|
|
333
|
-
Hounsfield Look-Up Table (HLUT).
|
|
328
|
+
Compute the water equivalent thickness (WET).
|
|
329
|
+
|
|
330
|
+
Uses a provided appropriate Hounsfield Look-Up Table (HLUT).
|
|
334
331
|
|
|
335
332
|
Parameters
|
|
336
333
|
----------
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
"""
|
|
2
|
-
This module contains the dij class, which represents a (collection of)
|
|
3
|
-
influence matrices.
|
|
4
|
-
"""
|
|
1
|
+
"""Contains the dij class as a (collection of) influence matrices."""
|
|
5
2
|
|
|
6
3
|
from typing import Any, Union, Annotated, cast
|
|
7
4
|
from pydantic import (
|
|
@@ -26,8 +23,7 @@ from pyRadPlan.util import swap_orientation_sparse_matrix
|
|
|
26
23
|
|
|
27
24
|
class Dij(PyRadPlanBaseModel):
|
|
28
25
|
"""
|
|
29
|
-
|
|
30
|
-
(DIJ) for a given plan.
|
|
26
|
+
Collection of Dose (or other quantity) Influence Matrices.
|
|
31
27
|
|
|
32
28
|
Attributes
|
|
33
29
|
----------
|
|
@@ -71,7 +67,7 @@ class Dij(PyRadPlanBaseModel):
|
|
|
71
67
|
@classmethod
|
|
72
68
|
def validate_matrices(cls, v: Any, info: ValidationInfo) -> np.ndarray:
|
|
73
69
|
"""
|
|
74
|
-
|
|
70
|
+
Validate the physical dose matrix.
|
|
75
71
|
|
|
76
72
|
Raises
|
|
77
73
|
------
|
|
@@ -112,7 +108,7 @@ class Dij(PyRadPlanBaseModel):
|
|
|
112
108
|
@classmethod
|
|
113
109
|
def validate_grid(cls, grid: Union[Grid, dict]) -> Union[Grid, dict]:
|
|
114
110
|
"""
|
|
115
|
-
|
|
111
|
+
Validate grid dictionaries.
|
|
116
112
|
|
|
117
113
|
Raises
|
|
118
114
|
------
|
|
@@ -127,7 +123,7 @@ class Dij(PyRadPlanBaseModel):
|
|
|
127
123
|
@classmethod
|
|
128
124
|
def validate_numbering_arrays(cls, v: np.ndarray, info: ValidationInfo) -> np.ndarray:
|
|
129
125
|
"""
|
|
130
|
-
|
|
126
|
+
Validate the numbering arrays.
|
|
131
127
|
|
|
132
128
|
Raises
|
|
133
129
|
------
|
|
@@ -158,7 +154,7 @@ class Dij(PyRadPlanBaseModel):
|
|
|
158
154
|
cls, v: np.ndarray, info: ValidationInfo
|
|
159
155
|
) -> np.ndarray:
|
|
160
156
|
"""
|
|
161
|
-
|
|
157
|
+
Validate the number of unique indices in beam_num.
|
|
162
158
|
|
|
163
159
|
Raises
|
|
164
160
|
------
|
|
@@ -213,10 +209,7 @@ class Dij(PyRadPlanBaseModel):
|
|
|
213
209
|
return value
|
|
214
210
|
|
|
215
211
|
def to_matrad(self, context: str = "mat-file") -> Any:
|
|
216
|
-
"""
|
|
217
|
-
Converts the Dij object to matRad-compatible dictionary with
|
|
218
|
-
camelCase keys.
|
|
219
|
-
"""
|
|
212
|
+
"""Convert the Dij to matRad-compatible dictionary."""
|
|
220
213
|
|
|
221
214
|
dij_dict = super().to_matrad(context=context)
|
|
222
215
|
|
|
@@ -226,7 +219,7 @@ class Dij(PyRadPlanBaseModel):
|
|
|
226
219
|
self, intensity: np.ndarray, scenario_index: int = 0
|
|
227
220
|
) -> dict[str, np.ndarray]:
|
|
228
221
|
"""
|
|
229
|
-
|
|
222
|
+
Compute result arrays from an intensity vector.
|
|
230
223
|
|
|
231
224
|
Parameters
|
|
232
225
|
----------
|
|
@@ -269,8 +262,7 @@ class Dij(PyRadPlanBaseModel):
|
|
|
269
262
|
self, intensities: np.ndarray, scenario_index: int = 0
|
|
270
263
|
) -> dict[str, sitk.Image]:
|
|
271
264
|
"""
|
|
272
|
-
|
|
273
|
-
cubes on the dose grid.
|
|
265
|
+
Compute results on the dose grid from intensity vector.
|
|
274
266
|
|
|
275
267
|
Parameters
|
|
276
268
|
----------
|
|
@@ -301,8 +293,7 @@ class Dij(PyRadPlanBaseModel):
|
|
|
301
293
|
self, intensities: np.ndarray, scenario_index: int = 0
|
|
302
294
|
) -> dict[str, sitk.Image]:
|
|
303
295
|
"""
|
|
304
|
-
|
|
305
|
-
the CT grid.
|
|
296
|
+
Compute results on the CT grid from intensity vector.
|
|
306
297
|
|
|
307
298
|
Parameters
|
|
308
299
|
----------
|
|
@@ -335,7 +326,7 @@ class Dij(PyRadPlanBaseModel):
|
|
|
335
326
|
|
|
336
327
|
def create_dij(data: Union[dict[str, Any], Dij, None] = None, **kwargs) -> Dij:
|
|
337
328
|
"""
|
|
338
|
-
|
|
329
|
+
Create a Dij object from raw data or keyword arguments.
|
|
339
330
|
|
|
340
331
|
Parameters
|
|
341
332
|
----------
|
|
@@ -348,11 +339,6 @@ def create_dij(data: Union[dict[str, Any], Dij, None] = None, **kwargs) -> Dij:
|
|
|
348
339
|
-------
|
|
349
340
|
Dij
|
|
350
341
|
A Dij object.
|
|
351
|
-
|
|
352
|
-
Raises
|
|
353
|
-
------
|
|
354
|
-
ValueError
|
|
355
|
-
If ..???
|
|
356
342
|
"""
|
|
357
343
|
|
|
358
344
|
if data:
|
|
@@ -367,7 +353,8 @@ def create_dij(data: Union[dict[str, Any], Dij, None] = None, **kwargs) -> Dij:
|
|
|
367
353
|
|
|
368
354
|
def validate_dij(dij: Union[dict[str, Any], Dij, None] = None, **kwargs) -> Dij:
|
|
369
355
|
"""
|
|
370
|
-
|
|
356
|
+
Validate and creates a Dij object.
|
|
357
|
+
|
|
371
358
|
Synonym to create_dij but should be used in validation context.
|
|
372
359
|
|
|
373
360
|
Parameters
|
|
@@ -382,53 +369,5 @@ def validate_dij(dij: Union[dict[str, Any], Dij, None] = None, **kwargs) -> Dij:
|
|
|
382
369
|
Dij
|
|
383
370
|
A validated Dij object.
|
|
384
371
|
|
|
385
|
-
Raises
|
|
386
|
-
------
|
|
387
|
-
ValueError
|
|
388
|
-
If ... ???
|
|
389
372
|
"""
|
|
390
373
|
return create_dij(dij, **kwargs)
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
if __name__ == "__main__":
|
|
394
|
-
# Implements an example usage of the Dij class.
|
|
395
|
-
import numpy as np
|
|
396
|
-
import pyRadPlan.io.matRad as matRadIO
|
|
397
|
-
|
|
398
|
-
# Consider a dictionary of dij information in camelCase
|
|
399
|
-
dose_information = {
|
|
400
|
-
"ctGrid": {
|
|
401
|
-
"resolution": {"x": 3.0, "y": 3.0, "z": 3.0},
|
|
402
|
-
"dimensions": (167, 167, 107),
|
|
403
|
-
"numOfVoxels": 167 * 167 * 107,
|
|
404
|
-
},
|
|
405
|
-
"doseGrid": {
|
|
406
|
-
"resolution": {"x": 3.0, "y": 3.0, "z": 3.0},
|
|
407
|
-
"dimensions": (167, 167, 107),
|
|
408
|
-
"numOfVoxels": 167 * 167 * 107,
|
|
409
|
-
},
|
|
410
|
-
"numOfBeams": 2,
|
|
411
|
-
"numOfScenarios": 1,
|
|
412
|
-
"numOfRaysPerBeam": [255, 255],
|
|
413
|
-
"totalNumOfBixels": 6506,
|
|
414
|
-
"totalNumOfRays": 510,
|
|
415
|
-
"bixelNum": np.ones(6506),
|
|
416
|
-
"rayNum": np.ones(6506),
|
|
417
|
-
"beamNum": np.ones(6506),
|
|
418
|
-
"minMu": np.ones(6506),
|
|
419
|
-
"maxMu": np.ones(6506),
|
|
420
|
-
"numOfParticlesPerMu": np.ones(6506),
|
|
421
|
-
"physicalDose": sp.csr_matrix((167 * 167 * 107, 6506), dtype=float),
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
dose_information["beamNum"][3000:] = 2
|
|
425
|
-
# We create the DIJ object with mdoel validate
|
|
426
|
-
dij = create_dij(**dose_information)
|
|
427
|
-
# # print the dataclass
|
|
428
|
-
# print(dij)
|
|
429
|
-
# # turn it into a snake_case style dictionary
|
|
430
|
-
# print(dij.model_dump())
|
|
431
|
-
|
|
432
|
-
dij_to_matrad = dij.to_matrad(context="mat-file")
|
|
433
|
-
|
|
434
|
-
matRadIO.save("dij.mat", {"dij": dij_to_matrad})
|