pytomography 3.3.2__tar.gz → 4.0.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 (374) hide show
  1. {pytomography-3.3.2 → pytomography-4.0.0}/.gitignore +5 -1
  2. pytomography-4.0.0/CITATION.cff +44 -0
  3. pytomography-4.0.0/PKG-INFO +85 -0
  4. {pytomography-3.3.2 → pytomography-4.0.0}/README.md +3 -1
  5. pytomography-4.0.0/examples/README.md +70 -0
  6. pytomography-4.0.0/pyproject.toml +97 -0
  7. pytomography-4.0.0/src/pytomography/__init__.py +185 -0
  8. pytomography-4.0.0/src/pytomography/algorithms/__init__.py +27 -0
  9. pytomography-4.0.0/src/pytomography/algorithms/cgls.py +136 -0
  10. pytomography-4.0.0/src/pytomography/algorithms/dip_recon.py +152 -0
  11. pytomography-4.0.0/src/pytomography/algorithms/fbp.py +130 -0
  12. pytomography-4.0.0/src/pytomography/algorithms/preconditioned_gradient_ascent.py +1068 -0
  13. pytomography-4.0.0/src/pytomography/callbacks/__init__.py +14 -0
  14. pytomography-4.0.0/src/pytomography/callbacks/callback.py +72 -0
  15. pytomography-4.0.0/src/pytomography/callbacks/data_saving.py +69 -0
  16. pytomography-4.0.0/src/pytomography/data/cameras.json +18 -0
  17. pytomography-4.0.0/src/pytomography/data/collimators.csv +127 -0
  18. pytomography-4.0.0/src/pytomography/data/detectors.csv +7 -0
  19. pytomography-4.0.0/src/pytomography/data/pet_scanner_info.txt +2 -0
  20. pytomography-4.0.0/src/pytomography/data/siemens.erf +4 -0
  21. pytomography-4.0.0/src/pytomography/datasets/__init__.py +426 -0
  22. pytomography-4.0.0/src/pytomography/datasets/__main__.py +108 -0
  23. pytomography-4.0.0/src/pytomography/datasets/_download.py +363 -0
  24. pytomography-4.0.0/src/pytomography/datasets/_parts.py +299 -0
  25. pytomography-4.0.0/src/pytomography/datasets/_store.py +141 -0
  26. pytomography-4.0.0/src/pytomography/datasets/_zip.py +172 -0
  27. pytomography-4.0.0/src/pytomography/datasets/files/README.md +14 -0
  28. pytomography-4.0.0/src/pytomography/datasets/files/ac225_psf_model.json +402 -0
  29. pytomography-4.0.0/src/pytomography/datasets/files/fdg_spheres.seg.nrrd +0 -0
  30. pytomography-4.0.0/src/pytomography/datasets/files/jaszak_spheres.npz +0 -0
  31. pytomography-4.0.0/src/pytomography/datasets/registry.py +438 -0
  32. pytomography-4.0.0/src/pytomography/io/CT/__init__.py +19 -0
  33. pytomography-4.0.0/src/pytomography/io/CT/dicom_ct_pd.py +365 -0
  34. pytomography-4.0.0/src/pytomography/io/CT/nikon.py +130 -0
  35. pytomography-4.0.0/src/pytomography/io/CT/preprocessing.py +410 -0
  36. pytomography-4.0.0/src/pytomography/io/CT/units.py +67 -0
  37. pytomography-4.0.0/src/pytomography/io/PCT/__init__.py +9 -0
  38. pytomography-4.0.0/src/pytomography/io/PCT/listmode.py +119 -0
  39. pytomography-4.0.0/src/pytomography/io/PET/__init__.py +42 -0
  40. pytomography-4.0.0/src/pytomography/io/PET/_petsird_binary.py +267 -0
  41. pytomography-4.0.0/src/pytomography/io/PET/_standard.py +85 -0
  42. pytomography-4.0.0/src/pytomography/io/PET/gate.py +563 -0
  43. pytomography-4.0.0/src/pytomography/io/PET/ge.py +222 -0
  44. pytomography-4.0.0/src/pytomography/io/PET/petsird.py +614 -0
  45. pytomography-4.0.0/src/pytomography/io/PET/scanner.py +445 -0
  46. pytomography-4.0.0/src/pytomography/io/PET/shared.py +1153 -0
  47. pytomography-4.0.0/src/pytomography/io/SPECT/__init__.py +33 -0
  48. pytomography-4.0.0/src/pytomography/io/SPECT/_camera.py +226 -0
  49. pytomography-4.0.0/src/pytomography/io/SPECT/_energy.py +240 -0
  50. pytomography-4.0.0/src/pytomography/io/SPECT/dicom.py +536 -0
  51. pytomography-4.0.0/src/pytomography/io/SPECT/shared.py +45 -0
  52. pytomography-4.0.0/src/pytomography/io/SPECT/simind.py +220 -0
  53. pytomography-4.0.0/src/pytomography/io/SPECT/starguide.py +153 -0
  54. pytomography-4.0.0/src/pytomography/io/__init__.py +27 -0
  55. pytomography-4.0.0/src/pytomography/io/_attenuation.py +79 -0
  56. pytomography-4.0.0/src/pytomography/io/_formats/__init__.py +1 -0
  57. pytomography-4.0.0/src/pytomography/io/_formats/dicom.py +250 -0
  58. pytomography-4.0.0/src/pytomography/io/_formats/interfile.py +196 -0
  59. pytomography-4.0.0/src/pytomography/io/_formats/nifti.py +45 -0
  60. pytomography-4.0.0/src/pytomography/io/_formats/nrrd.py +127 -0
  61. pytomography-4.0.0/src/pytomography/io/_hu.py +218 -0
  62. pytomography-4.0.0/src/pytomography/io/_image.py +336 -0
  63. pytomography-4.0.0/src/pytomography/io/_load.py +112 -0
  64. pytomography-4.0.0/src/pytomography/io/_mask.py +150 -0
  65. pytomography-4.0.0/src/pytomography/io/_vendors.py +171 -0
  66. pytomography-4.0.0/src/pytomography/io/shared/__init__.py +10 -0
  67. pytomography-4.0.0/src/pytomography/io/shared/output.py +450 -0
  68. pytomography-4.0.0/src/pytomography/likelihoods/__init__.py +11 -0
  69. pytomography-4.0.0/src/pytomography/likelihoods/likelihood.py +245 -0
  70. pytomography-4.0.0/src/pytomography/likelihoods/mse_objective.py +171 -0
  71. pytomography-4.0.0/src/pytomography/likelihoods/poisson_log_likelihood.py +189 -0
  72. pytomography-4.0.0/src/pytomography/metadata/CT/__init__.py +11 -0
  73. pytomography-4.0.0/src/pytomography/metadata/CT/ct_conebeam_flatpanel_metadata.py +107 -0
  74. pytomography-4.0.0/src/pytomography/metadata/CT/ct_gen3_metadata.py +149 -0
  75. pytomography-4.0.0/src/pytomography/metadata/PCT/__init__.py +2 -0
  76. pytomography-4.0.0/src/pytomography/metadata/PCT/pct_metadata.py +160 -0
  77. pytomography-4.0.0/src/pytomography/metadata/PET/__init__.py +9 -0
  78. pytomography-4.0.0/src/pytomography/metadata/PET/pet_sinogram_metadata.py +44 -0
  79. pytomography-4.0.0/src/pytomography/metadata/PET/pet_tof_metadata.py +59 -0
  80. pytomography-4.0.0/src/pytomography/metadata/PET/petlm_metadata.py +72 -0
  81. pytomography-4.0.0/src/pytomography/metadata/SPECT/__init__.py +11 -0
  82. pytomography-4.0.0/src/pytomography/metadata/SPECT/spect_metadata.py +241 -0
  83. pytomography-4.0.0/src/pytomography/metadata/SPECT/starguide_metadata.py +50 -0
  84. pytomography-4.0.0/src/pytomography/metadata/__init__.py +14 -0
  85. pytomography-4.0.0/src/pytomography/metadata/metadata.py +229 -0
  86. pytomography-4.0.0/src/pytomography/priors/__init__.py +17 -0
  87. pytomography-4.0.0/src/pytomography/priors/nearest_neighbour.py +419 -0
  88. pytomography-4.0.0/src/pytomography/priors/prior.py +68 -0
  89. pytomography-4.0.0/src/pytomography/projectors/CT/__init__.py +24 -0
  90. pytomography-4.0.0/src/pytomography/projectors/CT/_wfbp.py +396 -0
  91. pytomography-4.0.0/src/pytomography/projectors/CT/_wfbp_cuda.py +184 -0
  92. pytomography-4.0.0/src/pytomography/projectors/CT/ct_conebeam_flatpanel_system_matrix.py +336 -0
  93. pytomography-4.0.0/src/pytomography/projectors/CT/ct_gen3_system_matrix.py +426 -0
  94. pytomography-4.0.0/src/pytomography/projectors/PCT/__init__.py +3 -0
  95. pytomography-4.0.0/src/pytomography/projectors/PCT/_pct_cuda.py +269 -0
  96. pytomography-4.0.0/src/pytomography/projectors/PCT/pct_system_matrix.py +606 -0
  97. pytomography-4.0.0/src/pytomography/projectors/PET/__init__.py +22 -0
  98. pytomography-4.0.0/src/pytomography/projectors/PET/pet_sinogram_system_matrix.py +435 -0
  99. pytomography-4.0.0/src/pytomography/projectors/PET/petlm_system_matrix.py +685 -0
  100. pytomography-4.0.0/src/pytomography/projectors/SPECT/__init__.py +10 -0
  101. pytomography-4.0.0/src/pytomography/projectors/SPECT/dualhead_system_matrix.py +630 -0
  102. pytomography-4.0.0/src/pytomography/projectors/SPECT/starguide_system_matrix.py +408 -0
  103. pytomography-4.0.0/src/pytomography/projectors/__init__.py +19 -0
  104. pytomography-4.0.0/src/pytomography/projectors/shared/__init__.py +7 -0
  105. pytomography-4.0.0/src/pytomography/projectors/shared/kem_system_matrix.py +123 -0
  106. pytomography-4.0.0/src/pytomography/projectors/shared/motion_correction_system_matrix.py +31 -0
  107. pytomography-4.0.0/src/pytomography/projectors/system_matrix.py +666 -0
  108. pytomography-4.0.0/src/pytomography/tests/calibrate_memory.py +504 -0
  109. pytomography-4.0.0/src/pytomography/tests/conftest.py +42 -0
  110. pytomography-4.0.0/src/pytomography/tests/contracts.py +49 -0
  111. pytomography-4.0.0/src/pytomography/tests/test_attenuation_mask.py +303 -0
  112. pytomography-4.0.0/src/pytomography/tests/test_cardiac_spect.py +23 -0
  113. pytomography-4.0.0/src/pytomography/tests/test_cgls.py +243 -0
  114. pytomography-4.0.0/src/pytomography/tests/test_contracts_spect.py +48 -0
  115. pytomography-4.0.0/src/pytomography/tests/test_cross_reader.py +191 -0
  116. pytomography-4.0.0/src/pytomography/tests/test_ct_fbp.py +385 -0
  117. pytomography-4.0.0/src/pytomography/tests/test_ct_geometry.py +102 -0
  118. pytomography-4.0.0/src/pytomography/tests/test_ct_projectors.py +253 -0
  119. pytomography-4.0.0/src/pytomography/tests/test_ct_readers.py +179 -0
  120. pytomography-4.0.0/src/pytomography/tests/test_datasets.py +665 -0
  121. pytomography-4.0.0/src/pytomography/tests/test_datasets_links.py +62 -0
  122. pytomography-4.0.0/src/pytomography/tests/test_dicom_slice_spacing.py +100 -0
  123. pytomography-4.0.0/src/pytomography/tests/test_dip_recon.py +83 -0
  124. pytomography-4.0.0/src/pytomography/tests/test_docstring_units.py +101 -0
  125. pytomography-4.0.0/src/pytomography/tests/test_external_kem.py +106 -0
  126. pytomography-4.0.0/src/pytomography/tests/test_fbp_algorithm.py +244 -0
  127. pytomography-4.0.0/src/pytomography/tests/test_fbp_memory_estimates.py +161 -0
  128. pytomography-4.0.0/src/pytomography/tests/test_gate_normalization.py +53 -0
  129. pytomography-4.0.0/src/pytomography/tests/test_gpu_message.py +58 -0
  130. pytomography-4.0.0/src/pytomography/tests/test_kem_system_matrix.py +53 -0
  131. pytomography-4.0.0/src/pytomography/tests/test_kem_top_n.py +79 -0
  132. pytomography-4.0.0/src/pytomography/tests/test_lazy_sinogram.py +420 -0
  133. pytomography-4.0.0/src/pytomography/tests/test_load_image.py +670 -0
  134. pytomography-4.0.0/src/pytomography/tests/test_memory_budget.py +179 -0
  135. pytomography-4.0.0/src/pytomography/tests/test_memory_estimates.py +164 -0
  136. pytomography-4.0.0/src/pytomography/tests/test_memory_plan.py +769 -0
  137. pytomography-4.0.0/src/pytomography/tests/test_motion_transform.py +122 -0
  138. pytomography-4.0.0/src/pytomography/tests/test_multi_bed_recon.py +59 -0
  139. pytomography-4.0.0/src/pytomography/tests/test_multibed_uncertainty.py +195 -0
  140. pytomography-4.0.0/src/pytomography/tests/test_object_meta.py +115 -0
  141. pytomography-4.0.0/src/pytomography/tests/test_pct.py +168 -0
  142. pytomography-4.0.0/src/pytomography/tests/test_pet_boundary.py +87 -0
  143. pytomography-4.0.0/src/pytomography/tests/test_pet_data.py +210 -0
  144. pytomography-4.0.0/src/pytomography/tests/test_pet_listmode_binning.py +206 -0
  145. pytomography-4.0.0/src/pytomography/tests/test_pet_listmode_sinogram.py +97 -0
  146. pytomography-4.0.0/src/pytomography/tests/test_pet_readers.py +534 -0
  147. pytomography-4.0.0/src/pytomography/tests/test_pet_sinogram_memory.py +135 -0
  148. pytomography-4.0.0/src/pytomography/tests/test_pet_tof_centre.py +40 -0
  149. pytomography-4.0.0/src/pytomography/tests/test_petlm_devices.py +218 -0
  150. pytomography-4.0.0/src/pytomography/tests/test_petsird.py +497 -0
  151. pytomography-4.0.0/src/pytomography/tests/test_positions_data.py +237 -0
  152. pytomography-4.0.0/src/pytomography/tests/test_prior_transforms.py +42 -0
  153. pytomography-4.0.0/src/pytomography/tests/test_projector_host_scalars.py +99 -0
  154. pytomography-4.0.0/src/pytomography/tests/test_psf_kernels.py +270 -0
  155. pytomography-4.0.0/src/pytomography/tests/test_renamed_arguments.py +122 -0
  156. pytomography-4.0.0/src/pytomography/tests/test_rotation_cache.py +204 -0
  157. pytomography-4.0.0/src/pytomography/tests/test_save_images.py +370 -0
  158. pytomography-4.0.0/src/pytomography/tests/test_scatter_smoothing.py +29 -0
  159. pytomography-4.0.0/src/pytomography/tests/test_simind_mc.py +173 -0
  160. pytomography-4.0.0/src/pytomography/tests/test_spect_camera_tables.py +73 -0
  161. pytomography-4.0.0/src/pytomography/tests/test_spect_data.py +162 -0
  162. pytomography-4.0.0/src/pytomography/tests/test_spect_fbp.py +91 -0
  163. pytomography-4.0.0/src/pytomography/tests/test_spect_psf_transform.py +25 -0
  164. pytomography-4.0.0/src/pytomography/tests/test_spect_readers.py +622 -0
  165. pytomography-4.0.0/src/pytomography/tests/test_spectarf.py +103 -0
  166. pytomography-4.0.0/src/pytomography/tests/test_sss_energy_window.py +179 -0
  167. pytomography-4.0.0/src/pytomography/tests/test_sss_projector.py +253 -0
  168. pytomography-4.0.0/src/pytomography/tests/test_starguide_projector.py +177 -0
  169. pytomography-4.0.0/src/pytomography/tests/test_subsets_limit.py +94 -0
  170. pytomography-4.0.0/src/pytomography/tests/test_system_matrix_scaling.py +59 -0
  171. pytomography-4.0.0/src/pytomography/tests/test_utils_imports.py +32 -0
  172. pytomography-4.0.0/src/pytomography/tests/validate_memory.py +1329 -0
  173. pytomography-4.0.0/src/pytomography/transforms/SPECT/__init__.py +20 -0
  174. pytomography-4.0.0/src/pytomography/transforms/SPECT/additive_term.py +51 -0
  175. pytomography-4.0.0/src/pytomography/transforms/SPECT/attenuation.py +135 -0
  176. pytomography-4.0.0/src/pytomography/transforms/SPECT/cutoff.py +57 -0
  177. pytomography-4.0.0/src/pytomography/transforms/SPECT/psf.py +223 -0
  178. pytomography-4.0.0/src/pytomography/transforms/SPECT/psf_kernels.py +298 -0
  179. pytomography-4.0.0/src/pytomography/transforms/__init__.py +10 -0
  180. pytomography-4.0.0/src/pytomography/transforms/shared/__init__.py +12 -0
  181. pytomography-4.0.0/src/pytomography/transforms/shared/external_kem.py +660 -0
  182. pytomography-4.0.0/src/pytomography/transforms/shared/filters.py +111 -0
  183. pytomography-4.0.0/src/pytomography/transforms/shared/kem.py +185 -0
  184. pytomography-4.0.0/src/pytomography/transforms/shared/motion.py +131 -0
  185. pytomography-4.0.0/src/pytomography/transforms/shared/spatial.py +62 -0
  186. pytomography-4.0.0/src/pytomography/transforms/transform.py +59 -0
  187. pytomography-4.0.0/src/pytomography/utils/__init__.py +38 -0
  188. pytomography-4.0.0/src/pytomography/utils/_renamed.py +58 -0
  189. pytomography-4.0.0/src/pytomography/utils/_sss_cuda.py +116 -0
  190. pytomography-4.0.0/src/pytomography/utils/cardiac_spect.py +230 -0
  191. pytomography-4.0.0/src/pytomography/utils/fourier_filters.py +216 -0
  192. pytomography-4.0.0/src/pytomography/utils/memory.py +979 -0
  193. pytomography-4.0.0/src/pytomography/utils/misc.py +119 -0
  194. pytomography-4.0.0/src/pytomography/utils/nist_data.py +83 -0
  195. pytomography-4.0.0/src/pytomography/utils/plot_utils.py +177 -0
  196. pytomography-4.0.0/src/pytomography/utils/scatter.py +167 -0
  197. pytomography-4.0.0/src/pytomography/utils/simind_mc.py +550 -0
  198. pytomography-4.0.0/src/pytomography/utils/spatial.py +350 -0
  199. pytomography-4.0.0/src/pytomography/utils/sss.py +1142 -0
  200. pytomography-3.3.2/.github/workflows/publish-to-test-pypi.yml +0 -33
  201. pytomography-3.3.2/.readthedocs.yaml +0 -16
  202. pytomography-3.3.2/PKG-INFO +0 -58
  203. pytomography-3.3.2/docs/Makefile +0 -20
  204. pytomography-3.3.2/docs/make.bat +0 -35
  205. pytomography-3.3.2/docs/source/_static/code_toggle.js +0 -17
  206. pytomography-3.3.2/docs/source/_static/css/code_toggle.css +0 -16
  207. pytomography-3.3.2/docs/source/_static/css/custom.css +0 -12
  208. pytomography-3.3.2/docs/source/conf.py +0 -96
  209. pytomography-3.3.2/docs/source/data_tables/collimator_data.rst +0 -327
  210. pytomography-3.3.2/docs/source/developers_guide.md +0 -8
  211. pytomography-3.3.2/docs/source/external_data.rst +0 -33
  212. pytomography-3.3.2/docs/source/gallery.rst +0 -52
  213. pytomography-3.3.2/docs/source/images/CT_slice.png +0 -0
  214. pytomography-3.3.2/docs/source/images/PT1.png +0 -0
  215. pytomography-3.3.2/docs/source/images/ac225_patient_dual.jpg +0 -0
  216. pytomography-3.3.2/docs/source/images/coordinate_conventions.png +0 -0
  217. pytomography-3.3.2/docs/source/images/emission.png +0 -0
  218. pytomography-3.3.2/docs/source/images/example_scanner_sm.png +0 -0
  219. pytomography-3.3.2/docs/source/images/figure2.jpg +0 -0
  220. pytomography-3.3.2/docs/source/images/figure4.jpg +0 -0
  221. pytomography-3.3.2/docs/source/images/figure4_left_hoz.jpg +0 -0
  222. pytomography-3.3.2/docs/source/images/figure5.jpg +0 -0
  223. pytomography-3.3.2/docs/source/images/pytomo_front_title.png +0 -0
  224. pytomography-3.3.2/docs/source/index.rst +0 -67
  225. pytomography-3.3.2/docs/source/index2.md +0 -70
  226. pytomography-3.3.2/docs/source/install.rst +0 -29
  227. pytomography-3.3.2/docs/source/notebooks/CT_slice.png +0 -0
  228. pytomography-3.3.2/docs/source/notebooks/conventions.ipynb +0 -201
  229. pytomography-3.3.2/docs/source/notebooks/p_simind_multiorgan.py +0 -29
  230. pytomography-3.3.2/docs/source/notebooks/p_subsample_data.py +0 -39
  231. pytomography-3.3.2/docs/source/notebooks/run_all_notebooks.py +0 -37
  232. pytomography-3.3.2/docs/source/notebooks/script_to_generate_eta_for_petsird.py +0 -13
  233. pytomography-3.3.2/docs/source/notebooks/t_CT_GEN3.ipynb +0 -446
  234. pytomography-3.3.2/docs/source/notebooks/t_CT_microct.ipynb +0 -305
  235. pytomography-3.3.2/docs/source/notebooks/t_CardiacReorientation.ipynb +0 -331
  236. pytomography-3.3.2/docs/source/notebooks/t_GE_HDF5.ipynb +0 -485
  237. pytomography-3.3.2/docs/source/notebooks/t_PETGATE_DIP.ipynb +0 -1092
  238. pytomography-3.3.2/docs/source/notebooks/t_PETGATE_LM.ipynb +0 -504
  239. pytomography-3.3.2/docs/source/notebooks/t_PETGATE_SINO.ipynb +0 -407
  240. pytomography-3.3.2/docs/source/notebooks/t_PETGATE_scat_lm.ipynb +0 -1026
  241. pytomography-3.3.2/docs/source/notebooks/t_PETGATE_scat_lmTOF.ipynb +0 -971
  242. pytomography-3.3.2/docs/source/notebooks/t_PETGATE_scat_sino.ipynb +0 -1512
  243. pytomography-3.3.2/docs/source/notebooks/t_PETGATE_scat_sinoTOF.ipynb +0 -1925
  244. pytomography-3.3.2/docs/source/notebooks/t_PETSIRD.ipynb +0 -414
  245. pytomography-3.3.2/docs/source/notebooks/t_ac225_dicom_recon.ipynb +0 -614
  246. pytomography-3.3.2/docs/source/notebooks/t_ac225_simind_recon.ipynb +0 -497
  247. pytomography-3.3.2/docs/source/notebooks/t_algorithms.ipynb +0 -826
  248. pytomography-3.3.2/docs/source/notebooks/t_dicom_algorithms.ipynb +0 -110
  249. pytomography-3.3.2/docs/source/notebooks/t_dicomdata.ipynb +0 -1343
  250. pytomography-3.3.2/docs/source/notebooks/t_dicommultibed.ipynb +0 -908
  251. pytomography-3.3.2/docs/source/notebooks/t_dualpeak.ipynb +0 -678
  252. pytomography-3.3.2/docs/source/notebooks/t_examplesystemmatrix.ipynb +0 -2650
  253. pytomography-3.3.2/docs/source/notebooks/t_fbp.ipynb +0 -506
  254. pytomography-3.3.2/docs/source/notebooks/t_plotting.ipynb +0 -315
  255. pytomography-3.3.2/docs/source/notebooks/t_quantitative.ipynb +0 -440
  256. pytomography-3.3.2/docs/source/notebooks/t_siminddata.ipynb +0 -1261
  257. pytomography-3.3.2/docs/source/notebooks/t_siminddata_multiorgan.ipynb +0 -1886
  258. pytomography-3.3.2/docs/source/notebooks/t_spect_mc.ipynb +0 -336
  259. pytomography-3.3.2/docs/source/notebooks/t_spect_mc2.ipynb +0 -359
  260. pytomography-3.3.2/docs/source/notebooks/t_starguide.ipynb +0 -276
  261. pytomography-3.3.2/docs/source/notebooks/t_uncertainty_spect.ipynb +0 -890
  262. pytomography-3.3.2/docs/source/usage/usage.rst +0 -65
  263. pytomography-3.3.2/docs/source/usage/usage_ct.rst +0 -26
  264. pytomography-3.3.2/docs/source/usage/usage_dev.rst +0 -22
  265. pytomography-3.3.2/docs/source/usage/usage_pet.rst +0 -92
  266. pytomography-3.3.2/docs/source/usage/usage_spect.rst +0 -192
  267. pytomography-3.3.2/pyproject.toml +0 -58
  268. pytomography-3.3.2/src/pytomography/__init__.py +0 -42
  269. pytomography-3.3.2/src/pytomography/algorithms/__init__.py +0 -5
  270. pytomography-3.3.2/src/pytomography/algorithms/dip_recon.py +0 -74
  271. pytomography-3.3.2/src/pytomography/algorithms/fbp.py +0 -40
  272. pytomography-3.3.2/src/pytomography/algorithms/preconditioned_gradient_ascent.py +0 -663
  273. pytomography-3.3.2/src/pytomography/callbacks/__init__.py +0 -4
  274. pytomography-3.3.2/src/pytomography/callbacks/callback.py +0 -63
  275. pytomography-3.3.2/src/pytomography/callbacks/data_saving.py +0 -50
  276. pytomography-3.3.2/src/pytomography/data/collim.col +0 -188
  277. pytomography-3.3.2/src/pytomography/data/pet_scanner_info.txt +0 -2
  278. pytomography-3.3.2/src/pytomography/io/CT/__init__.py +0 -1
  279. pytomography-3.3.2/src/pytomography/io/CT/dicom_ct_pd.py +0 -52
  280. pytomography-3.3.2/src/pytomography/io/PET/__init__.py +0 -3
  281. pytomography-3.3.2/src/pytomography/io/PET/clinical.py +0 -166
  282. pytomography-3.3.2/src/pytomography/io/PET/gate.py +0 -531
  283. pytomography-3.3.2/src/pytomography/io/PET/petsird.py +0 -131
  284. pytomography-3.3.2/src/pytomography/io/PET/prd/__init__.py +0 -46
  285. pytomography-3.3.2/src/pytomography/io/PET/prd/_binary.py +0 -1339
  286. pytomography-3.3.2/src/pytomography/io/PET/prd/_dtypes.py +0 -87
  287. pytomography-3.3.2/src/pytomography/io/PET/prd/_ndjson.py +0 -1193
  288. pytomography-3.3.2/src/pytomography/io/PET/prd/binary.py +0 -229
  289. pytomography-3.3.2/src/pytomography/io/PET/prd/ndjson.py +0 -582
  290. pytomography-3.3.2/src/pytomography/io/PET/prd/protocols.py +0 -166
  291. pytomography-3.3.2/src/pytomography/io/PET/prd/types.py +0 -382
  292. pytomography-3.3.2/src/pytomography/io/PET/prd/yardl_types.py +0 -303
  293. pytomography-3.3.2/src/pytomography/io/PET/shared.py +0 -485
  294. pytomography-3.3.2/src/pytomography/io/SPECT/__init__.py +0 -6
  295. pytomography-3.3.2/src/pytomography/io/SPECT/attenuation_map.py +0 -183
  296. pytomography-3.3.2/src/pytomography/io/SPECT/dicom.py +0 -1028
  297. pytomography-3.3.2/src/pytomography/io/SPECT/shared.py +0 -100
  298. pytomography-3.3.2/src/pytomography/io/SPECT/simind.py +0 -234
  299. pytomography-3.3.2/src/pytomography/io/__init__.py +0 -1
  300. pytomography-3.3.2/src/pytomography/io/shared/__init__.py +0 -6
  301. pytomography-3.3.2/src/pytomography/io/shared/dicom.py +0 -175
  302. pytomography-3.3.2/src/pytomography/io/shared/dicom_creation.py +0 -120
  303. pytomography-3.3.2/src/pytomography/io/shared/interfile.py +0 -68
  304. pytomography-3.3.2/src/pytomography/likelihoods/__init__.py +0 -3
  305. pytomography-3.3.2/src/pytomography/likelihoods/likelihood.py +0 -123
  306. pytomography-3.3.2/src/pytomography/likelihoods/mse_objective.py +0 -76
  307. pytomography-3.3.2/src/pytomography/likelihoods/poisson_log_likelihood.py +0 -118
  308. pytomography-3.3.2/src/pytomography/metadata/CT/__init__.py +0 -2
  309. pytomography-3.3.2/src/pytomography/metadata/CT/ct_conebeam_flatpanel_metadata.py +0 -70
  310. pytomography-3.3.2/src/pytomography/metadata/CT/ct_gen3_metadata.py +0 -86
  311. pytomography-3.3.2/src/pytomography/metadata/PET/__init__.py +0 -3
  312. pytomography-3.3.2/src/pytomography/metadata/PET/pet_sinogram_metadata.py +0 -26
  313. pytomography-3.3.2/src/pytomography/metadata/PET/pet_tof_metadata.py +0 -38
  314. pytomography-3.3.2/src/pytomography/metadata/PET/petlm_metadata.py +0 -40
  315. pytomography-3.3.2/src/pytomography/metadata/SPECT/__init__.py +0 -2
  316. pytomography-3.3.2/src/pytomography/metadata/SPECT/spect_metadata.py +0 -95
  317. pytomography-3.3.2/src/pytomography/metadata/SPECT/starguide_metadata.py +0 -28
  318. pytomography-3.3.2/src/pytomography/metadata/__init__.py +0 -2
  319. pytomography-3.3.2/src/pytomography/metadata/metadata.py +0 -29
  320. pytomography-3.3.2/src/pytomography/priors/__init__.py +0 -4
  321. pytomography-3.3.2/src/pytomography/priors/nearest_neighbour.py +0 -312
  322. pytomography-3.3.2/src/pytomography/priors/prior.py +0 -58
  323. pytomography-3.3.2/src/pytomography/projectors/CT/__init__.py +0 -6
  324. pytomography-3.3.2/src/pytomography/projectors/CT/ct_conebeam_flatpanel_system_matrix.py +0 -234
  325. pytomography-3.3.2/src/pytomography/projectors/CT/ct_gen3_system_matrix.py +0 -160
  326. pytomography-3.3.2/src/pytomography/projectors/PET/__init__.py +0 -6
  327. pytomography-3.3.2/src/pytomography/projectors/PET/pet_sinogram_system_matrix.py +0 -332
  328. pytomography-3.3.2/src/pytomography/projectors/PET/petlm_system_matrix.py +0 -363
  329. pytomography-3.3.2/src/pytomography/projectors/SPECT/__init__.py +0 -2
  330. pytomography-3.3.2/src/pytomography/projectors/SPECT/spect_system_matrix.py +0 -352
  331. pytomography-3.3.2/src/pytomography/projectors/SPECT/starguide_system_matrix.py +0 -170
  332. pytomography-3.3.2/src/pytomography/projectors/__init__.py +0 -2
  333. pytomography-3.3.2/src/pytomography/projectors/shared/__init__.py +0 -2
  334. pytomography-3.3.2/src/pytomography/projectors/shared/kem_system_matrix.py +0 -60
  335. pytomography-3.3.2/src/pytomography/projectors/shared/motion_correction_system_matrix.py +0 -22
  336. pytomography-3.3.2/src/pytomography/projectors/system_matrix.py +0 -221
  337. pytomography-3.3.2/src/pytomography/tests/test_multi_bed_recon.py +0 -78
  338. pytomography-3.3.2/src/pytomography/transforms/SPECT/__init__.py +0 -3
  339. pytomography-3.3.2/src/pytomography/transforms/SPECT/attenuation.py +0 -126
  340. pytomography-3.3.2/src/pytomography/transforms/SPECT/cutoff.py +0 -22
  341. pytomography-3.3.2/src/pytomography/transforms/SPECT/psf.py +0 -231
  342. pytomography-3.3.2/src/pytomography/transforms/__init__.py +0 -2
  343. pytomography-3.3.2/src/pytomography/transforms/shared/__init__.py +0 -4
  344. pytomography-3.3.2/src/pytomography/transforms/shared/filters.py +0 -81
  345. pytomography-3.3.2/src/pytomography/transforms/shared/kem.py +0 -139
  346. pytomography-3.3.2/src/pytomography/transforms/shared/motion.py +0 -112
  347. pytomography-3.3.2/src/pytomography/transforms/shared/spatial.py +0 -53
  348. pytomography-3.3.2/src/pytomography/transforms/transform.py +0 -38
  349. pytomography-3.3.2/src/pytomography/utils/__init__.py +0 -6
  350. pytomography-3.3.2/src/pytomography/utils/cardiac_spect.py +0 -183
  351. pytomography-3.3.2/src/pytomography/utils/fourier_filters.py +0 -27
  352. pytomography-3.3.2/src/pytomography/utils/misc.py +0 -100
  353. pytomography-3.3.2/src/pytomography/utils/nist_data.py +0 -67
  354. pytomography-3.3.2/src/pytomography/utils/plot_utils.py +0 -52
  355. pytomography-3.3.2/src/pytomography/utils/scatter.py +0 -100
  356. pytomography-3.3.2/src/pytomography/utils/simind_mc.py +0 -377
  357. pytomography-3.3.2/src/pytomography/utils/spatial.py +0 -145
  358. pytomography-3.3.2/src/pytomography/utils/sss.py +0 -508
  359. {pytomography-3.3.2 → pytomography-4.0.0}/LICENSE +0 -0
  360. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/NIST_attenuation_data/adipose.csv +0 -0
  361. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/NIST_attenuation_data/air.csv +0 -0
  362. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/NIST_attenuation_data/aluminum.csv +0 -0
  363. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/NIST_attenuation_data/bonecortical.csv +0 -0
  364. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/NIST_attenuation_data/boneequivplastic.csv +0 -0
  365. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/NIST_attenuation_data/breast.csv +0 -0
  366. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/NIST_attenuation_data/lead.csv +0 -0
  367. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/NIST_attenuation_data/lungtissue.csv +0 -0
  368. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/NIST_attenuation_data/muscle.csv +0 -0
  369. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/NIST_attenuation_data/tissueequivplastic.csv +0 -0
  370. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/NIST_attenuation_data/tungsten.csv +0 -0
  371. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/NIST_attenuation_data/water.csv +0 -0
  372. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/ct_table.csv +0 -0
  373. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/pet_colors.txt +0 -0
  374. {pytomography-3.3.2 → pytomography-4.0.0}/src/pytomography/data/simind.smc +0 -0
@@ -6,4 +6,8 @@ notebook_testing
6
6
  stir_testing
7
7
  dist/
8
8
  test_files
9
- *docs/build*
9
+ *docs/build*
10
+ # docs build
11
+ docs/build/
12
+ .venv-docs/
13
+ .venv-data/
@@ -0,0 +1,44 @@
1
+ cff-version: 1.2.0
2
+ message: "If you use PyTomography in your research, please cite the paper below."
3
+ title: PyTomography
4
+ type: software
5
+ license: MIT
6
+ repository-code: "https://github.com/PyTomography/PyTomography"
7
+ url: "https://pytomography.readthedocs.io"
8
+ authors:
9
+ - family-names: Polson
10
+ given-names: Lucas A.
11
+ - name: "The PyTomography contributors"
12
+ preferred-citation:
13
+ type: article
14
+ title: "PyTomography: A python library for medical image reconstruction"
15
+ journal: SoftwareX
16
+ volume: 29
17
+ start: 102020
18
+ year: 2025
19
+ doi: 10.1016/j.softx.2024.102020
20
+ authors:
21
+ - family-names: Polson
22
+ given-names: Lucas A.
23
+ - family-names: Fedrigo
24
+ given-names: Roberto
25
+ - family-names: Li
26
+ given-names: Chenguang
27
+ - family-names: Sabouri
28
+ given-names: Maziar
29
+ - family-names: Dzikunu
30
+ given-names: Obed
31
+ - family-names: Ahamed
32
+ given-names: Shadab
33
+ - family-names: Karakatsanis
34
+ given-names: Nicolas
35
+ - family-names: Kurkowska
36
+ given-names: Sara
37
+ - family-names: Sheikhzadeh
38
+ given-names: Peyman
39
+ - family-names: Esquinas
40
+ given-names: Pedro
41
+ - family-names: Rahmim
42
+ given-names: Arman
43
+ - family-names: Uribe
44
+ given-names: Carlos
@@ -0,0 +1,85 @@
1
+ Metadata-Version: 2.5
2
+ Name: pytomography
3
+ Version: 4.0.0
4
+ Summary: Package to perform tomographic image reconstruction
5
+ Project-URL: Homepage, https://github.com/PyTomography/PyTomography
6
+ Project-URL: Documentation, https://pytomography.readthedocs.io
7
+ Project-URL: Bug Tracker, https://github.com/PyTomography/PyTomography/issues
8
+ Project-URL: Discussions, https://github.com/PyTomography/PyTomography/discussions
9
+ Author-email: Luke Polson <lukepolson@outlook.com>
10
+ License-File: LICENSE
11
+ Classifier: License :: OSI Approved :: MIT License
12
+ Classifier: Operating System :: OS Independent
13
+ Classifier: Programming Language :: Python :: 3
14
+ Classifier: Programming Language :: Python :: 3.10
15
+ Classifier: Programming Language :: Python :: 3.11
16
+ Classifier: Programming Language :: Python :: 3.12
17
+ Classifier: Programming Language :: Python :: 3.13
18
+ Requires-Python: >=3.10
19
+ Requires-Dist: h5py>=3.11.0
20
+ Requires-Dist: matplotlib>=3.8.0
21
+ Requires-Dist: nibabel>=5.1.0
22
+ Requires-Dist: numba>=0.59
23
+ Requires-Dist: numpy>=1.24.2
24
+ Requires-Dist: pandas>=2.2
25
+ Requires-Dist: pydicom>=3.0.1
26
+ Requires-Dist: rt-utils>=1.2.0
27
+ Requires-Dist: scipy>=1.10.1
28
+ Requires-Dist: spectarf>=0.1
29
+ Requires-Dist: torch>=2.4
30
+ Requires-Dist: torchrbf
31
+ Requires-Dist: uproot>=5.2.1
32
+ Provides-Extra: dev
33
+ Requires-Dist: myst-nb>=1.1; extra == 'dev'
34
+ Requires-Dist: petsird<0.10,>=0.9; extra == 'dev'
35
+ Requires-Dist: pre-commit; extra == 'dev'
36
+ Requires-Dist: pydata-sphinx-theme>=0.16; extra == 'dev'
37
+ Requires-Dist: pytest-xdist; extra == 'dev'
38
+ Requires-Dist: pytest>=8; extra == 'dev'
39
+ Requires-Dist: pyyaml; extra == 'dev'
40
+ Requires-Dist: ruff; extra == 'dev'
41
+ Requires-Dist: sphinx-autoapi>=3.3; extra == 'dev'
42
+ Requires-Dist: sphinx-autobuild; extra == 'dev'
43
+ Requires-Dist: sphinx-copybutton; extra == 'dev'
44
+ Requires-Dist: sphinx-design; extra == 'dev'
45
+ Requires-Dist: sphinx<9,>=8; extra == 'dev'
46
+ Provides-Extra: doc
47
+ Requires-Dist: myst-nb>=1.1; extra == 'doc'
48
+ Requires-Dist: pydata-sphinx-theme>=0.16; extra == 'doc'
49
+ Requires-Dist: pyyaml; extra == 'doc'
50
+ Requires-Dist: sphinx-autoapi>=3.3; extra == 'doc'
51
+ Requires-Dist: sphinx-autobuild; extra == 'doc'
52
+ Requires-Dist: sphinx-copybutton; extra == 'doc'
53
+ Requires-Dist: sphinx-design; extra == 'doc'
54
+ Requires-Dist: sphinx<9,>=8; extra == 'doc'
55
+ Provides-Extra: petsird
56
+ Requires-Dist: petsird<0.10,>=0.9; extra == 'petsird'
57
+ Provides-Extra: test
58
+ Requires-Dist: petsird<0.10,>=0.9; extra == 'test'
59
+ Requires-Dist: pytest-xdist; extra == 'test'
60
+ Requires-Dist: pytest>=8; extra == 'test'
61
+ Requires-Dist: pyyaml; extra == 'test'
62
+ Description-Content-Type: text/markdown
63
+
64
+
65
+
66
+ # <img src="https://pytomography.readthedocs.io/en/latest/_static/PT1.png" alt= “” width="5%"> PyTomography <img src="https://www.bccrc.ca/dept/io-programs/qurit/sites/qurit/files/FINAL_QURIT_PNG_60.png" alt= “” width="10%">
67
+
68
+ [![Tests on development](https://github.com/PyTomography/PyTomography/actions/workflows/tests.yml/badge.svg?branch=development&event=push)](https://github.com/PyTomography/PyTomography/actions/workflows/tests.yml?query=branch%3Adevelopment+event%3Apush)
69
+ [![Tests on docs/v4-site](https://github.com/PyTomography/PyTomography/actions/workflows/tests.yml/badge.svg?branch=docs/v4-site&event=push)](https://github.com/PyTomography/PyTomography/actions/workflows/tests.yml?query=branch%3Adocs%2Fv4-site+event%3Apush)
70
+ ![Contributors](https://img.shields.io/github/contributors/qurit/PyTomography?style=plastic)
71
+ ![Forks](https://img.shields.io/github/forks/qurit/PyTomography)
72
+ ![Stars](https://img.shields.io/github/stars/qurit/PyTomography)
73
+ ![Issues](https://img.shields.io/github/issues/qurit/PyTomography)
74
+
75
+ # Getting Started
76
+ We have prepared a very detailed documentation guide available at [readthedocs](https://pytomography.readthedocs.io/en/latest/). If you have any additional questions, please ask them in [GitHub Discussions](https://github.com/PyTomography/PyTomography/discussions/categories/q-a). To contribute, see [CONTRIBUTING.md](CONTRIBUTING.md).
77
+
78
+ # Research Paper
79
+ If you use PyTomography in your own research, please cite the corresponding research paper:
80
+
81
+ **Lucas A. Polson, Roberto Fedrigo, Chenguang Li, Maziar Sabouri, Obed Dzikunu, Shadab Ahamed, Nicolas Karakatsanis, Sara Kurkowska, Peyman Sheikhzadeh, Pedro Esquinas, Arman Rahmim, and Carlos Uribe.** *PyTomography: A python library for medical image reconstruction.* SoftwareX, Volume 29, 2025, Page 102020. https://www.sciencedirect.com/science/article/pii/S235271102400390X
82
+
83
+ # License
84
+ This work is licensed under an MIT license, as is found in the LICENSE file.
85
+
@@ -2,13 +2,15 @@
2
2
 
3
3
  # <img src="https://pytomography.readthedocs.io/en/latest/_static/PT1.png" alt= “” width="5%"> PyTomography <img src="https://www.bccrc.ca/dept/io-programs/qurit/sites/qurit/files/FINAL_QURIT_PNG_60.png" alt= “” width="10%">
4
4
 
5
+ [![Tests on development](https://github.com/PyTomography/PyTomography/actions/workflows/tests.yml/badge.svg?branch=development&event=push)](https://github.com/PyTomography/PyTomography/actions/workflows/tests.yml?query=branch%3Adevelopment+event%3Apush)
6
+ [![Tests on docs/v4-site](https://github.com/PyTomography/PyTomography/actions/workflows/tests.yml/badge.svg?branch=docs/v4-site&event=push)](https://github.com/PyTomography/PyTomography/actions/workflows/tests.yml?query=branch%3Adocs%2Fv4-site+event%3Apush)
5
7
  ![Contributors](https://img.shields.io/github/contributors/qurit/PyTomography?style=plastic)
6
8
  ![Forks](https://img.shields.io/github/forks/qurit/PyTomography)
7
9
  ![Stars](https://img.shields.io/github/stars/qurit/PyTomography)
8
10
  ![Issues](https://img.shields.io/github/issues/qurit/PyTomography)
9
11
 
10
12
  # Getting Started
11
- We have prepared a very detailed documentation guide available at [readthedocs](https://pytomography.readthedocs.io/en/latest/). If you have any additional questions, please ask them on the [discourse website](https://pytomography.discourse.group/).
13
+ We have prepared a very detailed documentation guide available at [readthedocs](https://pytomography.readthedocs.io/en/latest/). If you have any additional questions, please ask them in [GitHub Discussions](https://github.com/PyTomography/PyTomography/discussions/categories/q-a). To contribute, see [CONTRIBUTING.md](CONTRIBUTING.md).
12
14
 
13
15
  # Research Paper
14
16
  If you use PyTomography in your own research, please cite the corresponding research paper:
@@ -0,0 +1,70 @@
1
+ # PyTomography example scripts
2
+
3
+ Plain-Python versions of every tutorial: the code that computes and saves the results, without the plots,
4
+ what only the plots need, or the explanations, so you can read a whole pipeline at a glance or run it as a
5
+ script. Each file links to the full tutorial on the docs site.
6
+
7
+ These files are generated from the notebooks in `docs/source/notebooks` by `docs/tools/export_scripts.py`.
8
+ Edit the notebook, then run that script; CI checks the two match.
9
+
10
+ Each script downloads the data it reads with `pytomography.datasets.fetch()`; the Tutorial data page of the
11
+ docs lists every dataset.
12
+
13
+ ## SPECT
14
+
15
+ | Script | What it does |
16
+ |---|---|
17
+ | [`spect/01_simind_introduction.py`](spect/01_simind_introduction.py) | A complete OSEM pipeline on Monte Carlo data, from projections to a reconstructed image. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_siminddata.html) |
18
+ | [`spect/02_dicom_introduction.py`](spect/02_dicom_introduction.py) | Reconstruct a phantom exported from a clinical scanner and compare with the vendor image. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_dicomdata.html) |
19
+ | [`spect/03_reconstruction_algorithms.py`](spect/03_reconstruction_algorithms.py) | OSEM, BSREM, OSMAPOSL and KEM side by side on the same data. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_algorithms.html) |
20
+ | [`spect/04_accuracy_against_known_truth.py`](spect/04_accuracy_against_known_truth.py) | Measure bias and noise in each sphere of a simulated phantom, with OSEM and BSREM. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_accuracy_known_truth.html) |
21
+ | [`spect/05_multiple_bed_positions.py`](spect/05_multiple_bed_positions.py) | Reconstruct several bed positions and stitch them into one volume. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_dicommultibed.html) |
22
+ | [`spect/06_multiple_photopeaks.py`](spect/06_multiple_photopeaks.py) | Joint reconstruction over two photopeaks of the same isotope. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_dualpeak.html) |
23
+ | [`spect/07_uncertainty_estimation.py`](spect/07_uncertainty_estimation.py) | Voxel and region uncertainty that comes out of the reconstruction itself. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_uncertainty_spect.html) |
24
+ | [`spect/08_hybrid_monte_carlo_simulated.py`](spect/08_hybrid_monte_carlo_simulated.py) | Monte Carlo scatter estimated inside the reconstruction loop with SIMIND. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_spect_mc.html) |
25
+ | [`spect/09_hybrid_monte_carlo_measured.py`](spect/09_hybrid_monte_carlo_measured.py) | The same hybrid approach on measured data. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_spect_mc2.html) |
26
+ | [`spect/10_ge_starguide.py`](spect/10_ge_starguide.py) | A 12-head CZT system with body-contour sweeps. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_starguide.html) |
27
+ | [`spect/11_psfs_from_angular_response_functions.py`](spect/11_psfs_from_angular_response_functions.py) | The collimator and detector simulated once, the PSF at any distance, and what each camera parameter changes. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_arf_psf.html) |
28
+ | [`spect/12_ac_225_psf_modelling_simind.py`](spect/12_ac_225_psf_modelling_simind.py) | Alpha-emitter imaging with PSFs from Monte Carlo ARFs (spectarf), penetration and collimator scatter included. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_ac225_simind_recon.html) |
29
+ | [`spect/13_ac_225_psf_modelling_dicom.py`](spect/13_ac_225_psf_modelling_dicom.py) | The same ARF PSFs on a measured Symbia T2 scan with a non-circular orbit. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_ac225_dicom_recon.html) |
30
+ | [`spect/14_ac_225_dual_photopeak.py`](spect/14_ac_225_dual_photopeak.py) | One image from the 218 and 440 keV photopeaks (ARF PSFs at 440 keV), against each peak alone. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_ac225_dualpeak.html) |
31
+ | [`spect/15_cardiac_reorientation.py`](spect/15_cardiac_reorientation.py) | Reconstruct myocardial perfusion data and reorient it to the short axis. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_CardiacReorientation.html) |
32
+ | [`spect/16_reconstruction_algorithms_on_measured_data.py`](spect/16_reconstruction_algorithms_on_measured_data.py) | OSEM, OSMAPOSL, BSREM and KEM on a measured NEMA phantom, compared by sphere contrast, background noise and data fit at every iteration. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_algorithms_measured.html) |
33
+ | [`spect/17_filtered_back_projection_spect.py`](spect/17_filtered_back_projection_spect.py) | Filtered back projection of a Lu-177 NEMA phantom scan, with Chang's attenuation correction, next to OSEM. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_fbp_spect.html) |
34
+ | [`spect/18_cgls_on_a_patient.py`](spect/18_cgls_on_a_patient.py) | Conjugate gradients for least squares on a two-bed Lu-177 PSMA patient, beside OSEM: the exact transpose it needs, when to stop, a diagonal preconditioner, weighted least squares, and its negative values. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_cgls.html) |
35
+ | [`spect/19_kernel_em_with_a_pet_prior.py`](spect/19_kernel_em_with_a_pet_prior.py) | Lu-177 SPECT of the Zubal phantom reconstructed with kernels from a Ga-68 PET image: one from its intensities, one learned by a 3D U-Net, beside MLEM. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_kernel_deep_kernel_spect_recon.html) |
36
+
37
+ ## PET
38
+
39
+ | Script | What it does |
40
+ |---|---|
41
+ | [`pet/01_pet_introduction_list_mode_and_sinograms.py`](pet/01_pet_introduction_list_mode_and_sinograms.py) | Reconstruct the same true coincidences as list mode and as sinograms, with normalisation and attenuation. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_pet_introduction.html) |
42
+ | [`pet/02_gate_sinogram.py`](pet/02_gate_sinogram.py) | Non-TOF sinogram reconstruction of a simulated brain phantom with scatter and randoms. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_PETGATE_scat_sino.html) |
43
+ | [`pet/03_gate_tof_sinogram.py`](pet/03_gate_tof_sinogram.py) | Time-of-flight sinogram reconstruction with TOF scatter estimation. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_PETGATE_scat_sinoTOF.html) |
44
+ | [`pet/04_gate_list_mode.py`](pet/04_gate_list_mode.py) | List-mode reconstruction with scatter and randoms correction. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_PETGATE_scat_lm.html) |
45
+ | [`pet/05_gate_tof_list_mode.py`](pet/05_gate_tof_list_mode.py) | Time-of-flight list-mode reconstruction with TOF scatter. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_PETGATE_scat_lmTOF.html) |
46
+ | [`pet/06_ge_discovery_mi.py`](pet/06_ge_discovery_mi.py) | Clinical list mode exported from GE Duetto, with time of flight. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_GE_HDF5.html) |
47
+ | [`pet/07_pet_uncertainty_estimation.py`](pet/07_pet_uncertainty_estimation.py) | Uncertainty estimates for a clinical PET reconstruction. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_uncertainty_pet.html) |
48
+ | [`pet/08_petsird_list_mode.py`](pet/08_petsird_list_mode.py) | A Siemens Biograph mMR scan in ETSI's open PETSIRD format, reconstructed without and with scatter correction. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_PETSIRD.html) |
49
+ | [`pet/09_deep_image_prior.py`](pet/09_deep_image_prior.py) | Build a PyTorch network and use it as the image model inside the reconstruction. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_PETGATE_DIP.html) |
50
+
51
+ ## CT
52
+
53
+ | Script | What it does |
54
+ |---|---|
55
+ | [`ct/01_dicom_ct_pd.py`](ct/01_dicom_ct_pd.py) | Filtered back projection of raw projections from a 3rd-generation clinical CT scanner, then the settings that reproduce the scanner's own images. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_CT_GEN3.html) |
56
+ | [`ct/02_cone_beam_micro_ct.py`](ct/02_cone_beam_micro_ct.py) | FDK and OS-SART on a laboratory micro-CT scan of glass beads, with the centre of rotation found from the data. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_CT_microct.html) |
57
+ | [`ct/03_filtered_back_projection_ct_windows_and_memory.py`](ct/03_filtered_back_projection_ct_windows_and_memory.py) | Helical filtered back projection of a clinical chest CT with six windows, their noise against resolution, and the memory settings that fit a given machine. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_fbp_ct.html) |
58
+
59
+ ## Proton CT
60
+
61
+ | Script | What it does |
62
+ |---|---|
63
+ | [`pct/01_single_sided_proton_ct_of_the_abdomen.py`](pct/01_single_sided_proton_ct_of_the_abdomen.py) | A simulated 330 MeV scan with a calorimeter behind the patient and nothing in front, reconstructed by two-pass filtered back projection and SART along curved paths, and scored on organs and range errors against the true stopping power. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_pct_abdomen.html) |
64
+
65
+ ## Building with PyTomography
66
+
67
+ | Script | What it does |
68
+ |---|---|
69
+ | [`development/01_implementing_a_new_system_matrix.py`](development/01_implementing_a_new_system_matrix.py) | Write your own forward and back projector and reuse every algorithm in the library. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_examplesystemmatrix.html) |
70
+ | [`development/02_plotting_utilities.py`](development/02_plotting_utilities.py) | Fused SPECT/CT views and other figure helpers. [Tutorial](https://pytomography.readthedocs.io/en/latest/notebooks/t_plotting.html) |
@@ -0,0 +1,97 @@
1
+ [build-system]
2
+ requires = ["hatchling", "toml"]
3
+ build-backend = "hatchling.build"
4
+
5
+ [project]
6
+ name = "pytomography"
7
+ version = "4.0.0"
8
+
9
+
10
+ authors = [
11
+ { name="Luke Polson", email="lukepolson@outlook.com" },
12
+ ]
13
+ description = "Package to perform tomographic image reconstruction"
14
+ readme = "README.md"
15
+ requires-python = ">=3.10"
16
+ classifiers = [
17
+ "Programming Language :: Python :: 3",
18
+ "Programming Language :: Python :: 3.10",
19
+ "Programming Language :: Python :: 3.11",
20
+ "Programming Language :: Python :: 3.12",
21
+ "Programming Language :: Python :: 3.13",
22
+ "License :: OSI Approved :: MIT License",
23
+ "Operating System :: OS Independent",
24
+ ]
25
+
26
+ dependencies = [
27
+ "numpy>=1.24.2",
28
+ "scipy>=1.10.1",
29
+ "pydicom>=3.0.1",
30
+ "torch>=2.4",
31
+ "matplotlib>=3.8.0",
32
+ "uproot>=5.2.1",
33
+ "rt_utils>=1.2.0",
34
+ "nibabel>=5.1.0",
35
+ "h5py>=3.11.0",
36
+ "torchrbf",
37
+ "pandas>=2.2",
38
+ "numba>=0.59",
39
+ # SPECT PSFs from Monte Carlo angular response functions (ARFs), from the camera tables of pytomography.io.SPECT.
40
+ # Its fast NVIDIA engine is its extra: pip install "spectarf[cuda]" (the docs' Installation page)
41
+ "spectarf>=0.1",
42
+ ]
43
+
44
+ [tool.hatch.metadata]
45
+ allow-direct-references = true
46
+
47
+ [project.urls]
48
+ "Homepage" = "https://github.com/PyTomography/PyTomography"
49
+ "Documentation" = "https://pytomography.readthedocs.io"
50
+ "Bug Tracker" = "https://github.com/PyTomography/PyTomography/issues"
51
+ "Discussions" = "https://github.com/PyTomography/PyTomography/discussions"
52
+
53
+ # The sdist ships the package and its metadata only: docs/ (tutorial notebooks with outputs) and .github/ stay in the
54
+ # repository.
55
+ [tool.hatch.build.targets.sdist]
56
+ include = [
57
+ "src/pytomography",
58
+ "README.md",
59
+ "LICENSE",
60
+ "CITATION.cff",
61
+ "pyproject.toml",
62
+ ]
63
+
64
+ [project.optional-dependencies]
65
+ # PETSIRD list mode, read with ETSI's package: 0.9 is the format of ETSI's converters and STIR
66
+ petsird = [
67
+ "petsird>=0.9,<0.10",
68
+ ]
69
+ test = [
70
+ "pytest>=8",
71
+ "pytest-xdist",
72
+ "pyyaml",
73
+ "petsird>=0.9,<0.10",
74
+ ]
75
+ dev = [
76
+ "pytomography[test,doc]",
77
+ "pre-commit",
78
+ "ruff",
79
+ ]
80
+ doc = [
81
+ "sphinx>=8,<9",
82
+ "pydata-sphinx-theme>=0.16",
83
+ "myst-nb>=1.1",
84
+ "sphinx-design",
85
+ "sphinx-copybutton",
86
+ "sphinx-autoapi>=3.3",
87
+ "sphinx-autobuild",
88
+ "pyyaml",
89
+ ]
90
+
91
+ [tool.pytest.ini_options]
92
+ testpaths = ["src/pytomography/tests"]
93
+ markers = [
94
+ "gpu: needs a CUDA device (skipped without one)",
95
+ "data: needs the tutorial data in PYTOMOGRAPHY_DATA (skipped without it)",
96
+ "network: checks the data hosts over the internet (skipped unless PYTOMOGRAPHY_NETWORK_TESTS=1)",
97
+ ]
@@ -0,0 +1,185 @@
1
+ """Quantitative SPECT, PET and CT reconstruction.
2
+
3
+ PyTomography reconstructs images from projection data. Data goes through four kinds of objects:
4
+
5
+ * :mod:`pytomography.io` reads raw data (DICOM, SIMIND, GATE, PETSIRD, vendor formats) into PyTomography's standard
6
+ form: the measured data, an ``object_meta`` (the image grid, in mm, placed in the patient) and a ``proj_meta``
7
+ (the acquisition), and saves images;
8
+ * :mod:`pytomography.projectors` holds the system matrices, which map an object to projections (``forward``) and
9
+ projections back to the object (``backward``, the back projection), built from the
10
+ :mod:`pytomography.transforms` that model attenuation, resolution and so on;
11
+ * :mod:`pytomography.likelihoods` compares predicted and measured projections;
12
+ * :mod:`pytomography.algorithms` reconstructs, optionally with :mod:`pytomography.priors` and
13
+ :mod:`pytomography.callbacks`.
14
+
15
+ The settings below apply to the whole library: ``device``, the device the computations run on (CUDA when available,
16
+ else Apple's MPS, else the CPU; change it with :func:`set_device`), the floating point type and a host memory budget
17
+ for the memory-heavy steps.
18
+ """
19
+ import torch
20
+ import os
21
+ import shutil
22
+ import sys
23
+ from importlib.metadata import version
24
+
25
+ __version__: str = version('pytomography')
26
+
27
+ # Silence parallelproj import
28
+ os.environ['PARALLELPROJ_SILENT_IMPORT'] = '1'
29
+
30
+ if not sys.warnoptions:
31
+ import warnings
32
+ warnings.simplefilter("ignore")
33
+
34
+ _GPU_CHECK_URL = "https://pytomography.readthedocs.io/en/latest/ai.html#check-that-pytomography-uses-the-gpu"
35
+
36
+
37
+ def _device_message(device: torch.device, nvidia_smi: str | None, cuda_visible_devices: str | None) -> str | None:
38
+ """What PyTomography says at import about the device it found.
39
+
40
+ A machine with an NVIDIA GPU (``nvidia-smi`` installed) where PyTorch cannot use it gets a warning with the likely
41
+ cause: a broken install runs on the CPU without failing, many times slower, and is easily taken for PyTomography's
42
+ normal speed.
43
+
44
+ Args:
45
+ device (torch.device): The device PyTomography found.
46
+ nvidia_smi (str | None): Path of ``nvidia-smi``, or None if it is not installed.
47
+ cuda_visible_devices (str | None): The ``CUDA_VISIBLE_DEVICES`` environment variable, or None if unset.
48
+
49
+ Returns:
50
+ str | None: The message, or None on a CUDA GPU.
51
+ """
52
+ if device.type == "cuda":
53
+ return None
54
+ if device.type == "mps":
55
+ return "PyTomography found an Apple Silicon GPU (mps); support for it is experimental."
56
+ if nvidia_smi is None:
57
+ return "PyTomography did not find a GPU on this machine, so it runs on the CPU."
58
+ if cuda_visible_devices is not None and cuda_visible_devices.strip() in ("", "-1"):
59
+ cause = f"CUDA_VISIBLE_DEVICES={cuda_visible_devices!r} hides the GPU; unset it to use the GPU."
60
+ elif torch.version.cuda is None:
61
+ cause = (f"PyTorch {torch.__version__} is a CPU-only build: reinstall PyTorch with the command for your CUDA "
62
+ "version from https://pytorch.org/get-started/locally/.")
63
+ else:
64
+ cause = (f"PyTorch {torch.__version__} is built for CUDA {torch.version.cuda} but cannot use the GPU: the NVIDIA "
65
+ "driver may be too old for it (nvidia-smi shows the newest CUDA version the driver supports).")
66
+ return ("WARNING: this machine has an NVIDIA GPU, but PyTomography is running on the CPU, which is many times "
67
+ f"slower. {cause} See {_GPU_CHECK_URL}")
68
+
69
+
70
+ def _parallelproj_message(device: torch.device | str, cuda_enabled: bool) -> str | None:
71
+ """What PyTomography says when PET or CT is imported with parallelproj's CPU build although PyTorch uses a CUDA
72
+ GPU: the PET and CT projectors then run on the CPU, many times slower.
73
+
74
+ Args:
75
+ device (torch.device | str): PyTomography's device.
76
+ cuda_enabled (bool): ``parallelproj_core.cuda_enabled``.
77
+
78
+ Returns:
79
+ str | None: The message, or None when there is nothing to say.
80
+ """
81
+ if torch.device(device).type != "cuda" or cuda_enabled:
82
+ return None
83
+ return ("WARNING: PyTomography uses the GPU, but parallelproj is its CPU build, so PET and CT projections run on the "
84
+ "CPU, many times slower. Install the libparallelproj build that matches your CUDA version, e.g. "
85
+ '`conda install -c conda-forge "libparallelproj=*=cuda130*" parallelproj`. See ' + _GPU_CHECK_URL)
86
+
87
+
88
+ def _say(message: str | None) -> None:
89
+ if message:
90
+ print(message, file=sys.stderr if message.startswith("WARNING") else sys.stdout)
91
+
92
+
93
+ _parallelproj_checked = False
94
+
95
+
96
+ def _check_parallelproj(parallelproj_core) -> None:
97
+ """Warns once, when PET or CT is first imported, if parallelproj is its CPU build on a GPU machine."""
98
+ global _parallelproj_checked
99
+ if not _parallelproj_checked:
100
+ _parallelproj_checked = True
101
+ _say(_parallelproj_message(device, bool(getattr(parallelproj_core, "cuda_enabled", False))))
102
+
103
+
104
+ device = torch.device("cuda" if torch.cuda.is_available() else "mps" if torch.backends.mps.is_available() else "cpu")
105
+ """The device PyTomography computes on: CUDA when PyTorch sees an NVIDIA GPU, else Apple's MPS, else the CPU. Change it
106
+ with :func:`set_device`. On import, PyTomography warns if the machine has an NVIDIA GPU that PyTorch cannot use."""
107
+ _say(_device_message(device, shutil.which("nvidia-smi"), os.environ.get("CUDA_VISIBLE_DEVICES")))
108
+ dtype = torch.float32
109
+ """The floating point type of PyTomography's tensors. Set it with :func:`set_dtype`."""
110
+ delta = 1e-11
111
+ """A small number added to denominators to avoid dividing by zero (set by :func:`set_dtype`)."""
112
+ verbose = False
113
+ """A flag set by :func:`set_verbose`. No part of the library reads it at present."""
114
+
115
+ def set_dtype(dt: float):
116
+ """Sets the floating point type of PyTomography's tensors, and torch's default type.
117
+
118
+ Also sets :data:`delta` to suit the type: 1e-5 for ``torch.float16``, 1e-11 for ``torch.float32`` (other types
119
+ leave it unchanged).
120
+
121
+ Args:
122
+ dt (torch.dtype): The type, e.g. ``torch.float32``.
123
+ """
124
+ global dtype
125
+ global delta
126
+ dtype = dt
127
+ torch.set_default_dtype(dt)
128
+ if dt==torch.float16:
129
+ delta = 1e-5
130
+ elif dt==torch.float32:
131
+ delta = 1e-11
132
+
133
+ def set_device(d: str):
134
+ """Sets the device PyTomography computes on.
135
+
136
+ Args:
137
+ d (str | torch.device): The device, e.g. ``'cuda'``, ``'cuda:1'`` or ``'cpu'``.
138
+ """
139
+ global device
140
+ device = d
141
+
142
+ def set_verbose(b: bool):
143
+ """Sets the :data:`verbose` flag.
144
+
145
+ Args:
146
+ b (bool): The new value.
147
+ """
148
+ global verbose
149
+ verbose = b
150
+
151
+ memory_budget = None
152
+ """Host memory (RAM), in bytes, that PyTomography's memory-heavy steps plan for, or None for no budget. Set it with
153
+ :func:`set_memory_budget`."""
154
+
155
+ def set_memory_budget(gb: float | None):
156
+ """Sets how much host memory (RAM), in GB, PyTomography's memory-heavy steps may use.
157
+
158
+ They split their work to fit:
159
+
160
+ * steps that go through every pair of crystals of a PET scanner (normalization weights and sinograms, the list mode
161
+ sensitivity image; 411 million pairs for the Siemens Biograph mMR) do so in blocks sized from the budget;
162
+ * a sinogram that would take more than a quarter of the budget is built one subset of angles at a time instead of
163
+ whole (a :class:`~pytomography.io.PET.LazySinogram`), e.g. a time of flight sinogram;
164
+ * helical CT filtered back projection rebins a chunk of views at a time, at most an eighth of the budget;
165
+ * a reconstruction whose subsets would not fit stops before it starts, with the number of subsets that would.
166
+
167
+ The results do not depend on the budget. Without one (the default), blocks have fixed sizes, and sinograms are
168
+ built whole unless one would take more than 8 GB (a TOF sinogram of a clinical scanner).
169
+
170
+ To see what a reconstruction will need before running it, ask its system matrix or algorithm: ``estimate_memory``
171
+ gives the peak RAM and GPU memory for given settings (e.g. ``n_subsets``), and ``plan_memory`` the fastest settings
172
+ that fit a RAM and GPU budget, by default what is free on this machine (see :mod:`pytomography.utils.memory`).
173
+
174
+ Args:
175
+ gb (float | None): Memory budget in GB, or None for no budget.
176
+
177
+ Raises:
178
+ ValueError: If ``gb`` is not positive.
179
+ """
180
+ global memory_budget
181
+ if gb is not None and gb <= 0:
182
+ raise ValueError(f"the memory budget must be positive, got {gb} GB")
183
+ memory_budget = None if gb is None else float(gb) * 1e9
184
+
185
+
@@ -0,0 +1,27 @@
1
+ """Reconstruction algorithms.
2
+
3
+ Statistical algorithms take a likelihood (:mod:`pytomography.likelihoods`), and some a prior
4
+ (:mod:`pytomography.priors`); calling one with the number of iterations and subsets reconstructs:
5
+
6
+ * :class:`OSEM` and :class:`MLEM`: ordered subset expectation maximisation;
7
+ * :class:`OSMAPOSL`, :class:`BSREM`, :class:`RBIMAP`: maximum a posteriori, with a prior;
8
+ * :class:`RBIEM`: rescaled block iterative EM;
9
+ * :class:`KEM`: the kernel method (with :class:`~pytomography.projectors.shared.KEMSystemMatrix`);
10
+ * :class:`SART`: simultaneous algebraic reconstruction (least squares, e.g. CT);
11
+ * :class:`PGAAMultiBedSPECT`: several SPECT bed positions reconstructed together and stitched;
12
+ * :class:`PreconditionedGradientAscentAlgorithm`: the base class of all of them;
13
+ * :class:`DIPRecon`: the deep image prior.
14
+
15
+ :class:`FilteredBackProjection` is the analytic reconstruction of SPECT and CT projections.
16
+ :class:`CGLS` solves unweighted least squares with a matched forward/adjoint pair, allowing negative image values.
17
+
18
+ Example:
19
+ .. code-block:: python
20
+
21
+ likelihood = PoissonLogLikelihood(system_matrix, projections)
22
+ recon = OSEM(likelihood)(n_iters=4, n_subsets=8)
23
+ """
24
+ from .preconditioned_gradient_ascent import PreconditionedGradientAscentAlgorithm, OSEM, OSMAPOSL, BSREM, KEM, RBIEM, RBIMAP, SART, PGAAMultiBedSPECT, MLEM
25
+ from .fbp import FilteredBackProjection
26
+ from .dip_recon import DIPRecon
27
+ from .cgls import CGLS