pyRadPlan 0.4.0__tar.gz → 0.5.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (469) hide show
  1. {pyradplan-0.4.0/pyRadPlan.egg-info → pyradplan-0.5.0}/PKG-INFO +55 -8
  2. {pyradplan-0.4.0 → pyradplan-0.5.0}/README.md +39 -4
  3. pyradplan-0.4.0/benchmark/bench_trace_cubes.py → pyradplan-0.5.0/benchmark/benchmark_trace_cubes.py +7 -0
  4. pyradplan-0.5.0/benchmark/profile_pencilbeam_photon_forward_lineprof.py +273 -0
  5. pyradplan-0.5.0/docs/conf.py +126 -0
  6. pyradplan-0.5.0/docs/execute_examples.py +119 -0
  7. pyradplan-0.5.0/examples/gui_main_window.py +36 -0
  8. pyradplan-0.5.0/examples/gui_planning_widgets.py +72 -0
  9. pyradplan-0.5.0/examples/gui_workflow_widget.py +57 -0
  10. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/mc_fred.py +10 -12
  11. pyradplan-0.5.0/examples/mc_topas.py +128 -0
  12. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/pencilbeam_carbon.py +35 -16
  13. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/pencilbeam_helium.py +17 -12
  14. pyradplan-0.5.0/examples/pencilbeam_oxygen.py +95 -0
  15. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/pencilbeam_photon.py +21 -14
  16. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/pencilbeam_photon_forward.py +23 -17
  17. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/pencilbeam_proton.py +19 -9
  18. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/pencilbeam_proton_let.py +22 -17
  19. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/pencilbeam_vhee.py +19 -12
  20. pyradplan-0.5.0/examples/plan_analysis.py +104 -0
  21. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/proton_mimicking.py +21 -16
  22. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/raytracer_rad_depth.py +9 -7
  23. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/utils_ai_agents.py +15 -10
  24. pyradplan-0.5.0/examples/utils_ai_models.py +99 -0
  25. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/utils_backends.py +29 -17
  26. pyradplan-0.5.0/examples/utils_io.py +123 -0
  27. pyradplan-0.5.0/examples/utils_matrad.py +93 -0
  28. pyradplan-0.5.0/examples/utils_optimization.py +192 -0
  29. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/utils_plotting.py +7 -7
  30. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/__init__.py +12 -2
  31. pyradplan-0.5.0/pyRadPlan/_settings.py +242 -0
  32. pyradplan-0.5.0/pyRadPlan/ai/__init__.py +16 -0
  33. pyradplan-0.5.0/pyRadPlan/ai/agents/__init__.py +35 -0
  34. pyradplan-0.5.0/pyRadPlan/ai/agents/_cst_agents.py +260 -0
  35. pyradplan-0.5.0/pyRadPlan/ai/agents/_models.py +71 -0
  36. pyradplan-0.5.0/pyRadPlan/ai/agents/_plan_agents.py +169 -0
  37. pyradplan-0.5.0/pyRadPlan/ai/agents/_settings.py +33 -0
  38. pyradplan-0.5.0/pyRadPlan/ai/agents/_usage.py +106 -0
  39. pyradplan-0.5.0/pyRadPlan/ai/modelhub/__init__.py +31 -0
  40. pyradplan-0.5.0/pyRadPlan/ai/modelhub/_load_model.py +303 -0
  41. pyradplan-0.5.0/pyRadPlan/ai/modelhub/_preprocessor.py +65 -0
  42. pyradplan-0.5.0/pyRadPlan/ai/modelhub/_registry.py +185 -0
  43. pyradplan-0.5.0/pyRadPlan/ai/modelhub/_resolve.py +279 -0
  44. pyradplan-0.5.0/pyRadPlan/ai/modelhub/_settings.py +11 -0
  45. pyradplan-0.5.0/pyRadPlan/analysis/__init__.py +18 -0
  46. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/analysis/_dvh.py +25 -4
  47. pyradplan-0.5.0/pyRadPlan/analysis/_qi.py +534 -0
  48. pyradplan-0.5.0/pyRadPlan/core/__init__.py +51 -0
  49. pyradplan-0.5.0/pyRadPlan/core/_configurable.py +373 -0
  50. pyradplan-0.5.0/pyRadPlan/core/_grids.py +405 -0
  51. pyradplan-0.5.0/pyRadPlan/core/_paths.py +67 -0
  52. pyradplan-0.5.0/pyRadPlan/core/_progress.py +385 -0
  53. pyradplan-0.5.0/pyRadPlan/core/xp_utils/__init__.py +284 -0
  54. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/core/xp_utils/compat.py +300 -55
  55. pyradplan-0.5.0/pyRadPlan/core/xp_utils/helpers.py +1520 -0
  56. pyradplan-0.5.0/pyRadPlan/core/xp_utils/jittable.py +155 -0
  57. pyradplan-0.5.0/pyRadPlan/cst/_cst.py +821 -0
  58. pyradplan-0.5.0/pyRadPlan/cst/_voi.py +1091 -0
  59. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/ct/_ct.py +2 -2
  60. pyradplan-0.5.0/pyRadPlan/data/ai_models/model_config.template.json +24 -0
  61. pyradplan-0.5.0/pyRadPlan/data/machines/oxygen_Generic.mat +0 -0
  62. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dose/_calc_dose.py +5 -6
  63. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dose/engines/_base.py +18 -32
  64. pyradplan-0.5.0/pyRadPlan/dose/engines/_base_montecarlo.py +12 -0
  65. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dose/engines/_base_pencilbeam.py +31 -30
  66. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dose/engines/_base_pencilbeam_particle.py +6 -12
  67. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dose/engines/_factory.py +8 -5
  68. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dose/engines/_fredmc.py +61 -8
  69. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dose/engines/_hongpb.py +1 -1
  70. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dose/engines/_svdpb.py +107 -85
  71. pyradplan-0.5.0/pyRadPlan/gui/__init__.py +48 -0
  72. pyradplan-0.5.0/pyRadPlan/gui/apps.py +106 -0
  73. pyradplan-0.5.0/pyRadPlan/gui/assets/__init__.py +82 -0
  74. pyradplan-0.5.0/pyRadPlan/gui/assets/logos/dkfz_logo_blue.svg +315 -0
  75. pyradplan-0.5.0/pyRadPlan/gui/assets/logos/dkfz_logo_white.svg +315 -0
  76. pyradplan-0.5.0/pyRadPlan/gui/assets/logos/pyradplan_logo_full_landscape.svg +909 -0
  77. pyradplan-0.5.0/pyRadPlan/gui/assets/logos/pyradplan_logo_skull_square.svg +458 -0
  78. pyradplan-0.5.0/pyRadPlan/gui/menus/__init__.py +7 -0
  79. pyradplan-0.5.0/pyRadPlan/gui/menus/_file.py +92 -0
  80. pyradplan-0.5.0/pyRadPlan/gui/menus/_settings.py +223 -0
  81. pyradplan-0.5.0/pyRadPlan/gui/menus/_view.py +53 -0
  82. pyradplan-0.5.0/pyRadPlan/gui/widgets/__init__.py +24 -0
  83. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/gui/widgets/_analysis_widget.py +6 -6
  84. pyradplan-0.5.0/pyRadPlan/gui/widgets/_base.py +224 -0
  85. pyradplan-0.5.0/pyRadPlan/gui/widgets/_config_form.py +351 -0
  86. pyradplan-0.5.0/pyRadPlan/gui/widgets/_info_widget.py +44 -0
  87. pyradplan-0.5.0/pyRadPlan/gui/widgets/_log_console.py +155 -0
  88. pyradplan-0.5.0/pyRadPlan/gui/widgets/_logo_widget.py +104 -0
  89. pyradplan-0.5.0/pyRadPlan/gui/widgets/_result_widget.py +584 -0
  90. pyradplan-0.5.0/pyRadPlan/gui/widgets/ai/__init__.py +46 -0
  91. pyradplan-0.5.0/pyRadPlan/gui/widgets/ai/_ai_task_dialog.py +239 -0
  92. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/gui/widgets/analysis/_dvh.py +3 -3
  93. pyradplan-0.5.0/pyRadPlan/gui/widgets/optimization/__init__.py +6 -0
  94. pyradplan-0.5.0/pyRadPlan/gui/widgets/optimization/_optimization_widget.py +590 -0
  95. pyradplan-0.5.0/pyRadPlan/gui/widgets/optimization/_status_window.py +233 -0
  96. pyradplan-0.5.0/pyRadPlan/gui/widgets/plan/__init__.py +5 -0
  97. pyradplan-0.5.0/pyRadPlan/gui/widgets/plan/_plan_widget.py +829 -0
  98. pyradplan-0.5.0/pyRadPlan/gui/widgets/result/_save_result_dialog.py +94 -0
  99. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/gui/widgets/result/quantity_widget.py +123 -7
  100. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/gui/widgets/result/viewer_options_widget.py +8 -12
  101. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/gui/widgets/result/visualization_widget.py +43 -22
  102. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/gui/widgets/result/vois_widget.py +207 -19
  103. pyradplan-0.5.0/pyRadPlan/gui/widgets/workflow/__init__.py +5 -0
  104. pyradplan-0.5.0/pyRadPlan/gui/widgets/workflow/_binary_import_dialog.py +193 -0
  105. pyradplan-0.5.0/pyRadPlan/gui/widgets/workflow/_dicom_import_dialog.py +132 -0
  106. pyradplan-0.5.0/pyRadPlan/gui/widgets/workflow/_image_import_dialog.py +172 -0
  107. pyradplan-0.5.0/pyRadPlan/gui/widgets/workflow/_workflow_widget.py +1301 -0
  108. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/gui/windows/_analysis_win.py +1 -1
  109. pyradplan-0.5.0/pyRadPlan/gui/windows/_main_win.py +247 -0
  110. pyradplan-0.5.0/pyRadPlan/gui/windows/_result_win.py +125 -0
  111. pyradplan-0.5.0/pyRadPlan/gui/workspace.py +140 -0
  112. pyradplan-0.5.0/pyRadPlan/io/__init__.py +70 -0
  113. pyradplan-0.5.0/pyRadPlan/io/_factory.py +140 -0
  114. pyradplan-0.5.0/pyRadPlan/io/_helpers.py +52 -0
  115. pyradplan-0.5.0/pyRadPlan/io/_load_save.py +234 -0
  116. pyradplan-0.5.0/pyRadPlan/io/base/__init__.py +6 -0
  117. pyradplan-0.5.0/pyRadPlan/io/base/_exporter.py +63 -0
  118. pyradplan-0.5.0/pyRadPlan/io/base/_importer.py +129 -0
  119. pyradplan-0.5.0/pyRadPlan/io/dicom/__init__.py +11 -0
  120. pyradplan-0.5.0/pyRadPlan/io/dicom/_export_common.py +65 -0
  121. pyradplan-0.5.0/pyRadPlan/io/dicom/_export_cst.py +152 -0
  122. pyradplan-0.5.0/pyRadPlan/io/dicom/_export_ct.py +82 -0
  123. pyradplan-0.5.0/pyRadPlan/io/dicom/_export_dose.py +88 -0
  124. pyradplan-0.5.0/pyRadPlan/io/dicom/_export_seg.py +155 -0
  125. pyradplan-0.5.0/pyRadPlan/io/dicom/_exporter.py +82 -0
  126. pyradplan-0.5.0/pyRadPlan/io/dicom/_handler.py +19 -0
  127. pyradplan-0.5.0/pyRadPlan/io/dicom/_helpers.py +10 -0
  128. pyradplan-0.5.0/pyRadPlan/io/dicom/_import_cst.py +426 -0
  129. pyradplan-0.5.0/pyRadPlan/io/dicom/_import_ct.py +73 -0
  130. pyradplan-0.5.0/pyRadPlan/io/dicom/_import_dose.py +123 -0
  131. pyradplan-0.5.0/pyRadPlan/io/dicom/_importer.py +294 -0
  132. pyradplan-0.5.0/pyRadPlan/io/matlab/__init__.py +16 -0
  133. pyradplan-0.5.0/pyRadPlan/io/matlab/_exporter.py +60 -0
  134. pyradplan-0.5.0/pyRadPlan/io/matlab/_handler.py +10 -0
  135. pyradplan-0.5.0/pyRadPlan/io/matlab/_importer.py +138 -0
  136. pyradplan-0.5.0/pyRadPlan/io/matlab/_matfile.py +93 -0
  137. pyradplan-0.5.0/pyRadPlan/io/npz/__init__.py +11 -0
  138. pyradplan-0.5.0/pyRadPlan/io/npz/_exporter.py +76 -0
  139. pyradplan-0.5.0/pyRadPlan/io/npz/_handler.py +10 -0
  140. pyradplan-0.5.0/pyRadPlan/io/npz/_importer.py +79 -0
  141. pyradplan-0.5.0/pyRadPlan/io/npz/_serialize.py +44 -0
  142. pyradplan-0.5.0/pyRadPlan/io/pickle/__init__.py +18 -0
  143. pyradplan-0.5.0/pyRadPlan/io/pickle/_exporter.py +43 -0
  144. pyradplan-0.5.0/pyRadPlan/io/pickle/_handler.py +10 -0
  145. pyradplan-0.5.0/pyRadPlan/io/pickle/_importer.py +54 -0
  146. pyradplan-0.5.0/pyRadPlan/io/sitk_based/__init__.py +41 -0
  147. pyradplan-0.5.0/pyRadPlan/io/sitk_based/_binary_import.py +278 -0
  148. pyradplan-0.5.0/pyRadPlan/io/sitk_based/base/__init__.py +6 -0
  149. pyradplan-0.5.0/pyRadPlan/io/sitk_based/base/_exporter.py +90 -0
  150. pyradplan-0.5.0/pyRadPlan/io/sitk_based/base/_importer.py +78 -0
  151. pyradplan-0.5.0/pyRadPlan/io/sitk_based/base/_serialize.py +253 -0
  152. pyradplan-0.5.0/pyRadPlan/io/sitk_based/meta_image/__init__.py +35 -0
  153. pyradplan-0.5.0/pyRadPlan/io/sitk_based/nifti/__init__.py +35 -0
  154. pyradplan-0.5.0/pyRadPlan/io/sitk_based/nrrd/__init__.py +35 -0
  155. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/_load.py +0 -5
  156. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/base/_beam_modifier.py +1 -1
  157. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/particles/_base.py +3 -3
  158. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/particles/_beam_emittance.py +2 -2
  159. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/particles/_beam_energy.py +2 -2
  160. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/particles/kernel/_base.py +1 -1
  161. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/photons/_linac.py +1 -1
  162. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/photons/_svd_kernel.py +1 -1
  163. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/matRad/_engine.py +1 -0
  164. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/matRad/_matlab.py +1 -0
  165. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/matRad/_octave.py +1 -0
  166. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/__init__.py +2 -2
  167. pyradplan-0.5.0/pyRadPlan/optimization/_fluence_optimization.py +114 -0
  168. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/objectives/__init__.py +7 -1
  169. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/objectives/_eud.py +18 -6
  170. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/objectives/_factory.py +60 -7
  171. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/objectives/_max_dvh.py +15 -4
  172. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/objectives/_mean.py +13 -5
  173. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/objectives/_min_dvh.py +15 -4
  174. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/objectives/_objective.py +71 -10
  175. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/objectives/_squared_dev.py +7 -3
  176. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/objectives/_squared_mimicking.py +4 -4
  177. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/objectives/_squared_over.py +7 -3
  178. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/objectives/_squared_under.py +7 -3
  179. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/objectives/_std.py +3 -1
  180. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/problems/_nonlin_fluence.py +7 -2
  181. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/problems/_optiprob.py +121 -14
  182. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/problems/_simple_least_squares.py +9 -6
  183. pyradplan-0.5.0/pyRadPlan/optimization/solvers/__init__.py +51 -0
  184. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/solvers/_base_solvers.py +23 -29
  185. pyradplan-0.5.0/pyRadPlan/optimization/solvers/_factory.py +95 -0
  186. pyradplan-0.5.0/pyRadPlan/optimization/solvers/_ipopt.py +297 -0
  187. pyradplan-0.5.0/pyRadPlan/optimization/solvers/_scipy_solver.py +202 -0
  188. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/plan/_plans.py +17 -27
  189. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/quantities/_base.py +1 -0
  190. pyradplan-0.5.0/pyRadPlan/quantities/_let.py +56 -0
  191. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/quantities/_let_x_dose.py +1 -1
  192. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/raytracer/__init__.py +4 -1
  193. pyradplan-0.5.0/pyRadPlan/raytracer/_base.py +428 -0
  194. pyradplan-0.5.0/pyRadPlan/raytracer/_kernels.py +177 -0
  195. pyradplan-0.5.0/pyRadPlan/raytracer/_kernels_numba.py +128 -0
  196. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/raytracer/_siddon.py +159 -171
  197. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/scenarios/__init__.py +18 -6
  198. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/scenarios/_base.py +5 -5
  199. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/scenarios/_nominal.py +1 -1
  200. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/_beam.py +19 -2
  201. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/_beamlet.py +4 -4
  202. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/_rangeshifter.py +1 -1
  203. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/_ray.py +2 -2
  204. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/_steeringinformation.py +1 -1
  205. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/generators/_base.py +4 -2
  206. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/generators/_externalbeam.py +2 -3
  207. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/generators/_ions.py +4 -2
  208. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/generators/_vhee.py +7 -0
  209. pyradplan-0.5.0/pyRadPlan/util/__init__.py +27 -0
  210. pyradplan-0.5.0/pyRadPlan/util/_jupyter.py +17 -0
  211. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/util/helpers.py +3 -3
  212. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/util/keyboard_listener.py +2 -1
  213. pyradplan-0.5.0/pyRadPlan/util/logging_utils.py +254 -0
  214. pyradplan-0.5.0/pyRadPlan/util/openmp.py +313 -0
  215. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/visualization/_plot_multiple_slices.py +2 -0
  216. {pyradplan-0.4.0 → pyradplan-0.5.0/pyRadPlan.egg-info}/PKG-INFO +55 -8
  217. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan.egg-info/SOURCES.txt +156 -12
  218. pyradplan-0.5.0/pyRadPlan.egg-info/entry_points.txt +2 -0
  219. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan.egg-info/requires.txt +17 -1
  220. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyproject.toml +59 -9
  221. pyradplan-0.5.0/test/ai/agents/test_cst_agents.py +139 -0
  222. pyradplan-0.5.0/test/ai/agents/test_models.py +81 -0
  223. pyradplan-0.5.0/test/ai/agents/test_plan_agents.py +88 -0
  224. pyradplan-0.5.0/test/ai/agents/test_usage.py +44 -0
  225. pyradplan-0.5.0/test/ai/modelhub/conftest.py +34 -0
  226. pyradplan-0.5.0/test/ai/modelhub/test_load_model.py +54 -0
  227. pyradplan-0.5.0/test/ai/modelhub/test_loader_machinery.py +232 -0
  228. pyradplan-0.5.0/test/ai/modelhub/test_preprocessor.py +29 -0
  229. pyradplan-0.5.0/test/ai/modelhub/test_registry.py +149 -0
  230. pyradplan-0.5.0/test/ai/modelhub/test_resolve.py +235 -0
  231. pyradplan-0.5.0/test/analysis/test_dvh.py +187 -0
  232. pyradplan-0.5.0/test/analysis/test_qi.py +368 -0
  233. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/conftest.py +9 -2
  234. pyradplan-0.5.0/test/core/test_configurable.py +213 -0
  235. pyradplan-0.5.0/test/core/test_paths.py +42 -0
  236. pyradplan-0.5.0/test/core/test_progress.py +195 -0
  237. pyradplan-0.5.0/test/core/xp_utils/compat/test_backend_consistency.py +152 -0
  238. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/core/xp_utils/compat/test_math_interp1d.py +15 -0
  239. pyradplan-0.5.0/test/core/xp_utils/helpers/test_device_parsing.py +91 -0
  240. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/core/xp_utils/helpers/test_namespace_conversion.py +145 -3
  241. pyradplan-0.5.0/test/core/xp_utils/helpers/test_openblas_warning.py +69 -0
  242. pyradplan-0.5.0/test/core/xp_utils/helpers/test_scatter.py +45 -0
  243. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/core/xp_utils/test_initialization.py +74 -25
  244. pyradplan-0.5.0/test/cst/test_VOI.py +1159 -0
  245. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/cst/test_cst.py +341 -1
  246. pyradplan-0.5.0/test/data/ai_models/dummy_model/model.py +31 -0
  247. pyradplan-0.5.0/test/data/ai_models/dummy_model/preprocessor.py +16 -0
  248. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/data/test_validate_test_data.py +28 -0
  249. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/dose/conftest.py +17 -0
  250. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/dose/test_fred.py +8 -0
  251. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/dose/test_hongpb.py +25 -3
  252. pyradplan-0.5.0/test/dose/test_svdpb.py +79 -0
  253. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/gui/conftest.py +11 -0
  254. pyradplan-0.5.0/test/gui/test_gui_disabled.py +35 -0
  255. pyradplan-0.5.0/test/gui/test_workspace.py +63 -0
  256. pyradplan-0.5.0/test/gui/widgets/ai/test_ai_task_dialog.py +100 -0
  257. pyradplan-0.5.0/test/gui/widgets/optimization/test_status_window.py +71 -0
  258. pyradplan-0.5.0/test/gui/widgets/optimization/test_widget_optimization.py +380 -0
  259. pyradplan-0.5.0/test/gui/widgets/plan/test_widget_plan.py +336 -0
  260. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/gui/widgets/result/test_widget_viewer_options.py +3 -3
  261. pyradplan-0.5.0/test/gui/widgets/result/test_widget_vois.py +193 -0
  262. pyradplan-0.5.0/test/gui/widgets/test_base.py +79 -0
  263. pyradplan-0.5.0/test/gui/widgets/test_config_form.py +108 -0
  264. pyradplan-0.5.0/test/gui/widgets/test_widget_result.py +132 -0
  265. pyradplan-0.5.0/test/gui/widgets/workflow/test_import_dialogs.py +237 -0
  266. pyradplan-0.5.0/test/gui/widgets/workflow/test_widget_workflow.py +345 -0
  267. pyradplan-0.5.0/test/gui/windows/test_win_main.py +203 -0
  268. pyradplan-0.5.0/test/io/conftest.py +47 -0
  269. pyradplan-0.5.0/test/io/test_io_binary_import.py +203 -0
  270. pyradplan-0.5.0/test/io/test_io_dicom.py +731 -0
  271. pyradplan-0.5.0/test/io/test_io_factory.py +93 -0
  272. pyradplan-0.5.0/test/io/test_io_frontend.py +79 -0
  273. pyradplan-0.5.0/test/io/test_io_matlab.py +169 -0
  274. pyradplan-0.5.0/test/io/test_io_npz.py +100 -0
  275. pyradplan-0.5.0/test/io/test_io_pickle.py +83 -0
  276. pyradplan-0.5.0/test/io/test_io_sitk.py +263 -0
  277. pyradplan-0.5.0/test/optimization/conftest.py +26 -0
  278. pyradplan-0.5.0/test/optimization/test_fluence_optiprob.py +162 -0
  279. pyradplan-0.5.0/test/optimization/test_ipopt_output.py +123 -0
  280. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/optimization/test_ipopt_solver.py +16 -8
  281. pyradplan-0.5.0/test/optimization/test_obj_history.py +63 -0
  282. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/optimization/test_objectives.py +59 -1
  283. pyradplan-0.5.0/test/optimization/test_opt_info.py +159 -0
  284. pyradplan-0.5.0/test/optimization/test_scipy_solver.py +220 -0
  285. pyradplan-0.5.0/test/optimization/test_solver_factory.py +79 -0
  286. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/quantities/test_let_dose_quantity.py +1 -1
  287. pyradplan-0.5.0/test/quantities/test_let_quantity.py +137 -0
  288. pyradplan-0.5.0/test/test_logging_utils.py +355 -0
  289. pyradplan-0.5.0/test/test_openmp.py +280 -0
  290. pyradplan-0.5.0/test/test_raytracer_kernels.py +173 -0
  291. pyradplan-0.5.0/test/test_raytracersiddon.py +245 -0
  292. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/test_scenarios.py +34 -0
  293. pyradplan-0.5.0/test/test_settings.py +116 -0
  294. pyradplan-0.4.0/docs/conf.py +0 -58
  295. pyradplan-0.4.0/examples/proton_mc_fred.py +0 -123
  296. pyradplan-0.4.0/examples/proton_mc_topas.py +0 -58
  297. pyradplan-0.4.0/examples/utils_matrad.py +0 -75
  298. pyradplan-0.4.0/pyRadPlan/ai_agents/__init__.py +0 -11
  299. pyradplan-0.4.0/pyRadPlan/ai_agents/_cst_agents.py +0 -142
  300. pyradplan-0.4.0/pyRadPlan/ai_agents/_plan_agents.py +0 -57
  301. pyradplan-0.4.0/pyRadPlan/ai_agents/_settings.py +0 -35
  302. pyradplan-0.4.0/pyRadPlan/analysis/__init__.py +0 -8
  303. pyradplan-0.4.0/pyRadPlan/core/__init__.py +0 -15
  304. pyradplan-0.4.0/pyRadPlan/core/_grids.py +0 -231
  305. pyradplan-0.4.0/pyRadPlan/core/xp_utils/__init__.py +0 -182
  306. pyradplan-0.4.0/pyRadPlan/core/xp_utils/helpers.py +0 -706
  307. pyradplan-0.4.0/pyRadPlan/cst/_cst.py +0 -515
  308. pyradplan-0.4.0/pyRadPlan/cst/_voi.py +0 -696
  309. pyradplan-0.4.0/pyRadPlan/dose/engines/_base_montecarlo.py +0 -8
  310. pyradplan-0.4.0/pyRadPlan/gui/__init__.py +0 -25
  311. pyradplan-0.4.0/pyRadPlan/gui/apps.py +0 -54
  312. pyradplan-0.4.0/pyRadPlan/gui/menus/_file.py +0 -8
  313. pyradplan-0.4.0/pyRadPlan/gui/menus/_view.py +0 -8
  314. pyradplan-0.4.0/pyRadPlan/gui/widgets/__init__.py +0 -5
  315. pyradplan-0.4.0/pyRadPlan/gui/widgets/_result_widget.py +0 -274
  316. pyradplan-0.4.0/pyRadPlan/gui/windows/_result_win.py +0 -244
  317. pyradplan-0.4.0/pyRadPlan/io/__init__.py +0 -6
  318. pyradplan-0.4.0/pyRadPlan/io/_matlab_file_handler.py +0 -31
  319. pyradplan-0.4.0/pyRadPlan/io/_patient_loader.py +0 -135
  320. pyradplan-0.4.0/pyRadPlan/io/matfile.py +0 -35
  321. pyradplan-0.4.0/pyRadPlan/optimization/_fluence_optimization.py +0 -47
  322. pyradplan-0.4.0/pyRadPlan/optimization/solvers/__init__.py +0 -27
  323. pyradplan-0.4.0/pyRadPlan/optimization/solvers/_factory.py +0 -74
  324. pyradplan-0.4.0/pyRadPlan/optimization/solvers/_ipopt.py +0 -191
  325. pyradplan-0.4.0/pyRadPlan/optimization/solvers/_scipy_solver.py +0 -102
  326. pyradplan-0.4.0/pyRadPlan/quantities/_let.py +0 -24
  327. pyradplan-0.4.0/pyRadPlan/raytracer/_base.py +0 -367
  328. pyradplan-0.4.0/pyRadPlan/raytracer/_numba_perf.py +0 -33
  329. pyradplan-0.4.0/pyRadPlan/util/__init__.py +0 -10
  330. pyradplan-0.4.0/test/analysis/test_dvh.py +0 -70
  331. pyradplan-0.4.0/test/analysis/test_qi.py +0 -1
  332. pyradplan-0.4.0/test/cst/test_VOI.py +0 -491
  333. pyradplan-0.4.0/test/dose/test_svdpb.py +0 -32
  334. pyradplan-0.4.0/test/gui/widgets/result/test_widget_vois.py +0 -56
  335. pyradplan-0.4.0/test/gui/widgets/test_widget_result.py +0 -68
  336. pyradplan-0.4.0/test/optimization/test_fluence_optiprob.py +0 -23
  337. pyradplan-0.4.0/test/optimization/test_scipy_solver.py +0 -35
  338. pyradplan-0.4.0/test/optimization/test_solver_factory.py +0 -31
  339. pyradplan-0.4.0/test/test_fileHandling.py +0 -79
  340. pyradplan-0.4.0/test/test_raytracersiddon.py +0 -126
  341. {pyradplan-0.4.0 → pyradplan-0.5.0}/LICENSE +0 -0
  342. {pyradplan-0.4.0 → pyradplan-0.5.0}/benchmark/benchmark_interp1d.py +0 -0
  343. {pyradplan-0.4.0 → pyradplan-0.5.0}/benchmark/benchmark_interpnd.py +0 -0
  344. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/intro_minimal_photons.py +0 -0
  345. {pyradplan-0.4.0 → pyradplan-0.5.0}/examples/intro_minimal_protons.py +0 -0
  346. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/core/_exceptions.py +0 -0
  347. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/core/datamodel.py +0 -0
  348. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/core/np2sitk.py +0 -0
  349. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/core/resample.py +0 -0
  350. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/core/xp_utils/typing.py +0 -0
  351. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/cst/__init__.py +0 -0
  352. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/ct/__init__.py +0 -0
  353. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/ct/_hlut.py +0 -0
  354. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/TOPAS/input/beam_setup/TOPAS_beam_setup_biGaussian.txt.in +0 -0
  355. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/TOPAS/input/material_converter/TOPAS_schneider_converter.txt.in +0 -0
  356. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/TOPAS/input/scorer/TOPAS_scorer_doseToMedium.txt.in +0 -0
  357. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/TOPAS/input/scorer/TOPAS_scorer_doseToWater.txt.in +0 -0
  358. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/TOPAS/input/scorer/TOPAS_subscorer_LET.txt.in +0 -0
  359. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/TOPAS/input/template/beamSetup_template.txt +0 -0
  360. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/TOPAS/input/template/patient_template.txt +0 -0
  361. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/TOPAS/input/template/pyRadPlan_run_template.txt +0 -0
  362. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/machines/VHEE_Focused.mat +0 -0
  363. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/machines/VHEE_Generic.mat +0 -0
  364. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/machines/carbon_Generic.mat +0 -0
  365. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/machines/helium_Generic.mat +0 -0
  366. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/machines/photons_Generic.mat +0 -0
  367. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/machines/protons_Generic.mat +0 -0
  368. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/data/phantoms/TG119.mat +0 -0
  369. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dij/__init__.py +0 -0
  370. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dij/_compose_beam_dijs.py +0 -0
  371. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dij/_dij.py +0 -0
  372. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dose/__init__.py +0 -0
  373. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dose/engines/__init__.py +0 -0
  374. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dose/engines/_topasmc.py +0 -0
  375. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dose/engines/kernels/__init__.py +0 -0
  376. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/dose/engines/kernels/_calc_geo_dists_kernel.py +0 -0
  377. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/geometry/__init__.py +0 -0
  378. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/geometry/lps.py +0 -0
  379. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/gui/menus/_edit.py +0 -0
  380. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/gui/menus/_help.py +0 -0
  381. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/gui/widgets/analysis/_gamma.py +0 -0
  382. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/gui/widgets/analysis/_qi.py +0 -0
  383. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/gui/widgets/result/__init__.py +0 -0
  384. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/gui/widgets/result/_labels.py +0 -0
  385. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/__init__.py +0 -0
  386. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/_validate.py +0 -0
  387. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/base/__init__.py +0 -0
  388. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/base/_base.py +0 -0
  389. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/base/_external_beam.py +0 -0
  390. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/base/_factory.py +0 -0
  391. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/base/_internal_beam.py +0 -0
  392. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/particles/__init__.py +0 -0
  393. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/particles/_beam_cutoff.py +0 -0
  394. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/particles/_beam_focus.py +0 -0
  395. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/particles/_ions.py +0 -0
  396. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/particles/_vhee.py +0 -0
  397. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/particles/kernel/__init__.py +0 -0
  398. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/particles/kernel/_ions.py +0 -0
  399. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/particles/kernel/_vhee.py +0 -0
  400. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/photons/__init__.py +0 -0
  401. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/photons/_base.py +0 -0
  402. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/machines/photons/_calculate_machine_scale.py +0 -0
  403. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/matRad/__init__.py +0 -0
  404. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/problems/__init__.py +0 -0
  405. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/optimization/problems/_factory.py +0 -0
  406. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/plan/__init__.py +0 -0
  407. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/quantities/__init__.py +0 -0
  408. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/quantities/_alpha_dose.py +0 -0
  409. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/quantities/_dose.py +0 -0
  410. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/quantities/_effect.py +0 -0
  411. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/quantities/_rbe_x_dose.py +0 -0
  412. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/quantities/_resolver.py +0 -0
  413. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/quantities/_sqrt_beta_dose.py +0 -0
  414. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/__init__.py +0 -0
  415. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/_exceptions.py +0 -0
  416. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/_generate_stf.py +0 -0
  417. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/generators/__init__.py +0 -0
  418. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/generators/_factory.py +0 -0
  419. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/stf/generators/_photons.py +0 -0
  420. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/visualization/__init__.py +0 -0
  421. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan/visualization/_plot_slice.py +0 -0
  422. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan.egg-info/dependency_links.txt +0 -0
  423. {pyradplan-0.4.0 → pyradplan-0.5.0}/pyRadPlan.egg-info/top_level.txt +0 -0
  424. {pyradplan-0.4.0 → pyradplan-0.5.0}/setup.cfg +0 -0
  425. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/core/test_coordinates.py +0 -0
  426. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/core/test_datamodel.py +0 -0
  427. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/core/test_np2sitk.py +0 -0
  428. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/core/test_resample.py +0 -0
  429. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/core/xp_utils/compat/test_interp1d_torch.py +0 -0
  430. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/core/xp_utils/compat/test_interpnd.py +0 -0
  431. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/core/xp_utils/compat/test_math_quantile.py +0 -0
  432. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/cst/conftest.py +0 -0
  433. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/ct/test_ct.py +0 -0
  434. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/ct/test_hlut.py +0 -0
  435. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/dose/kernels/test_calc_geo_dists.py +0 -0
  436. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/dose/test_base_pencilbeam.py +0 -0
  437. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/dose/test_dose_engine_base.py +0 -0
  438. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/dose/test_factory.py +0 -0
  439. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/dose/test_pb_geodist.py +0 -0
  440. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/dose/test_topas.py +0 -0
  441. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/geometry/test_lps.py +0 -0
  442. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/gui/widgets/analysis/test_widget_analysis.py +0 -0
  443. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/gui/widgets/analysis/test_widget_dvh.py +0 -0
  444. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/gui/widgets/analysis/test_widget_gamma.py +0 -0
  445. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/gui/widgets/analysis/test_widget_qi.py +0 -0
  446. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/gui/widgets/result/test_widget_quantity.py +0 -0
  447. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/gui/widgets/result/test_widget_visualization.py +0 -0
  448. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/gui/windows/test_win_analysis.py +0 -0
  449. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/gui/windows/test_win_result.py +0 -0
  450. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/machines/test_beam_modifiers.py +0 -0
  451. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/optimization/test_problem_factory.py +0 -0
  452. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/quantities/test_alpha_dose_quantity.py +0 -0
  453. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/quantities/test_dose_quantity.py +0 -0
  454. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/quantities/test_effect_quantity.py +0 -0
  455. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/quantities/test_rbe_x_dose_quantity.py +0 -0
  456. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/quantities/test_resolver.py +0 -0
  457. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/quantities/test_sqrt_beta_dose_quantity.py +0 -0
  458. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/stf/test_beamlet.py +0 -0
  459. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/stf/test_stf.py +0 -0
  460. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/stf/test_stf_gen.py +0 -0
  461. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/test_dij.py +0 -0
  462. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/test_grid.py +0 -0
  463. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/test_helpers.py +0 -0
  464. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/test_machine_model.py +0 -0
  465. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/test_matlabEngine.py +0 -0
  466. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/test_octaveEngine.py +0 -0
  467. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/test_plan.py +0 -0
  468. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/visualization/test_plot_multiple_slices.py +0 -0
  469. {pyradplan-0.4.0 → pyradplan-0.5.0}/test/visualization/test_plot_slice.py +0 -0
@@ -1,18 +1,18 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyRadPlan
3
- Version: 0.4.0
3
+ Version: 0.5.0
4
4
  Summary: A python interface and reimplementation to matRad
5
- Author-email: Niklas Wahl <n.wahl@dkfz-heidelberg.de>, Tobias Becher <t.becher@dkfz-heidelberg.de>, Lina Bucher <lina.bucher@dkfz-heidelberg.de>, Louis Ermeneux <louis.ermeneux@gmail.com>, Antonios Kontopoulos <antonios.kontopoulos@dkfz-heidelberg.de>, Julius Laub <julius.laub@dkfz-heidelberg.de>, Florian Leininger <florian.leininger@dkfz-heidelberg.de>, Tim Ortkamp <tim.ortkamp@kit.edu>, Victoria Santiago Aguilar <victoria.santiagoaguilar@dkfz-heidelberg.de>, Goran Stanic <goran.stanic@dkfz-heidelberg.de>, Samir Schulz <samirshivaji.schulz@dkfz-heidelberg.de>, Wilfrid Wangon Zekou <wangonwil@gmail.com>, Jennifer Josephine Hardt <jennifer.hardt@dkfz-heidelberg.de>
5
+ Author-email: Niklas Wahl <n.wahl@dkfz-heidelberg.de>, Tobias Becher <t.becher@dkfz-heidelberg.de>, Maxim Braunsburger <m.braunsburger@icloud.com>, Lina Bucher <lina.bucher@dkfz-heidelberg.de>, Louis Ermeneux <louis.ermeneux@gmail.com>, Jennifer Josephine Hardt <jennifer.hardt@dkfz-heidelberg.de>, Antonios Kontopoulos <antonios.kontopoulos@dkfz-heidelberg.de>, Julius Laub <julius.laub@dkfz-heidelberg.de>, Florian Leininger <florian.leininger@dkfz-heidelberg.de>, Moritz Müller <moritz.mueller@dkfz-heidelberg.de>, Tim Ortkamp <tim.ortkamp@kit.edu>, Victoria Santiago Aguilar <victoria.santiagoaguilar@dkfz-heidelberg.de>, Goran Stanic <goran.stanic@dkfz-heidelberg.de>, Samir Schulz <samirshivaji.schulz@dkfz-heidelberg.de>, Wilfrid Wangon Zekou <wangonwil@gmail.com>
6
6
  Maintainer-email: Niklas Wahl <n.wahl@dkfz-heidelberg.de>, Florian Leininger <florian.leininger@dkfz-heidelberg.de>, Tobias Becher <t.becher@dkfz-heidelberg.de>, Tim Ortkamp <tim.ortkamp@kit.edu>
7
7
  Project-URL: Homepage, https://git.dkfz.de
8
8
  Classifier: Programming Language :: Python :: 3
9
9
  Classifier: License :: OSI Approved :: BSD License
10
10
  Classifier: Operating System :: OS Independent
11
- Requires-Python: <3.14,>=3.10
11
+ Requires-Python: <3.15,>=3.10
12
12
  Description-Content-Type: text/markdown
13
13
  License-File: LICENSE
14
14
  Requires-Dist: scipy>=1.13.0
15
- Requires-Dist: numpy<=2.3,>=2.0
15
+ Requires-Dist: numpy<2.4,>=2.0
16
16
  Requires-Dist: array_api_compat
17
17
  Requires-Dist: array_api_strict
18
18
  Requires-Dist: array_api_extra
@@ -30,6 +30,8 @@ Requires-Dist: SimpleITK>=2.4.0
30
30
  Requires-Dist: tqdm>=4.0.0
31
31
  Requires-Dist: pint>=0.24.0
32
32
  Requires-Dist: jinja2
33
+ Requires-Dist: huggingface_hub>=0.23
34
+ Requires-Dist: safetensors
33
35
  Provides-Extra: matlab
34
36
  Requires-Dist: matlabengine; extra == "matlab"
35
37
  Provides-Extra: octave
@@ -39,6 +41,14 @@ Requires-Dist: pyside6>=6.0.1; extra == "gui"
39
41
  Requires-Dist: pyqtgraph>=0.12.0; extra == "gui"
40
42
  Provides-Extra: numba
41
43
  Requires-Dist: numba>=0.61.0; extra == "numba"
44
+ Provides-Extra: torch
45
+ Requires-Dist: torch>=2.0; extra == "torch"
46
+ Provides-Extra: cupy
47
+ Requires-Dist: cupy>=13.0; extra == "cupy"
48
+ Provides-Extra: jax
49
+ Requires-Dist: jax>=0.4.35; extra == "jax"
50
+ Provides-Extra: profiling
51
+ Requires-Dist: line_profiler>=4.0; extra == "profiling"
42
52
  Provides-Extra: dev
43
53
  Requires-Dist: pytest; extra == "dev"
44
54
  Requires-Dist: coverage; extra == "dev"
@@ -51,6 +61,8 @@ Requires-Dist: pydata-sphinx-theme; extra == "dev"
51
61
  Requires-Dist: sphinx-design; extra == "dev"
52
62
  Requires-Dist: autodoc_pydantic; extra == "dev"
53
63
  Requires-Dist: sphinx-autodoc-typehints; extra == "dev"
64
+ Requires-Dist: myst-nb; extra == "dev"
65
+ Requires-Dist: jupytext; extra == "dev"
54
66
  Dynamic: license-file
55
67
 
56
68
  # pyRadPlan
@@ -68,6 +80,34 @@ pyRadPlan is an open-source radiotherapy treatment planning toolkit designed for
68
80
 
69
81
  Development is lead by the [Radiotherapy Optimization group](https://www.dkfz.de/radopt) at the [German Cancer Research Center (DKFZ)](https://www.dkfz.de)
70
82
 
83
+ ## Installation
84
+ pyRadPlan requires **Python 3.10–3.14** and is available on [PyPI](https://pypi.org/project/pyRadPlan/). We recommend installing it together with its graphical user interface:
85
+
86
+ ```sh
87
+ pip install "pyRadPlan[gui]"
88
+ ```
89
+
90
+ This additionally provides the `pyRadPlanGUI` command, which launches the matRad-style main GUI — optionally loading a patient file on startup:
91
+
92
+ ```sh
93
+ pyRadPlanGUI # empty workspace
94
+ pyRadPlanGUI path/to/TG119.mat # load a matRad patient file
95
+ ```
96
+
97
+ For headless environments (servers, compute clusters, CI) where the Qt runtime is unnecessary weight, install the scripting/API core without the GUI:
98
+
99
+ ```sh
100
+ pip install pyRadPlan
101
+ ```
102
+
103
+ Further optional extras (`[numba]`, `[matlab]`, `[octave]`, `[dev]`) are described in the documentation's [installation guide](https://pyradplan.readthedocs.io/en/latest/installation/#optional-extras).
104
+
105
+ ⚡ **Compute backends** ([docs](https://pyradplan.readthedocs.io/en/latest/installation/#gpu-alternate-compute-backends))**:** beyond [`numpy`](https://numpy.org/), pyRadPlan can use [`cupy`](https://cupy.dev/) (GPU), [`pytorch`](https://pytorch.org/) (CPU/GPU) and [`jax`](https://docs.jax.dev/) (CPU by default), available as the extras `[cupy]`, `[torch]` and `[jax]`. For GPU builds we recommend following the respective project's install instructions for your platform / CUDA version instead.
106
+
107
+ 🎲 **Monte Carlo** ([docs](https://pyradplan.readthedocs.io/en/latest/user_guide/concepts/dose_calculation.html#dose-engines))**:** the [TOPAS](https://www.topasmc.org/) and [FRED](https://fred-mc.org/) dose engines call external executables. Install those following their own instructions and make sure they are on your `PATH`.
108
+
109
+ 📉 **Solvers** ([docs](https://pyradplan.readthedocs.io/en/latest/user_guide/concepts/optimization.html#solvers))**:** pyRadPlan ships an IPOPT interface [`ipyopt`](https://pypi.org/project/ipyopt/), which has to be installed separately via `pip install ipyopt` (Linux only). Default ships with [`scipy`](https://scipy.org/)
110
+
71
111
  ## Concept and Goals
72
112
  pyRadPlan is a multi-modality treatment planning toolkit in python born from the established Matlab-based toolkit [matRad](http://www.matRad.org). As such, pyRadPlan aims to provide a framework as well as tools for combining dose calculation with optimization with focus on ion planning.
73
113
 
@@ -86,7 +126,13 @@ A minimal script is very similar to matRad's example [`matRad.m`](https://github
86
126
  ```python
87
127
  from importlib import resources
88
128
  import pymatreader
89
- from pyRadPlan import load_patient, IonPlan, generate_stf, calc_dose_influence, fluence_optimization
129
+ from pyRadPlan import (
130
+ load_patient,
131
+ IonPlan,
132
+ generate_stf,
133
+ calc_dose_influence,
134
+ fluence_optimization,
135
+ )
90
136
 
91
137
  # Read patient from provided TG119.mat file and validate data
92
138
  tg119_path = resources.files("pyRadPlan.data.phantoms").joinpath("TG119.mat")
@@ -126,6 +172,7 @@ Instead of using above top-level workflow functions and a central plan configura
126
172
  ```python
127
173
  ...
128
174
  from pyRadPlan.stf import StfGeneratorIMPT
175
+
129
176
  # Create a plan object
130
177
  pln = IonPlan(radiation_mode="protons", machine="Generic")
131
178
 
@@ -137,14 +184,14 @@ pln = IonPlan(radiation_mode="protons", machine="Generic")
137
184
  stf_gen = StfGeneratorIMPT()
138
185
  stf_gen.gantry_angles = [90, 270]
139
186
  stf_gen.couch_angles = [0, 0]
140
- stf = stf_gen.generate(ct,cst)
187
+ stf = stf_gen.generate(ct, cst)
141
188
  ```
142
189
 
143
190
  If you are interested in helping with development, get in touch, read the contributing guidelines, and the developer note below.
144
191
 
145
192
  ## Contributing & Notes for Developers
146
193
  pyRadPlan development uses unit-testing and code formatting via pre-commit hooks to ensure clean code.
147
- If you are a developer or want to contribute, make sure to clone the latest state via git. Then, we strongly suggest to create a virtual python environment with a suitable version and do an editable installation of pyRadPlan in dev mode: `pip install -e .[dev]`
194
+ If you are a developer or want to contribute, make sure to clone the latest state via git. Then, we strongly suggest to create a virtual python environment with a suitable version and do an editable installation of pyRadPlan in dev mode: `pip install -e ".[dev,gui]"` (the `gui` extra is needed to run the GUI test suite)
148
195
 
149
196
  > **Note**
150
197
  > If you are using venv to create a virtual environment in the project's root folder, we suggest to name it `.venv` as this folder will be automatically excluded by all formatters and linters
@@ -153,7 +200,7 @@ This will install an editable pyRadPlan module including `pytest` and `pre-commi
153
200
  - **pytest** is used to run unit tests before publishing the code. Run on the test folder via `pytest test`, or choose any test file following the pytest syntax. We encourage writing at least fundamental unit tests for new code. Will also install `coverage` and the pytest extension to monitor coverage.
154
201
  - **pre-commit** allows for automatic code formatting to ensure following of PEPs (mainly PEP8 and PEP257).
155
202
 
156
- After successfully running `pip install -e .[dev]` check in the console that `pre-commit --version` provides a correct response.
203
+ After successfully running `pip install -e ".[dev,gui]"` check in the console that `pre-commit --version` provides a correct response.
157
204
  Afterwards run `pre-commit install`. This reads the `.pre-commit_config.yaml` and adds a hook to your git repository, which whenever a commit is made the changed files are reformatted to ensure the PEP standards.
158
205
 
159
206
  ### Matlab / Octave Files & Engine
@@ -13,6 +13,34 @@ pyRadPlan is an open-source radiotherapy treatment planning toolkit designed for
13
13
 
14
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)
15
15
 
16
+ ## Installation
17
+ pyRadPlan requires **Python 3.10–3.14** and is available on [PyPI](https://pypi.org/project/pyRadPlan/). We recommend installing it together with its graphical user interface:
18
+
19
+ ```sh
20
+ pip install "pyRadPlan[gui]"
21
+ ```
22
+
23
+ This additionally provides the `pyRadPlanGUI` command, which launches the matRad-style main GUI — optionally loading a patient file on startup:
24
+
25
+ ```sh
26
+ pyRadPlanGUI # empty workspace
27
+ pyRadPlanGUI path/to/TG119.mat # load a matRad patient file
28
+ ```
29
+
30
+ For headless environments (servers, compute clusters, CI) where the Qt runtime is unnecessary weight, install the scripting/API core without the GUI:
31
+
32
+ ```sh
33
+ pip install pyRadPlan
34
+ ```
35
+
36
+ Further optional extras (`[numba]`, `[matlab]`, `[octave]`, `[dev]`) are described in the documentation's [installation guide](https://pyradplan.readthedocs.io/en/latest/installation/#optional-extras).
37
+
38
+ ⚡ **Compute backends** ([docs](https://pyradplan.readthedocs.io/en/latest/installation/#gpu-alternate-compute-backends))**:** beyond [`numpy`](https://numpy.org/), pyRadPlan can use [`cupy`](https://cupy.dev/) (GPU), [`pytorch`](https://pytorch.org/) (CPU/GPU) and [`jax`](https://docs.jax.dev/) (CPU by default), available as the extras `[cupy]`, `[torch]` and `[jax]`. For GPU builds we recommend following the respective project's install instructions for your platform / CUDA version instead.
39
+
40
+ 🎲 **Monte Carlo** ([docs](https://pyradplan.readthedocs.io/en/latest/user_guide/concepts/dose_calculation.html#dose-engines))**:** the [TOPAS](https://www.topasmc.org/) and [FRED](https://fred-mc.org/) dose engines call external executables. Install those following their own instructions and make sure they are on your `PATH`.
41
+
42
+ 📉 **Solvers** ([docs](https://pyradplan.readthedocs.io/en/latest/user_guide/concepts/optimization.html#solvers))**:** pyRadPlan ships an IPOPT interface [`ipyopt`](https://pypi.org/project/ipyopt/), which has to be installed separately via `pip install ipyopt` (Linux only). Default ships with [`scipy`](https://scipy.org/)
43
+
16
44
  ## Concept and Goals
17
45
  pyRadPlan is a multi-modality treatment planning toolkit in python born from the established Matlab-based toolkit [matRad](http://www.matRad.org). As such, pyRadPlan aims to provide a framework as well as tools for combining dose calculation with optimization with focus on ion planning.
18
46
 
@@ -31,7 +59,13 @@ A minimal script is very similar to matRad's example [`matRad.m`](https://github
31
59
  ```python
32
60
  from importlib import resources
33
61
  import pymatreader
34
- from pyRadPlan import load_patient, IonPlan, generate_stf, calc_dose_influence, fluence_optimization
62
+ from pyRadPlan import (
63
+ load_patient,
64
+ IonPlan,
65
+ generate_stf,
66
+ calc_dose_influence,
67
+ fluence_optimization,
68
+ )
35
69
 
36
70
  # Read patient from provided TG119.mat file and validate data
37
71
  tg119_path = resources.files("pyRadPlan.data.phantoms").joinpath("TG119.mat")
@@ -71,6 +105,7 @@ Instead of using above top-level workflow functions and a central plan configura
71
105
  ```python
72
106
  ...
73
107
  from pyRadPlan.stf import StfGeneratorIMPT
108
+
74
109
  # Create a plan object
75
110
  pln = IonPlan(radiation_mode="protons", machine="Generic")
76
111
 
@@ -82,14 +117,14 @@ pln = IonPlan(radiation_mode="protons", machine="Generic")
82
117
  stf_gen = StfGeneratorIMPT()
83
118
  stf_gen.gantry_angles = [90, 270]
84
119
  stf_gen.couch_angles = [0, 0]
85
- stf = stf_gen.generate(ct,cst)
120
+ stf = stf_gen.generate(ct, cst)
86
121
  ```
87
122
 
88
123
  If you are interested in helping with development, get in touch, read the contributing guidelines, and the developer note below.
89
124
 
90
125
  ## Contributing & Notes for Developers
91
126
  pyRadPlan development uses unit-testing and code formatting via pre-commit hooks to ensure clean code.
92
- If you are a developer or want to contribute, make sure to clone the latest state via git. Then, we strongly suggest to create a virtual python environment with a suitable version and do an editable installation of pyRadPlan in dev mode: `pip install -e .[dev]`
127
+ If you are a developer or want to contribute, make sure to clone the latest state via git. Then, we strongly suggest to create a virtual python environment with a suitable version and do an editable installation of pyRadPlan in dev mode: `pip install -e ".[dev,gui]"` (the `gui` extra is needed to run the GUI test suite)
93
128
 
94
129
  > **Note**
95
130
  > If you are using venv to create a virtual environment in the project's root folder, we suggest to name it `.venv` as this folder will be automatically excluded by all formatters and linters
@@ -98,7 +133,7 @@ This will install an editable pyRadPlan module including `pytest` and `pre-commi
98
133
  - **pytest** is used to run unit tests before publishing the code. Run on the test folder via `pytest test`, or choose any test file following the pytest syntax. We encourage writing at least fundamental unit tests for new code. Will also install `coverage` and the pytest extension to monitor coverage.
99
134
  - **pre-commit** allows for automatic code formatting to ensure following of PEPs (mainly PEP8 and PEP257).
100
135
 
101
- After successfully running `pip install -e .[dev]` check in the console that `pre-commit --version` provides a correct response.
136
+ After successfully running `pip install -e ".[dev,gui]"` check in the console that `pre-commit --version` provides a correct response.
102
137
  Afterwards run `pre-commit install`. This reads the `.pre-commit_config.yaml` and adds a hook to your git repository, which whenever a commit is made the changed files are reformatted to ensure the PEP standards.
103
138
 
104
139
  ### Matlab / Octave Files & Engine
@@ -4,6 +4,7 @@ import numpy as np
4
4
  import pytest
5
5
  import SimpleITK as sitk
6
6
 
7
+ from pyRadPlan.geometry import lps
7
8
  from pyRadPlan.raytracer import RayTracerSiddon
8
9
  from pyRadPlan.stf._beam import Beam
9
10
  from pyRadPlan.stf._ray import Ray
@@ -51,12 +52,18 @@ def _make_beam(iso_center, n_rays=1, sad=1000.0, gantry_angle=0.0):
51
52
  if count >= n_rays:
52
53
  break
53
54
 
55
+ # Explicit consistent source points so the benchmark is comparable across
56
+ # pyRadPlan versions with and without the Beam source-point derivation
57
+ source_point_bev = np.array([0.0, -sad, 0.0])
58
+ rot_mat = lps.get_beam_rotation_matrix(gantry_angle, 0.0)
54
59
  return Beam(
55
60
  gantry_angle=gantry_angle,
56
61
  couch_angle=0.0,
57
62
  iso_center=np.array(iso_center, dtype=np.float64),
58
63
  rays=rays,
59
64
  SAD=sad,
65
+ source_point_bev=source_point_bev,
66
+ source_point=rot_mat @ source_point_bev,
60
67
  )
61
68
 
62
69
 
@@ -0,0 +1,273 @@
1
+ """Line-profiler harness for the photon forward pencilbeam example.
2
+
3
+ This script keeps the workflow in functions so line_profiler can instrument it,
4
+ and it touches the selected backend once at startup to include backend setup
5
+ costs in the profile.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import argparse
11
+ import logging
12
+ from typing import Any
13
+
14
+ import matplotlib.pyplot as plt
15
+ import numpy as np
16
+ from line_profiler import LineProfiler
17
+
18
+ from pyRadPlan import (
19
+ PhotonPlan,
20
+ calc_dose_forward,
21
+ generate_stf,
22
+ load_tg119,
23
+ plot_slice,
24
+ settings,
25
+ xp_utils,
26
+ )
27
+ from pyRadPlan.dose.engines._base_pencilbeam import PencilBeamEngineAbstract
28
+ from pyRadPlan.dose.engines._base import DoseEngineBase
29
+ from pyRadPlan.dose.engines._svdpb import PhotonPencilBeamSVDEngine
30
+ from pyRadPlan.machines import create_bld
31
+ from pyRadPlan.machines.photons._calculate_machine_scale import central_axis_peak
32
+ from pyRadPlan.stf import FieldShapeAsBLD, FieldShapeComposite
33
+
34
+ logger = logging.getLogger(__name__)
35
+
36
+
37
+ def configure_backend(prefer_gpu: bool = True, backend_name: str = "jax") -> Any:
38
+ """Configure preferred backend and touch it once to include init overhead."""
39
+ settings.xp.prefer_gpu = prefer_gpu
40
+ settings.xp.preferred_cpu_array_backend = backend_name
41
+ settings.xp.preferred_gpu_array_backend = backend_name
42
+
43
+ xp = xp_utils.choose_array_api_namespace()
44
+ _ = xp_utils.choose_device(xp)
45
+
46
+ # Touch backend once so runtime includes lazy backend/device setup costs.
47
+ arr = xp.asarray([1.0, 2.0, 3.0])
48
+ if hasattr(arr, "block_until_ready"):
49
+ arr.block_until_ready()
50
+
51
+ return xp
52
+
53
+
54
+ def build_blds_and_masks(resolution: float = 1.0, include_plots: bool = False):
55
+ """Build field-shaping devices and optional diagnostic plots."""
56
+ leaf_width = 5
57
+ positions = [
58
+ [0, 0],
59
+ [-20, 20],
60
+ [-20, 10],
61
+ [-20, 0],
62
+ [-20, 0],
63
+ [-20, 0],
64
+ [-20, 0],
65
+ [-20, 0],
66
+ [-20, 0],
67
+ [0, 0],
68
+ ]
69
+ number_of_elements = len(positions)
70
+ boundaries = np.arange(
71
+ -int(number_of_elements / 2) * leaf_width,
72
+ int(number_of_elements / 2) * leaf_width,
73
+ leaf_width,
74
+ )
75
+
76
+ mlc_information = {
77
+ "device_type": "MLC",
78
+ "device_orientation": "X",
79
+ "leaf_position_boundaries": boundaries,
80
+ "leaf_positions": positions,
81
+ "leaf_width": leaf_width,
82
+ "leaf_leakage": 0.1,
83
+ }
84
+ mlc_x = create_bld(mlc_information)
85
+ mask_mlc_x = mlc_x.calculate_transmission_mask(resolution)
86
+
87
+ jaw_info = {
88
+ "device_type": "JAW",
89
+ "device_orientation": "X",
90
+ "positions": [-20, 10],
91
+ "field_width": 70,
92
+ "leakage": 0.1,
93
+ }
94
+ jaw_info["field_width"] = mask_mlc_x.shape[0] * resolution
95
+ jaw_x_matching_field_width = create_bld(jaw_info)
96
+ mask_jaw_x = jaw_x_matching_field_width.calculate_transmission_mask(resolution)
97
+
98
+ mask = mask_mlc_x * mask_jaw_x
99
+
100
+ half_size = jaw_info["field_width"]
101
+ extent = [-half_size, half_size, -half_size, half_size]
102
+
103
+ if include_plots:
104
+ fig, axes = plt.subplots(1, 3, figsize=(15, 5))
105
+ axes[0].imshow(mask_jaw_x, cmap="gray", origin="lower", extent=extent)
106
+ axes[0].set_title("Jaw Mask (IEC DICOM)")
107
+ axes[0].set_xlabel("X (mm)")
108
+ axes[0].set_ylabel("Y (mm)")
109
+
110
+ axes[1].imshow(mask_mlc_x, cmap="gray", origin="lower", extent=extent)
111
+ axes[1].set_title("MLC Mask (IEC DICOM)")
112
+ axes[1].set_xlabel("X (mm)")
113
+ axes[1].set_ylabel("Y (mm)")
114
+
115
+ axes[2].imshow(mask, cmap="gray", origin="lower", extent=extent)
116
+ axes[2].set_title("Combined Mask (IEC DICOM)")
117
+ axes[2].set_xlabel("X (mm)")
118
+ axes[2].set_ylabel("Y (mm)")
119
+
120
+ plt.tight_layout()
121
+ plt.show()
122
+
123
+ return mlc_x, jaw_x_matching_field_width, extent
124
+
125
+
126
+ def build_field_shapes(
127
+ mlc_x,
128
+ jaw_x_matching_field_width,
129
+ extent,
130
+ resolution: float = 1.0,
131
+ include_plots: bool = False,
132
+ ):
133
+ """Build field shapes and optional diagnostic plots."""
134
+ mlc_shape = FieldShapeAsBLD(energy=6.0, bld=mlc_x, resolution=resolution)
135
+ jaw_shape = FieldShapeAsBLD(energy=6.0, bld=jaw_x_matching_field_width, resolution=resolution)
136
+ combined_shape = FieldShapeComposite(energy=6.0, shapes=[mlc_shape, jaw_shape])
137
+
138
+ if include_plots:
139
+ fig, axes = plt.subplots(1, 3, figsize=(15, 5))
140
+ axes[0].imshow(jaw_shape.mask, cmap="gray", origin="lower", extent=extent)
141
+ axes[0].set_title("Jaw Field Shape (LPS BEV)")
142
+ axes[0].set_xlabel("X (mm)")
143
+ axes[0].set_ylabel("Y (mm)")
144
+
145
+ axes[1].imshow(mlc_shape.mask, cmap="gray", origin="lower", extent=extent)
146
+ axes[1].set_title("MLC Field Shape (LPS BEV)")
147
+ axes[1].set_xlabel("X (mm)")
148
+ axes[1].set_ylabel("Y (mm)")
149
+
150
+ axes[2].imshow(combined_shape.mask, cmap="gray", origin="lower", extent=extent)
151
+ axes[2].set_title("Combined Field Shape (LPS BEV)")
152
+ axes[2].set_xlabel("X (mm)")
153
+ axes[2].set_ylabel("Y (mm)")
154
+
155
+ plt.tight_layout()
156
+ plt.show()
157
+
158
+
159
+ def build_plan(mlc_x, jaw_x_matching_field_width) -> PhotonPlan:
160
+ """Construct the photon plan used in the original example."""
161
+ pln = PhotonPlan(machine="Generic")
162
+ num_of_beams = 1
163
+ pln.prop_stf = {
164
+ "gantry_angles": np.linspace(0, 360, num_of_beams, endpoint=False),
165
+ "couch_angles": np.zeros((num_of_beams,)),
166
+ "generator": "photonSingleBixel",
167
+ "field_based": True,
168
+ "blds": [mlc_x, jaw_x_matching_field_width],
169
+ "resolution": 0.5,
170
+ "energy": 6,
171
+ }
172
+ return pln
173
+
174
+
175
+ def run_forward_example(include_plots: bool = False):
176
+ """Run the complete forward-dose flow in one profiled function."""
177
+ configure_backend(prefer_gpu=True, backend_name="jax")
178
+
179
+ resolution = 1.0
180
+ mlc_x, jaw_x_matching_field_width, extent = build_blds_and_masks(
181
+ resolution=resolution,
182
+ include_plots=include_plots,
183
+ )
184
+ build_field_shapes(
185
+ mlc_x,
186
+ jaw_x_matching_field_width,
187
+ extent,
188
+ resolution=resolution,
189
+ include_plots=include_plots,
190
+ )
191
+
192
+ ct, cst = load_tg119()
193
+ pln = build_plan(mlc_x, jaw_x_matching_field_width)
194
+ stf = generate_stf(ct, cst, pln)
195
+
196
+ # Absolute machine scaling (calculate_machine_scale) is skipped; not needed for profiling
197
+ weights = 1.0
198
+
199
+ for beam in stf.beams:
200
+ for ray in beam.rays:
201
+ for beamlet in ray.beamlets:
202
+ beamlet.weight *= weights
203
+
204
+ dij = calc_dose_forward(ct, cst, stf, pln)
205
+
206
+ # Ensure async backends finish before function return to keep timings meaningful.
207
+ dose = dij["physical_dose"]
208
+ if hasattr(dose, "block_until_ready"):
209
+ dose.block_until_ready()
210
+
211
+ if include_plots:
212
+ view_slice = int(np.round(ct.size[1] / 2))
213
+ plot_slice(
214
+ image_volume=ct,
215
+ cst=cst,
216
+ overlay=dij["physical_dose"],
217
+ view_slice=view_slice,
218
+ plane="coronal",
219
+ overlay_unit="Gy",
220
+ save_filename="pencilbeam_photon_forward_dose.png",
221
+ )
222
+
223
+ return dij
224
+
225
+
226
+ def build_profiler() -> LineProfiler:
227
+ """Create a line profiler with top-level and hotspot functions."""
228
+ lp = LineProfiler()
229
+
230
+ lp.add_function(central_axis_peak)
231
+ lp.add_function(calc_dose_forward)
232
+ lp.add_function(DoseEngineBase.calc_dose_forward)
233
+ lp.add_function(PhotonPencilBeamSVDEngine._calc_dose)
234
+ lp.add_function(PencilBeamEngineAbstract._init_dose_calc)
235
+
236
+ return lp
237
+
238
+
239
+ def main():
240
+ """Parse arguments and run the profiled forward-dose flow."""
241
+ parser = argparse.ArgumentParser(
242
+ description="Line profile the pencilbeam photon forward flow."
243
+ )
244
+ parser.add_argument(
245
+ "--plots",
246
+ action="store_true",
247
+ help="Enable plotting (disabled by default for cleaner profiling).",
248
+ )
249
+ parser.add_argument(
250
+ "--runs",
251
+ type=int,
252
+ default=1,
253
+ help="Number of profiled runs (use 2 to compare cold vs warm behavior).",
254
+ )
255
+ args = parser.parse_args()
256
+
257
+ logging.basicConfig(level=logging.INFO)
258
+
259
+ # logger.info("Starting unprofiled warmup run")
260
+ # run_forward_example(include_plots=args.plots)
261
+
262
+ lp = build_profiler()
263
+ wrapped = lp(run_forward_example)
264
+
265
+ for run_idx in range(args.runs):
266
+ logger.info("Starting profiled run %d/%d", run_idx + 1, args.runs)
267
+ wrapped(include_plots=args.plots)
268
+
269
+ lp.print_stats()
270
+
271
+
272
+ if __name__ == "__main__":
273
+ main()
@@ -0,0 +1,126 @@
1
+ # Configuration file for the Sphinx documentation builder.
2
+ #
3
+ # For the full list of built-in configuration values, see the documentation:
4
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html
5
+
6
+ # -- Project information -----------------------------------------------------
7
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
8
+ import os
9
+ import pathlib
10
+ import shutil
11
+ import sys
12
+
13
+ import jupytext
14
+ from sphinx.util import logging
15
+
16
+ from pyRadPlan import __version__
17
+
18
+ logger = logging.getLogger(__name__)
19
+
20
+ print(os.path.abspath("../pyRadPlan"))
21
+ sys.path.insert(0, os.path.abspath("../pyRadPlan")) # Adjust to your source folder
22
+
23
+ project = "pyRadPlan"
24
+ copyright = "2024, e0404"
25
+ author = "e0404"
26
+
27
+ version = __version__
28
+ release = __version__
29
+
30
+ # -- General configuration ---------------------------------------------------
31
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
32
+
33
+ extensions = [
34
+ "sphinx.ext.autodoc",
35
+ "sphinx.ext.autosummary",
36
+ "sphinx.ext.viewcode",
37
+ "numpydoc",
38
+ "sphinx_autodoc_typehints",
39
+ "sphinxcontrib.autodoc_pydantic",
40
+ "sphinx_design",
41
+ "myst_nb", # For Jupyter notebooks
42
+ ]
43
+
44
+ autosummary_generate = True
45
+
46
+ # -- Example notebooks (myst-nb) ---------------------------------------------
47
+ # The scripts in ../examples are jupytext "percent" notebooks. They are converted to .ipynb
48
+ # at build time (see setup() below) and rendered by myst-nb.
49
+ #
50
+ # Execution is OFF by default: several examples need external tools (MATLAB/Octave, FRED,
51
+ # TOPAS, a Qt display, AI credentials) and the remaining ones take far too long for a
52
+ # readthedocs build. Executed notebooks (with outputs) are committed in docs/tutorials/examples/;
53
+ # refresh them locally with `python docs/execute_examples.py` (never in CI). Scripts without a
54
+ # committed notebook are converted at build time without outputs (see setup() below).
55
+ # Set PYRADPLAN_DOCS_NB_EXECUTION=force (or auto/cache) to execute during a local build instead.
56
+ jupytext_formats = "ipynb,py:percent"
57
+ nb_execution_mode = os.environ.get("PYRADPLAN_DOCS_NB_EXECUTION", "off")
58
+ nb_execution_timeout = -1 # No per-cell timeout when execution is enabled
59
+ nb_execution_raise_on_error = False
60
+ nb_output_stderr = "remove"
61
+
62
+ templates_path = ["_templates"]
63
+ exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
64
+
65
+ add_module_names = False
66
+
67
+
68
+ # -- Options for HTML output -------------------------------------------------
69
+ # https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
70
+
71
+ html_theme = "pydata_sphinx_theme"
72
+ html_static_path = ["_static"]
73
+
74
+ autodoc_type_aliases = {
75
+ "npt.ArrayLike": "npt.ArrayLike",
76
+ }
77
+
78
+ autodoc_default_options = {
79
+ "no-module": True, # Suppress the module/package labels
80
+ }
81
+
82
+ numpydoc_class_members_toctree = False
83
+
84
+ # disable show json as it otherwises crashes the documentation building at the moment
85
+ autodoc_pydantic_model_show_json = False
86
+
87
+ # disable config summaries for inner classes
88
+ autodoc_pydantic_model_show_config_summary = False
89
+
90
+ # -- Example notebook generation ---------------------------------------------
91
+ DOCS_DIR = pathlib.Path(__file__).resolve().parent
92
+ EXAMPLES_DIR = DOCS_DIR.parent / "examples"
93
+ NOTEBOOKS_DIR = DOCS_DIR / "tutorials" / "examples"
94
+ NOTEBOOK_METADATA = { # lets myst-nb pick the python lexer for notebooks converted without execution
95
+ "kernelspec": {"name": "python3", "display_name": "Python 3", "language": "python"},
96
+ "language_info": {"name": "python"},
97
+ }
98
+
99
+
100
+ def generate_example_notebooks(app):
101
+ """Convert example scripts without a committed (executed) notebook to output-less notebooks."""
102
+ NOTEBOOKS_DIR.mkdir(parents=True, exist_ok=True)
103
+ generated = []
104
+ for py_file in sorted(EXAMPLES_DIR.glob("*.py")):
105
+ target = NOTEBOOKS_DIR / f"{py_file.stem}.ipynb"
106
+ if not target.is_file():
107
+ nb = jupytext.read(py_file)
108
+ nb.metadata.update(NOTEBOOK_METADATA)
109
+ jupytext.write(nb, target)
110
+ generated.append(target.name)
111
+ if generated:
112
+ logger.info(
113
+ "Generated %d example notebooks without outputs: %s", len(generated), generated
114
+ )
115
+
116
+
117
+ def cleanup_jupyter_execute(app, exception):
118
+ folder = os.path.join(app.srcdir, "jupyter_execute")
119
+ if os.path.exists(folder):
120
+ shutil.rmtree(folder)
121
+ logger.info("Removed jupyter_execute folder after build")
122
+
123
+
124
+ def setup(app):
125
+ app.connect("builder-inited", generate_example_notebooks)
126
+ app.connect("build-finished", cleanup_jupyter_execute)