pyRadPlan 0.2.1__tar.gz → 0.2.3__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.
Files changed (166) hide show
  1. {pyradplan-0.2.1/pyRadPlan.egg-info → pyradplan-0.2.3}/PKG-INFO +14 -3
  2. {pyradplan-0.2.1 → pyradplan-0.2.3}/README.md +10 -0
  3. {pyradplan-0.2.1 → pyradplan-0.2.3}/docs/conf.py +4 -1
  4. pyradplan-0.2.3/examples/proton_let_optimization.py +61 -0
  5. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/core/_grids.py +8 -8
  6. pyradplan-0.2.3/pyRadPlan/core/datamodel.py +111 -0
  7. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/core/np2sitk.py +1 -3
  8. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/core/resample.py +9 -4
  9. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/ct/_ct.py +20 -10
  10. pyradplan-0.2.3/pyRadPlan/dij/__init__.py +6 -0
  11. pyradplan-0.2.3/pyRadPlan/dij/_compose_beam_dijs.py +55 -0
  12. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/dij/_dij.py +82 -29
  13. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/dose/engines/_base.py +17 -8
  14. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/dose/engines/_base_pencilbeam.py +4 -0
  15. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/dose/engines/_base_pencilbeam_particle.py +6 -2
  16. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/dose/engines/_svdpb.py +1 -1
  17. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/machines/_ions.py +76 -10
  18. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/problems/_optiprob.py +2 -0
  19. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/plan/_plans.py +13 -42
  20. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/quantities/__init__.py +4 -3
  21. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/quantities/_base.py +5 -11
  22. pyradplan-0.2.3/pyRadPlan/quantities/_let_x_dose.py +29 -0
  23. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/raytracer/_perf.py +6 -6
  24. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/raytracer/_siddon.py +14 -6
  25. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/scenarios/__init__.py +29 -38
  26. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/scenarios/_base.py +159 -168
  27. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/scenarios/_nominal.py +22 -21
  28. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/stf/_ray.py +6 -24
  29. pyradplan-0.2.3/pyRadPlan/visualization/_plot_slice.py +184 -0
  30. {pyradplan-0.2.1 → pyradplan-0.2.3/pyRadPlan.egg-info}/PKG-INFO +14 -3
  31. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan.egg-info/SOURCES.txt +11 -2
  32. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan.egg-info/requires.txt +1 -1
  33. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyproject.toml +2 -2
  34. pyradplan-0.2.3/test/conftest.py +43 -0
  35. pyradplan-0.2.3/test/core/test_datamodel.py +49 -0
  36. pyradplan-0.2.3/test/data/test_validate_test_data.py +127 -0
  37. pyradplan-0.2.3/test/dose/conftest.py +78 -0
  38. pyradplan-0.2.3/test/dose/test_dose_engine_base.py +114 -0
  39. pyradplan-0.2.3/test/dose/test_factory.py +31 -0
  40. pyradplan-0.2.3/test/dose/test_hongpb.py +93 -0
  41. pyradplan-0.2.3/test/dose/test_svdpb.py +32 -0
  42. pyradplan-0.2.3/test/quantities/test_let_dose_quantity.py +108 -0
  43. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/test_dij.py +14 -1
  44. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/test_grid.py +29 -0
  45. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/test_machine_model.py +19 -0
  46. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/test_plan.py +12 -4
  47. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/test_scenarios.py +14 -7
  48. pyradplan-0.2.3/test/visualization/test_plot_slice.py +156 -0
  49. pyradplan-0.2.1/pyRadPlan/core/datamodel.py +0 -70
  50. pyradplan-0.2.1/pyRadPlan/dij/__init__.py +0 -5
  51. pyradplan-0.2.1/pyRadPlan/visualization/_plot_slice.py +0 -105
  52. pyradplan-0.2.1/test/conftest.py +0 -15
  53. pyradplan-0.2.1/test/dose/test_dose_particle.py +0 -231
  54. pyradplan-0.2.1/test/dose/test_dose_photon.py +0 -20
  55. pyradplan-0.2.1/test/visualization/test_plot_slice.py +0 -85
  56. {pyradplan-0.2.1 → pyradplan-0.2.3}/LICENSE +0 -0
  57. {pyradplan-0.2.1 → pyradplan-0.2.3}/examples/carbon_pencilbeam.py +0 -0
  58. {pyradplan-0.2.1 → pyradplan-0.2.3}/examples/helium_pencilbeam.py +0 -0
  59. {pyradplan-0.2.1 → pyradplan-0.2.3}/examples/import_matrad_patient.py +0 -0
  60. {pyradplan-0.2.1 → pyradplan-0.2.3}/examples/photon_pencilbeam.py +0 -0
  61. {pyradplan-0.2.1 → pyradplan-0.2.3}/examples/proton_pencilbeam.py +0 -0
  62. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/__init__.py +0 -0
  63. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/core/__init__.py +0 -0
  64. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/core/_exceptions.py +0 -0
  65. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/cst/__init__.py +0 -0
  66. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/cst/_cst.py +0 -0
  67. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/cst/_voi.py +0 -0
  68. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/ct/__init__.py +0 -0
  69. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/ct/_hlut.py +0 -0
  70. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/data/machines/carbon_Generic.mat +0 -0
  71. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/data/machines/helium_Generic.mat +0 -0
  72. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/data/machines/photons_Generic.mat +0 -0
  73. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/data/machines/protons_Generic.mat +0 -0
  74. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/data/phantoms/TG119.mat +0 -0
  75. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/data/stf/matRad_stf.mat +0 -0
  76. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/data/stf/matRad_stf_onebeam.mat +0 -0
  77. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/data/stf/matrad_stf_onebeam.mat +0 -0
  78. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/dose/__init__.py +0 -0
  79. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/dose/_calc_dose.py +0 -0
  80. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/dose/engines/__init__.py +0 -0
  81. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/dose/engines/_factory.py +0 -0
  82. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/dose/engines/_hongpb.py +0 -0
  83. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/geometry/__init__.py +0 -0
  84. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/geometry/lps.py +0 -0
  85. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/io/__init__.py +0 -0
  86. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/io/_matlab_file_handler.py +0 -0
  87. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/io/_patient_loader.py +0 -0
  88. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/io/matfile.py +0 -0
  89. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/machines/__init__.py +0 -0
  90. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/machines/_base.py +0 -0
  91. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/machines/_load.py +0 -0
  92. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/machines/_photons.py +0 -0
  93. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/machines/_validate.py +0 -0
  94. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/matRad/__init__.py +0 -0
  95. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/matRad/_engine.py +0 -0
  96. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/matRad/_matlab.py +0 -0
  97. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/matRad/_octave.py +0 -0
  98. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/__init__.py +0 -0
  99. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/_fluence_optimization.py +0 -0
  100. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/objectives/__init__.py +0 -0
  101. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/objectives/_eud.py +0 -0
  102. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/objectives/_factory.py +0 -0
  103. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/objectives/_max_dvh.py +0 -0
  104. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/objectives/_mean.py +0 -0
  105. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/objectives/_min_dvh.py +0 -0
  106. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/objectives/_objective.py +0 -0
  107. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/objectives/_squared_dev.py +0 -0
  108. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/objectives/_squared_over.py +0 -0
  109. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/objectives/_squared_under.py +0 -0
  110. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/objectives/_std.py +0 -0
  111. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/problems/__init__.py +0 -0
  112. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/problems/_factory.py +0 -0
  113. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/problems/_nonlin_fluence.py +0 -0
  114. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/problems/_simple_least_squares.py +0 -0
  115. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/solvers/__init__.py +0 -0
  116. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/solvers/_base_solvers.py +0 -0
  117. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/solvers/_factory.py +0 -0
  118. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/solvers/_ipopt.py +0 -0
  119. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/optimization/solvers/_scipy_solver.py +0 -0
  120. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/plan/__init__.py +0 -0
  121. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/quantities/_dose.py +0 -0
  122. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/raytracer/__init__.py +0 -0
  123. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/raytracer/_base.py +0 -0
  124. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/stf/__init__.py +0 -0
  125. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/stf/_beam.py +0 -0
  126. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/stf/_beamlet.py +0 -0
  127. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/stf/_exceptions.py +0 -0
  128. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/stf/_generate_stf.py +0 -0
  129. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/stf/_rangeshifter.py +0 -0
  130. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/stf/_steeringinformation.py +0 -0
  131. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/stf/generators/__init__.py +0 -0
  132. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/stf/generators/_base.py +0 -0
  133. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/stf/generators/_externalbeam.py +0 -0
  134. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/stf/generators/_factory.py +0 -0
  135. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/stf/generators/_ions.py +0 -0
  136. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/stf/generators/_photons.py +0 -0
  137. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/util/__init__.py +0 -0
  138. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/util/helpers.py +0 -0
  139. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan/visualization/__init__.py +0 -0
  140. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan.egg-info/dependency_links.txt +0 -0
  141. {pyradplan-0.2.1 → pyradplan-0.2.3}/pyRadPlan.egg-info/top_level.txt +0 -0
  142. {pyradplan-0.2.1 → pyradplan-0.2.3}/setup.cfg +0 -0
  143. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/core/test_coordinates.py +0 -0
  144. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/core/test_np2sitk.py +0 -0
  145. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/core/test_resample.py +0 -0
  146. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/cst/conftest.py +0 -0
  147. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/cst/test_VOI.py +0 -0
  148. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/cst/test_cst.py +0 -0
  149. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/ct/test_ct.py +0 -0
  150. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/ct/test_hlut.py +0 -0
  151. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/geometry/test_lps.py +0 -0
  152. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/optimization/test_fluence_optiprob.py +0 -0
  153. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/optimization/test_ipopt_solver.py +0 -0
  154. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/optimization/test_objectives.py +0 -0
  155. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/optimization/test_problem_factory.py +0 -0
  156. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/optimization/test_scipy_solver.py +0 -0
  157. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/optimization/test_solver_factory.py +0 -0
  158. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/quantities/test_dose_quantity.py +0 -0
  159. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/stf/test_beamlet.py +0 -0
  160. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/stf/test_stf.py +0 -0
  161. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/stf/test_stf_gen.py +0 -0
  162. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/test_fileHandling.py +0 -0
  163. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/test_helpers.py +0 -0
  164. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/test_matlabEngine.py +0 -0
  165. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/test_octaveEngine.py +0 -0
  166. {pyradplan-0.2.1 → pyradplan-0.2.3}/test/test_raytracersiddon.py +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.2
1
+ Metadata-Version: 2.4
2
2
  Name: pyRadPlan
3
- Version: 0.2.1
3
+ Version: 0.2.3
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>
@@ -19,7 +19,7 @@ Requires-Dist: regex>=2024.5.15
19
19
  Requires-Dist: pydicom>=2.4.4
20
20
  Requires-Dist: numba>=0.60.0
21
21
  Requires-Dist: matplotlib>=3.9.2
22
- Requires-Dist: pydantic>=2.10
22
+ Requires-Dist: pydantic<2.11,>=2.10
23
23
  Requires-Dist: numpydantic>=1.6.0
24
24
  Requires-Dist: SimpleITK>=2.4.0
25
25
  Requires-Dist: tqdm>=4.0.0
@@ -41,8 +41,19 @@ Requires-Dist: pydata-sphinx-theme; extra == "dev"
41
41
  Requires-Dist: sphinx-design; extra == "dev"
42
42
  Requires-Dist: autodoc_pydantic; extra == "dev"
43
43
  Requires-Dist: sphinx-autodoc-typehints; extra == "dev"
44
+ Dynamic: license-file
44
45
 
45
46
  # pyRadPlan
47
+ [![Tests](https://github.com/e0404/pyRadPlan/actions/workflows/tests.yml/badge.svg)](https://github.com/e0404/pyRadPlan/actions/workflows/tests.yml)
48
+ [![codecov](https://codecov.io/gh/e0404/pyRadPlan/graph/badge.svg?token=S1KCYDU17G)](https://codecov.io/gh/e0404/pyRadPlan)
49
+ [![pypi version](https://img.shields.io/pypi/v/pyRadPlan)](https://pypi.org/project/pyRadPlan/)
50
+ ![pyversion](https://img.shields.io/pypi/pyversions/pyRadPlan)
51
+ ![contributors](https://img.shields.io/github/contributors-anon/e0404/pyRadPlan)
52
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
53
+ ![License](https://img.shields.io/github/license/e0404/pyRadPlan)
54
+
55
+
56
+
46
57
  pyRadPlan is an open-source radiotherapy treatment planning toolkit designed for interoperability with [matRad](http://www.matRad.org).
47
58
 
48
59
  Development is lead by the [Radiotherapy Optimization group](https://www.dkfz.de/radopt) at the [German Cancer Research Center (DKFZ)](https://www.dkfz.de)
@@ -1,4 +1,14 @@
1
1
  # pyRadPlan
2
+ [![Tests](https://github.com/e0404/pyRadPlan/actions/workflows/tests.yml/badge.svg)](https://github.com/e0404/pyRadPlan/actions/workflows/tests.yml)
3
+ [![codecov](https://codecov.io/gh/e0404/pyRadPlan/graph/badge.svg?token=S1KCYDU17G)](https://codecov.io/gh/e0404/pyRadPlan)
4
+ [![pypi version](https://img.shields.io/pypi/v/pyRadPlan)](https://pypi.org/project/pyRadPlan/)
5
+ ![pyversion](https://img.shields.io/pypi/pyversions/pyRadPlan)
6
+ ![contributors](https://img.shields.io/github/contributors-anon/e0404/pyRadPlan)
7
+ [![Ruff](https://img.shields.io/endpoint?url=https://raw.githubusercontent.com/astral-sh/ruff/main/assets/badge/v2.json)](https://github.com/astral-sh/ruff)
8
+ ![License](https://img.shields.io/github/license/e0404/pyRadPlan)
9
+
10
+
11
+
2
12
  pyRadPlan is an open-source radiotherapy treatment planning toolkit designed for interoperability with [matRad](http://www.matRad.org).
3
13
 
4
14
  Development is lead by the [Radiotherapy Optimization group](https://www.dkfz.de/radopt) at the [German Cancer Research Center (DKFZ)](https://www.dkfz.de)
@@ -7,6 +7,7 @@
7
7
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8
8
  import os
9
9
  import sys
10
+ from pyRadPlan import __version__
10
11
 
11
12
  print(os.path.abspath("../pyRadPlan"))
12
13
  sys.path.insert(0, os.path.abspath("../pyRadPlan")) # Adjust to your source folder
@@ -14,7 +15,9 @@ sys.path.insert(0, os.path.abspath("../pyRadPlan")) # Adjust to your source fol
14
15
  project = "pyRadPlan"
15
16
  copyright = "2024, e0404"
16
17
  author = "e0404"
17
- release = "0.0.1"
18
+
19
+ version = __version__
20
+ release = __version__
18
21
 
19
22
  # -- General configuration ---------------------------------------------------
20
23
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -0,0 +1,61 @@
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
+ # Read patient from provided TG119.mat file and validate data
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 = [
34
+ SquaredOverdosing(priority=10.0, d_max=1.0),
35
+ SquaredOverdosing(priority=5.0, d_max=1.0, quantity="let_dose"),
36
+ ] # 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
+ fluence = fluence_optimization(ct, cst, stf, dij, pln)
42
+
43
+ # Result
44
+ result = dij.compute_result_ct_grid(fluence)
45
+
46
+ # Choose a slice to visualize
47
+ view_slice = int(np.round(ct.size[2] / 2))
48
+
49
+ # Visualize
50
+ plot_slice(
51
+ ct=ct,
52
+ cst=cst,
53
+ overlay=result["physical_dose"],
54
+ view_slice=view_slice,
55
+ )
56
+ plot_slice(
57
+ ct=ct,
58
+ cst=cst,
59
+ overlay=result["let"],
60
+ view_slice=view_slice,
61
+ )
@@ -76,9 +76,9 @@ class Grid(PyRadPlanBaseModel):
76
76
  raise ValueError("resolution must have keys 'x', 'y', 'z'")
77
77
 
78
78
  # Check if all resolution values are positive floats. If not, try to cast them to float
79
- for key in value:
80
- if value[key] <= 0:
81
- raise ValueError(f"resolution values must be positive floats, got {value[key]}")
79
+ for _, v in value.items():
80
+ if v <= 0:
81
+ raise ValueError(f"resolution values must be positive floats, got {v}")
82
82
 
83
83
  return value
84
84
 
@@ -93,11 +93,12 @@ class Grid(PyRadPlanBaseModel):
93
93
  # Check if all dimensions values are positive integers. If not, try to cast them to int
94
94
  for dim in value:
95
95
  try:
96
- dim = int(dim)
96
+ tmpdim = int(dim)
97
97
  except ValueError:
98
98
  raise ValueError(f"dimension value could not be casted into int, got {dim}")
99
- if dim <= 0:
100
- raise ValueError(f"dimension values must be positive integers, got {dim}")
99
+
100
+ if tmpdim <= 0:
101
+ raise ValueError(f"dimension values must be positive integers, got {tmpdim}")
101
102
 
102
103
  return value
103
104
 
@@ -162,8 +163,7 @@ class Grid(PyRadPlanBaseModel):
162
163
  ],
163
164
  ) -> Self:
164
165
  """
165
- Create a resampled grid covering the original grid in a new
166
- resolution.
166
+ Create a resampled grid covering the original grid in new resolution.
167
167
 
168
168
  Parameters
169
169
  ----------
@@ -0,0 +1,111 @@
1
+ """Basic Model for all pyRadPlan Datastructures."""
2
+
3
+ from typing import Any, Union
4
+ import numpy as np
5
+ from pydantic import (
6
+ AliasGenerator,
7
+ BaseModel,
8
+ ConfigDict,
9
+ )
10
+ from pydantic.alias_generators import to_camel
11
+ from copy import deepcopy
12
+
13
+
14
+ class PyRadPlanBaseModel(BaseModel):
15
+ """
16
+ Base class for all pyRadPlan data structures.
17
+
18
+ Especially useful for structures that should be matRad compatible.
19
+ Extends Pydantic's BaseModel to use pydantic validation and serialization.
20
+
21
+ Attributes
22
+ ----------
23
+ model_config : ConfigDict
24
+ Configuration for the model, including alias generation, population by
25
+ name, arbitrary types allowed, assignment validation, and attribute
26
+ creation from dictionary.
27
+ """
28
+
29
+ model_config = ConfigDict(
30
+ alias_generator=AliasGenerator(alias=to_camel),
31
+ populate_by_name=True, # Allows both snake_case and camelCase attributes
32
+ arbitrary_types_allowed=True, # Allows arbitrary types in the model (will be casted)
33
+ validate_assignment=True, # Validate assignment of values to fields
34
+ # (not only during construction)
35
+ from_attributes=True, # Allows to create a model from a dictionary
36
+ )
37
+
38
+ def __eq__(self, other: Any) -> bool:
39
+ """
40
+ Specialized __eq__ method to compare two pyRadPlanBaseModel instances.
41
+
42
+ It first tries to compare the instances using the super().__eq__ method.
43
+ If this fails, it compares the dictionaries. This is due to some issues
44
+ comparing numpy arrays within the models.
45
+ """
46
+ try:
47
+ return super().__eq__(other)
48
+ except ValueError:
49
+ if self.__dict__.keys() != other.__dict__.keys():
50
+ return False
51
+ stack = [(self.__dict__, other.__dict__)]
52
+ while stack:
53
+ dict_a, dict_b = stack.pop()
54
+ if dict_a.keys() != dict_b.keys():
55
+ return False
56
+ for key in dict_a:
57
+ if isinstance(dict_a[key], dict) and isinstance(dict_b[key], dict):
58
+ stack.append((dict_a[key], dict_b[key]))
59
+ elif isinstance(dict_a[key], np.ndarray) and isinstance(
60
+ dict_b[key], np.ndarray
61
+ ):
62
+ if not np.array_equal(dict_a[key], dict_b[key]):
63
+ return False
64
+ elif dict_a[key] != dict_b[key]:
65
+ return False
66
+ return True
67
+
68
+ def __ne__(self, other: Any) -> bool:
69
+ """
70
+ Specialized __ne__ method to compare two PyRadPlanBaseModel instances.
71
+
72
+ This method returns the negation of the __eq__ method.
73
+ """
74
+ if isinstance(other, self.__class__):
75
+ return not self.__eq__(other)
76
+ else:
77
+ return True
78
+
79
+ def to_matrad(self, context: Union[str, dict] = "mat-file") -> Any:
80
+ """
81
+ Perform matRad compatible serialization.
82
+
83
+ Parameters
84
+ ----------
85
+ context : str, optional
86
+ The context in which the datastructure should be serialized,
87
+ by default 'mat-file'.
88
+
89
+ Returns
90
+ -------
91
+ Any
92
+ A datastructre compatible with matRad in the given context
93
+
94
+ Notes
95
+ -----
96
+ Currently, the only supported context is 'mat-file'. In the future,
97
+ this could be extended to support other contexts, such as direct
98
+ calling via the matlab engine or oct2py.
99
+ """
100
+ self_copy = deepcopy(self)
101
+ if isinstance(context, dict):
102
+ if "matRad" not in context:
103
+ context.update({"matRad": "mat-file"})
104
+ else:
105
+ context = {"matRad": context}
106
+
107
+ if context["matRad"] != "mat-file":
108
+ raise ValueError(f"Context {context} not supported")
109
+
110
+ # Standard is a model_dump using above alias and context information
111
+ return self_copy.model_dump(by_alias=True, context=context)
@@ -1,6 +1,4 @@
1
- """Helper Functions relating to conversion between numpy and SimpleITK data
2
- types.
3
- """
1
+ """Helpers for conversion between numpy and SimpleITK."""
4
2
 
5
3
  from typing import Literal
6
4
  import SimpleITK as sitk
@@ -1,3 +1,5 @@
1
+ """Image / Grid Resampling."""
2
+
1
3
  import numpy as np
2
4
  import SimpleITK as sitk
3
5
  from ._grids import Grid
@@ -11,8 +13,9 @@ def resample_image(
11
13
  target_grid: Grid = None,
12
14
  ) -> sitk.Image: # also accept sitk images and grid points. Can be dealt with with kwargs
13
15
  """
14
- Resamples an sitk Image to a target resolution, reference image
15
- dimensions, or Grid.
16
+ Resample an sitk Image.
17
+
18
+ Use target resolution, reference image, dimensions, or Grid as input.
16
19
 
17
20
  Parameters
18
21
  ----------
@@ -70,8 +73,10 @@ def resample_numpy_array(
70
73
  target_grid: Grid = None,
71
74
  ) -> np.ndarray:
72
75
  """
73
- Resamples a numpy grid to a target resolution, reference image
74
- dimensions, or Grid.
76
+ Resample a numpy grid.
77
+
78
+ Use target resolution, reference image, dimensions, or Grid as input.
79
+
75
80
  We convert the numpy array to an sitk.Image, so the dimensions will be
76
81
  switched. More exactly,
77
82
  the numpy array will be index i,j,k <-> z,y,x, which will converted to
@@ -91,6 +91,9 @@ class CT(PyRadPlanBaseModel, ABC):
91
91
  if cube_hu is None:
92
92
  raise ValueError("HU cube not present in dictionary.")
93
93
 
94
+ if isinstance(cube_hu, sitk.Image) and "origin" not in data:
95
+ data["origin"] = cube_hu.GetOrigin()
96
+
94
97
  if isinstance(cube_hu, np.ndarray):
95
98
  # Now we do check if it is matRad data
96
99
  if data.get("cubeDim", None) is not None:
@@ -133,16 +136,6 @@ class CT(PyRadPlanBaseModel, ABC):
133
136
  is4d = cube_hu.GetDimension() == 4
134
137
  # Now we parse the rest of the data if additional data is available in the dictionary
135
138
 
136
- # TODO: Either set up a Grid or check for x/y/z to do the data management
137
- if "origin" in data:
138
- data["cube_hu"].SetOrigin(data["origin"])
139
-
140
- elif all(key in data for key in ("x", "y", "z")):
141
- origin = np.array([data["x"][0], data["y"][0], data["z"][0]], dtype=float)
142
- if is4d:
143
- origin = np.append(origin, [0.0])
144
- data["cube_hu"].SetOrigin(origin)
145
-
146
139
  if "direction" in data:
147
140
  data["cube_hu"].SetDirection(data["direction"])
148
141
 
@@ -153,6 +146,23 @@ class CT(PyRadPlanBaseModel, ABC):
153
146
  else:
154
147
  cube_hu.SetSpacing([resolution["x"], resolution["y"], resolution["z"]])
155
148
 
149
+ # TODO: Either set up a Grid or check for x/y/z to do the data management
150
+ if "origin" in data:
151
+ data["cube_hu"].SetOrigin(data["origin"])
152
+
153
+ else:
154
+ data["cube_hu"].SetOrigin(
155
+ -np.array(data["cube_hu"].GetSize())
156
+ / 2.0
157
+ * np.array(data["cube_hu"].GetSpacing())
158
+ )
159
+ if is4d:
160
+ data["cube_hu"].SetOrigin(np.append(data["cube_hu"].GetOrigin(), [0.0]))
161
+ # elif all(key in data for key in ("x", "y", "z")):
162
+ # origin = np.array([data["x"][0], data["y"][0], data["z"][0]], dtype=float)
163
+ # if is4d:
164
+ # origin = np.append(origin, [0.0])
165
+ # data["cube_hu"].SetOrigin(origin)
156
166
  return data
157
167
 
158
168
  @computed_field
@@ -0,0 +1,6 @@
1
+ """Module for Dij Datamodel and related functions."""
2
+
3
+ from pyRadPlan.dij._dij import Dij, create_dij, validate_dij
4
+ from pyRadPlan.dij._compose_beam_dijs import compose_beam_dijs
5
+
6
+ __all__ = ["Dij", "create_dij", "validate_dij", "compose_beam_dijs"]
@@ -0,0 +1,55 @@
1
+ import numpy as np
2
+
3
+ from scipy.sparse import hstack
4
+ from ._dij import Dij
5
+
6
+
7
+ def compose_beam_dijs(dijs: list[Dij]) -> Dij:
8
+ """Compose multiple Dij objects into a single Dij object.
9
+
10
+ Parameters
11
+ ----------
12
+ dijs : list[Dij]
13
+ List of Dij objects to be composed.
14
+
15
+ Returns
16
+ -------
17
+ Dij
18
+ Composed Dij object.
19
+ """
20
+
21
+ qs = dijs[0].quantities
22
+
23
+ num_of_beams = 0
24
+ beam_num = np.array([], dtype=int)
25
+ ray_num = np.array([], dtype=int)
26
+ bixel_num = np.array([], dtype=int)
27
+
28
+ for i, dij in enumerate(dijs):
29
+ beam_num = np.append(beam_num, dij.beam_num + num_of_beams)
30
+ ray_num = np.append(ray_num, dij.ray_num)
31
+ bixel_num = np.append(bixel_num, dij.bixel_num)
32
+ num_of_beams = num_of_beams + dij.num_of_beams
33
+
34
+ matrices = {}
35
+ for q in qs:
36
+ tmp_matrices = [getattr(dij, q) for dij in dijs]
37
+
38
+ new_matrix = np.empty_like(tmp_matrices[0], dtype=object)
39
+
40
+ for i, scen_matrix in enumerate(tmp_matrices[0].flat):
41
+ if scen_matrix is not None:
42
+ new_matrix.flat[i] = hstack([tmp_matrix.flat[i] for tmp_matrix in tmp_matrices])
43
+
44
+ matrices.update({q: new_matrix})
45
+
46
+ return Dij(
47
+ ct_grid=dijs[0].ct_grid,
48
+ dose_grid=dijs[0].dose_grid,
49
+ matrices=matrices,
50
+ num_of_beams=num_of_beams,
51
+ beam_num=beam_num,
52
+ ray_num=ray_num,
53
+ bixel_num=bixel_num,
54
+ **matrices,
55
+ )
@@ -1,6 +1,6 @@
1
1
  """Contains the dij class as a (collection of) influence matrices."""
2
2
 
3
- from typing import Any, Union, Annotated, cast
3
+ from typing import Any, Union, Annotated, Optional, cast
4
4
  from pydantic import (
5
5
  Field,
6
6
  field_validator,
@@ -41,15 +41,17 @@ class Dij(PyRadPlanBaseModel):
41
41
  ct_grid: Annotated[Grid, Field(default=None)]
42
42
 
43
43
  physical_dose: Annotated[NDArray, Field(default=None)]
44
- let_dose: Annotated[NDArray, Field(default=None)]
44
+ let_dose: Annotated[NDArray, Field(default=None, alias="mLETDose")]
45
45
  alpha_dose: Annotated[NDArray, Field(default=None)]
46
46
  sqrt_beta_dose: Annotated[NDArray, Field(default=None)]
47
47
 
48
48
  num_of_beams: Annotated[int, Field(default=None)]
49
49
 
50
- bixel_num: Annotated[np.ndarray, Field(default=None)]
51
- ray_num: Annotated[np.ndarray, Field(default=None)]
52
- beam_num: Annotated[np.ndarray, Field(default=None)]
50
+ bixel_num: Annotated[NDArray, Field(default=None)]
51
+ ray_num: Annotated[NDArray, Field(default=None)]
52
+ beam_num: Annotated[NDArray, Field(default=None)]
53
+
54
+ rad_depth_cubes: Optional[list[NDArray]] = Field(default=None)
53
55
 
54
56
  @computed_field
55
57
  @property
@@ -63,6 +65,13 @@ class Dij(PyRadPlanBaseModel):
63
65
  """Number of voxels in the dose influence matrix."""
64
66
  return self.physical_dose.flat[0].shape[0]
65
67
 
68
+ @computed_field
69
+ @property
70
+ def quantities(self) -> list[str]:
71
+ """Name of available uantities matrices."""
72
+ potential_quantities = ["physical_dose", "let_dose", "alpha_dose", "sqrt_beta_dose"]
73
+ return [q for q in potential_quantities if getattr(self, q) is not None]
74
+
66
75
  @field_validator("physical_dose", "let_dose", "alpha_dose", "sqrt_beta_dose", mode="before")
67
76
  @classmethod
68
77
  def validate_matrices(cls, v: Any, info: ValidationInfo) -> np.ndarray:
@@ -102,11 +111,30 @@ class Dij(PyRadPlanBaseModel):
102
111
  if mat.shape[0] != info.data["dose_grid"].num_voxels:
103
112
  raise ValueError(f"{info.field_name} shape inconsistent with ct grid")
104
113
 
114
+ if info.context and "from_matRad" in info.context and info.context["from_matRad"]:
115
+ if v is not None:
116
+ for i in range(v.size):
117
+ shape = (
118
+ int(info.data["dose_grid"].dimensions[2]),
119
+ int(info.data["dose_grid"].dimensions[0]),
120
+ int(info.data["dose_grid"].dimensions[1]),
121
+ )
122
+ v.flat[i] = swap_orientation_sparse_matrix(
123
+ v.flat[i],
124
+ shape,
125
+ (1, 2), # (65, 100, 100) example
126
+ )
127
+ if v.flat[i] is not None and not isinstance(v.flat[i], sp.csc_matrix):
128
+ v.flat[i] = sp.csc_matrix(v.flat[i])
129
+ else:
130
+ v = np.array([0])
131
+ return [[v]] # TODO
132
+
105
133
  return v
106
134
 
107
135
  @field_validator("dose_grid", "ct_grid", mode="before")
108
136
  @classmethod
109
- def validate_grid(cls, grid: Union[Grid, dict]) -> Union[Grid, dict]:
137
+ def validate_grid(cls, grid: Union[Grid, dict], info: ValidationInfo) -> Union[Grid, dict]:
110
138
  """
111
139
  Validate grid dictionaries.
112
140
 
@@ -116,9 +144,35 @@ class Dij(PyRadPlanBaseModel):
116
144
  """
117
145
  # Check if it is a dictionary and then try to create a Grid object
118
146
  if isinstance(grid, dict):
119
- grid = Grid.model_validate(grid)
147
+ if info.context and "from_matRad" in info.context and info.context["from_matRad"]:
148
+ grid["dimensions"] = np.array(
149
+ [grid["dimensions"][1], grid["dimensions"][0], grid["dimensions"][2]]
150
+ )
151
+ # TODO: might swap offset and resolution
152
+ grid = Grid.model_validate(grid)
153
+ else:
154
+ grid = Grid.model_validate(grid)
120
155
  return grid
121
156
 
157
+ @field_validator("beam_num", mode="before")
158
+ @classmethod
159
+ def validate_unique_indices_in_beam_num(
160
+ cls, v: np.ndarray, info: ValidationInfo
161
+ ) -> np.ndarray:
162
+ """
163
+ Validate the number of unique indices in beam_num.
164
+
165
+ Raises
166
+ ------
167
+ ValueError: Number of unique indices does not match number of beams.
168
+ """
169
+ num_of_beams = info.data["num_of_beams"]
170
+ if len(np.unique(v)) != num_of_beams:
171
+ raise ValueError(
172
+ "Number of unique indices in beam_num does not match number of beams."
173
+ )
174
+ return v
175
+
122
176
  @field_validator("beam_num", "ray_num", "bixel_num", mode="after")
123
177
  @classmethod
124
178
  def validate_numbering_arrays(cls, v: np.ndarray, info: ValidationInfo) -> np.ndarray:
@@ -146,25 +200,8 @@ class Dij(PyRadPlanBaseModel):
146
200
  "Numbering arrays shape inconsistent with number of bixels"
147
201
  )
148
202
 
149
- return v
150
-
151
- @field_validator("beam_num")
152
- @classmethod
153
- def validate_unique_indices_in_beam_num(
154
- cls, v: np.ndarray, info: ValidationInfo
155
- ) -> np.ndarray:
156
- """
157
- Validate the number of unique indices in beam_num.
158
-
159
- Raises
160
- ------
161
- ValueError: Number of unique indices does not match number of beams.
162
- """
163
- num_of_beams = info.data["num_of_beams"]
164
- if len(np.unique(v)) != num_of_beams:
165
- raise ValueError(
166
- "Number of unique indices in beam_num does not match number of beams."
167
- )
203
+ if info.context and "from_matRad" in info.context and info.context["from_matRad"]:
204
+ v -= 1
168
205
  return v
169
206
 
170
207
  # Serialization
@@ -175,7 +212,6 @@ class Dij(PyRadPlanBaseModel):
175
212
  context = info.context
176
213
  if context and context.get("matRad") == "mat-file":
177
214
  return value.to_matrad(context=context["matRad"])
178
-
179
215
  return handler(value, info)
180
216
 
181
217
  @field_serializer("physical_dose", "let_dose", "alpha_dose", "sqrt_beta_dose")
@@ -195,6 +231,18 @@ class Dij(PyRadPlanBaseModel):
195
231
  )
196
232
  if value.flat[i] is not None and not isinstance(value.flat[i], sp.csc_matrix):
197
233
  value.flat[i] = sp.csc_matrix(value.flat[i])
234
+ # return 0 if value is None. savemat() cant handle 'None'
235
+ elif context and context.get("matRad") == "mat-file" and value is None:
236
+ value = np.array([0])
237
+ return value
238
+
239
+ @field_serializer("rad_depth_cubes")
240
+ def rad_depth_cubes_serializer(self, value: np.ndarray, info: SerializationInfo) -> np.ndarray:
241
+ context = info.context
242
+ if context and context.get("matRad") == "mat-file" and value is not None:
243
+ # TODO: it might be necessary to rotate the cube!
244
+ return value
245
+ # return 0 if value is None. savemat() cant handle 'None'
198
246
  elif context and context.get("matRad") == "mat-file" and value is None:
199
247
  value = np.array([0])
200
248
  return value
@@ -244,7 +292,7 @@ class Dij(PyRadPlanBaseModel):
244
292
  if self.physical_dose is None:
245
293
  raise ValueError("Physical dose must be calculated for dose-weighted let")
246
294
 
247
- indices = out["physical_dose"] > 0.0
295
+ indices = out["physical_dose"] > 0.05 * np.max(out["physical_dose"])
248
296
 
249
297
  let_dose = self.let_dose.flat[scenario_index] @ intensity
250
298
  out["let"] = np.zeros_like(let_dose)
@@ -346,7 +394,12 @@ def create_dij(data: Union[dict[str, Any], Dij, None] = None, **kwargs) -> Dij:
346
394
  if isinstance(data, Dij):
347
395
  return data
348
396
 
349
- return Dij.model_validate(data)
397
+ if "beamNum" in data and np.min(data["beamNum"]) != 0:
398
+ # add context when from matRad
399
+ context = {"from_matRad": True}
400
+ else:
401
+ context = {"from_matRad": False}
402
+ return Dij.model_validate(data, context=context)
350
403
 
351
404
  return Dij(**kwargs)
352
405