diffct 2.5.1__tar.gz → 2.5.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (221) hide show
  1. {diffct-2.5.1 → diffct-2.5.3}/CHANGELOG.md +137 -0
  2. {diffct-2.5.1 → diffct-2.5.3}/CITATION.cff +2 -2
  3. diffct-2.5.3/PKG-INFO +217 -0
  4. diffct-2.5.3/README.md +184 -0
  5. {diffct-2.5.1 → diffct-2.5.3}/diffct/__init__.py +21 -1
  6. {diffct-2.5.1 → diffct-2.5.3}/diffct/_solver_state.py +383 -61
  7. {diffct-2.5.1 → diffct-2.5.3}/diffct/analytical.py +21 -2
  8. {diffct-2.5.1 → diffct-2.5.3}/diffct/analytical_execution.py +24 -6
  9. {diffct-2.5.1 → diffct-2.5.3}/diffct/backends.py +263 -138
  10. {diffct-2.5.1 → diffct-2.5.3}/diffct/chunking.py +14 -10
  11. diffct-2.5.3/diffct/clinical.py +291 -0
  12. {diffct-2.5.1 → diffct-2.5.3}/diffct/distribution.py +28 -1
  13. {diffct-2.5.1 → diffct-2.5.3}/diffct/geometry.py +2 -1
  14. {diffct-2.5.1 → diffct-2.5.3}/diffct/kernels/__init__.py +6 -0
  15. {diffct-2.5.1 → diffct-2.5.3}/diffct/kernels/geometry_vjp.py +7 -5
  16. diffct-2.5.3/diffct/kernels/parallel3d_beam.py +357 -0
  17. {diffct-2.5.1 → diffct-2.5.3}/diffct/kernels/parallel_beam.py +4 -4
  18. diffct-2.5.3/diffct/mayo.py +292 -0
  19. {diffct-2.5.1 → diffct-2.5.3}/diffct/operators.py +247 -129
  20. {diffct-2.5.1 → diffct-2.5.3}/diffct/pipeline.py +190 -31
  21. {diffct-2.5.1 → diffct-2.5.3}/diffct/projectors.py +32 -15
  22. {diffct-2.5.1 → diffct-2.5.3}/diffct/solvers.py +217 -118
  23. {diffct-2.5.1 → diffct-2.5.3}/diffct/streaming.py +36 -5
  24. {diffct-2.5.1 → diffct-2.5.3}/diffct/utils.py +329 -6
  25. {diffct-2.5.1 → diffct-2.5.3}/docs/assets/gallery/NOTICE +3 -2
  26. diffct-2.5.3/docs/search/tests/fixtures/runtime-cancel/search.html +14 -0
  27. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/full-model.spec.mjs +2 -2
  28. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/harness.mjs +55 -8
  29. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/item1-ordering.spec.mjs +6 -2
  30. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/item5-errors.spec.mjs +5 -6
  31. diffct-2.5.3/docs/search/tests/item8-failures.spec.mjs +370 -0
  32. diffct-2.5.3/docs/search/tests/item9-toggle-cache.spec.mjs +593 -0
  33. diffct-2.5.3/docs/search/tests/runtime-cancel.config.mjs +20 -0
  34. diffct-2.5.3/docs/search/tests/runtime-cancel.spec.mjs +235 -0
  35. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/semantic-opt-in.spec.mjs +1 -1
  36. diffct-2.5.3/docs/search/tests/site-pages.spec.mjs +429 -0
  37. diffct-2.5.3/docs/search/tests/worker-lifecycle.spec.mjs +189 -0
  38. {diffct-2.5.1 → diffct-2.5.3}/formal/README.md +5 -2
  39. {diffct-2.5.1 → diffct-2.5.3}/formal/tla/README.md +13 -8
  40. {diffct-2.5.1 → diffct-2.5.3}/pyproject.toml +2 -1
  41. {diffct-2.5.1 → diffct-2.5.3}/tests/_native_per_axis_spacing.py +1 -1
  42. diffct-2.5.3/tests/_numba_cuda.py +18 -0
  43. diffct-2.5.3/tests/test_analytical_input_alias.py +203 -0
  44. diffct-2.5.3/tests/test_analytical_input_alias_bfloat16.py +121 -0
  45. {diffct-2.5.1 → diffct-2.5.3}/tests/test_analytical_regressions.py +16 -7
  46. {diffct-2.5.1 → diffct-2.5.3}/tests/test_block_storage.py +2 -0
  47. diffct-2.5.3/tests/test_cgls_guard_exact_local.py +667 -0
  48. diffct-2.5.3/tests/test_cgls_readonly_callback.py +519 -0
  49. {diffct-2.5.1 → diffct-2.5.3}/tests/test_chunked_projector.py +5 -1
  50. diffct-2.5.3/tests/test_clinical.py +255 -0
  51. {diffct-2.5.1 → diffct-2.5.3}/tests/test_cuda_exit_deallocations.py +4 -0
  52. diffct-2.5.3/tests/test_distributed_numeric_failure.py +370 -0
  53. diffct-2.5.3/tests/test_distributed_numeric_failure_native.py +449 -0
  54. {diffct-2.5.1 → diffct-2.5.3}/tests/test_execution_schedules.py +5 -3
  55. diffct-2.5.3/tests/test_execution_state_ownership.py +903 -0
  56. diffct-2.5.3/tests/test_execution_state_ownership_gpu.py +253 -0
  57. {diffct-2.5.1 → diffct-2.5.3}/tests/test_gradcheck.py +40 -3
  58. {diffct-2.5.1 → diffct-2.5.3}/tests/test_lazy_native_observers.py +37 -6
  59. diffct-2.5.3/tests/test_mapped_solver_io_and_checkpoint.py +1585 -0
  60. diffct-2.5.3/tests/test_mayo.py +229 -0
  61. diffct-2.5.3/tests/test_native_stream_cache_threads.py +157 -0
  62. {diffct-2.5.1 → diffct-2.5.3}/tests/test_parallel3d.py +3 -3
  63. diffct-2.5.3/tests/test_parallel3d_native.py +741 -0
  64. diffct-2.5.3/tests/test_parallel3d_native_distributed.py +453 -0
  65. diffct-2.5.3/tests/test_portable_into_default_dtype.py +42 -0
  66. diffct-2.5.3/tests/test_portable_into_snapshots.py +58 -0
  67. diffct-2.5.3/tests/test_portable_into_state_edges.py +122 -0
  68. diffct-2.5.3/tests/test_portable_into_work_plan.py +241 -0
  69. {diffct-2.5.1 → diffct-2.5.3}/tests/test_projector_api.py +2 -1
  70. diffct-2.5.3/tests/test_projector_thread_safety.py +263 -0
  71. diffct-2.5.3/tests/test_runtime_store_failures.py +258 -0
  72. {diffct-2.5.1 → diffct-2.5.3}/tests/test_solver_api.py +68 -0
  73. {diffct-2.5.1 → diffct-2.5.3}/tests/test_solver_device_scalars.py +209 -10
  74. diffct-2.5.3/tests/test_store_runtime_contract.py +197 -0
  75. {diffct-2.5.1 → diffct-2.5.3}/tests/test_surface_collective_failures.py +3 -1
  76. {diffct-2.5.1 → diffct-2.5.3}/tests/test_surface_pipeline_contracts.py +2 -1
  77. {diffct-2.5.1 → diffct-2.5.3}/tests/test_weights.py +27 -0
  78. diffct-2.5.1/PKG-INFO +0 -282
  79. diffct-2.5.1/README.md +0 -251
  80. {diffct-2.5.1 → diffct-2.5.3}/.gitignore +0 -0
  81. {diffct-2.5.1 → diffct-2.5.3}/LICENSE +0 -0
  82. {diffct-2.5.1 → diffct-2.5.3}/NOTICE +0 -0
  83. {diffct-2.5.1 → diffct-2.5.3}/diffct/_solver_tv.py +0 -0
  84. {diffct-2.5.1 → diffct-2.5.3}/diffct/constants.py +0 -0
  85. {diffct-2.5.1 → diffct-2.5.3}/diffct/differentiable.py +0 -0
  86. {diffct-2.5.1 → diffct-2.5.3}/diffct/kernels/analytical_transpose.py +0 -0
  87. {diffct-2.5.1 → diffct-2.5.3}/diffct/kernels/cone_beam.py +0 -0
  88. {diffct-2.5.1 → diffct-2.5.3}/diffct/kernels/fan_beam.py +0 -0
  89. {diffct-2.5.1 → diffct-2.5.3}/diffct/kernels/spacing.py +0 -0
  90. {diffct-2.5.1 → diffct-2.5.3}/diffct/kernels/surface_geometry.py +0 -0
  91. {diffct-2.5.1 → diffct-2.5.3}/diffct/reconstruction.py +0 -0
  92. {diffct-2.5.1 → diffct-2.5.3}/diffct/storage.py +0 -0
  93. {diffct-2.5.1 → diffct-2.5.3}/diffct/surface_gradients.py +0 -0
  94. {diffct-2.5.1 → diffct-2.5.3}/diffct/surfaces.py +0 -0
  95. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/.gitignore +0 -0
  96. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/fixtures/make_tiny_model.py +0 -0
  97. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/fixtures/tiny-model/config.json +0 -0
  98. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/fixtures/tiny-model/onnx/model_quantized.onnx +0 -0
  99. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/fixtures/tiny-model/onnx/model_quantized.onnx_data +0 -0
  100. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/fixtures/tiny-model/tokenizer.json +0 -0
  101. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/fixtures/tiny-model/tokenizer_config.json +0 -0
  102. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/item2-single-load.spec.mjs +0 -0
  103. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/item3-cancel.spec.mjs +0 -0
  104. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/item4-leaks.spec.mjs +0 -0
  105. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/item6-a11y.spec.mjs +0 -0
  106. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/item7-security.spec.mjs +0 -0
  107. {diffct-2.5.1 → diffct-2.5.3}/docs/search/tests/playwright.config.mjs +0 -0
  108. {diffct-2.5.1 → diffct-2.5.3}/docs/video/README.md +0 -0
  109. {diffct-2.5.1 → diffct-2.5.3}/examples/README.md +0 -0
  110. {diffct-2.5.1 → diffct-2.5.3}/examples/_block_cgls.py +0 -0
  111. {diffct-2.5.1 → diffct-2.5.3}/examples/_common.py +0 -0
  112. {diffct-2.5.1 → diffct-2.5.3}/examples/data/NOTICE +0 -0
  113. {diffct-2.5.1 → diffct-2.5.3}/examples/data/preprocess_walnut.py +0 -0
  114. {diffct-2.5.1 → diffct-2.5.3}/examples/walnut_reconstruction.py +0 -0
  115. {diffct-2.5.1 → diffct-2.5.3}/pytest.ini +0 -0
  116. {diffct-2.5.1 → diffct-2.5.3}/tests/__init__.py +0 -0
  117. {diffct-2.5.1 → diffct-2.5.3}/tests/_multiprocessing.py +0 -0
  118. {diffct-2.5.1 → diffct-2.5.3}/tests/_phantoms.py +0 -0
  119. {diffct-2.5.1 → diffct-2.5.3}/tests/benchmarks/README.md +0 -0
  120. {diffct-2.5.1 → diffct-2.5.3}/tests/benchmarks/__init__.py +0 -0
  121. {diffct-2.5.1 → diffct-2.5.3}/tests/benchmarks/_common.py +0 -0
  122. {diffct-2.5.1 → diffct-2.5.3}/tests/benchmarks/test_bench_cone.py +0 -0
  123. {diffct-2.5.1 → diffct-2.5.3}/tests/benchmarks/test_bench_fan.py +0 -0
  124. {diffct-2.5.1 → diffct-2.5.3}/tests/benchmarks/test_bench_parallel.py +0 -0
  125. {diffct-2.5.1 → diffct-2.5.3}/tests/distributed_projector_check.py +0 -0
  126. {diffct-2.5.1 → diffct-2.5.3}/tests/fixtures/native_scalar_spacing_main.npz +0 -0
  127. {diffct-2.5.1 → diffct-2.5.3}/tests/test_adjoint_inner_product.py +0 -0
  128. {diffct-2.5.1 → diffct-2.5.3}/tests/test_allocator_capacity.py +0 -0
  129. {diffct-2.5.1 → diffct-2.5.3}/tests/test_analytical_autograd.py +0 -0
  130. {diffct-2.5.1 → diffct-2.5.3}/tests/test_analytical_distribution.py +0 -0
  131. {diffct-2.5.1 → diffct-2.5.3}/tests/test_analytical_weight_distribution.py +0 -0
  132. {diffct-2.5.1 → diffct-2.5.3}/tests/test_angular_low_precision.py +0 -0
  133. {diffct-2.5.1 → diffct-2.5.3}/tests/test_axis_aligned_chords.py +0 -0
  134. {diffct-2.5.1 → diffct-2.5.3}/tests/test_batch_execution_edges.py +0 -0
  135. {diffct-2.5.1 → diffct-2.5.3}/tests/test_batched_surfaces.py +0 -0
  136. {diffct-2.5.1 → diffct-2.5.3}/tests/test_block_cgls.py +0 -0
  137. {diffct-2.5.1 → diffct-2.5.3}/tests/test_call_trajectory.py +0 -0
  138. {diffct-2.5.1 → diffct-2.5.3}/tests/test_cgls_state_admission.py +0 -0
  139. {diffct-2.5.1 → diffct-2.5.3}/tests/test_checkpoint_metadata_validation.py +0 -0
  140. {diffct-2.5.1 → diffct-2.5.3}/tests/test_completed_transfer_reuse.py +0 -0
  141. {diffct-2.5.1 → diffct-2.5.3}/tests/test_cone_backprojection_transpose.py +0 -0
  142. {diffct-2.5.1 → diffct-2.5.3}/tests/test_cone_projector_autograd.py +0 -0
  143. {diffct-2.5.1 → diffct-2.5.3}/tests/test_cpu_install.py +0 -0
  144. {diffct-2.5.1 → diffct-2.5.3}/tests/test_cuda_sink_lifetimes.py +0 -0
  145. {diffct-2.5.1 → diffct-2.5.3}/tests/test_cuda_smoke.py +0 -0
  146. {diffct-2.5.1 → diffct-2.5.3}/tests/test_detector_surface_dtypes.py +0 -0
  147. {diffct-2.5.1 → diffct-2.5.3}/tests/test_detector_surface_mapping.py +0 -0
  148. {diffct-2.5.1 → diffct-2.5.3}/tests/test_detector_surface_units.py +0 -0
  149. {diffct-2.5.1 → diffct-2.5.3}/tests/test_detector_surfaces.py +0 -0
  150. {diffct-2.5.1 → diffct-2.5.3}/tests/test_distributed_training_transforms.py +0 -0
  151. {diffct-2.5.1 → diffct-2.5.3}/tests/test_example_psnr.py +0 -0
  152. {diffct-2.5.1 → diffct-2.5.3}/tests/test_execution_buffers.py +0 -0
  153. {diffct-2.5.1 → diffct-2.5.3}/tests/test_execution_features.py +0 -0
  154. {diffct-2.5.1 → diffct-2.5.3}/tests/test_fbp_fan_accuracy.py +0 -0
  155. {diffct-2.5.1 → diffct-2.5.3}/tests/test_fbp_fan_offsets.py +0 -0
  156. {diffct-2.5.1 → diffct-2.5.3}/tests/test_fbp_parallel_accuracy.py +0 -0
  157. {diffct-2.5.1 → diffct-2.5.3}/tests/test_fdk_cone_accuracy.py +0 -0
  158. {diffct-2.5.1 → diffct-2.5.3}/tests/test_fdk_cone_offsets.py +0 -0
  159. {diffct-2.5.1 → diffct-2.5.3}/tests/test_geometry_autograd.py +0 -0
  160. {diffct-2.5.1 → diffct-2.5.3}/tests/test_geometry_conversions.py +0 -0
  161. {diffct-2.5.1 → diffct-2.5.3}/tests/test_geometry_gradients.py +0 -0
  162. {diffct-2.5.1 → diffct-2.5.3}/tests/test_geometry_input_validation.py +0 -0
  163. {diffct-2.5.1 → diffct-2.5.3}/tests/test_gpu_performance_contracts.py +0 -0
  164. {diffct-2.5.1 → diffct-2.5.3}/tests/test_live_trajectory_validation.py +0 -0
  165. {diffct-2.5.1 → diffct-2.5.3}/tests/test_mps_backend.py +0 -0
  166. {diffct-2.5.1 → diffct-2.5.3}/tests/test_multi_gpu_exit.py +0 -0
  167. {diffct-2.5.1 → diffct-2.5.3}/tests/test_multiprocessing.py +0 -0
  168. {diffct-2.5.1 → diffct-2.5.3}/tests/test_native_endpoint_precision.py +0 -0
  169. {diffct-2.5.1 → diffct-2.5.3}/tests/test_native_per_axis_admission.py +0 -0
  170. {diffct-2.5.1 → diffct-2.5.3}/tests/test_native_per_axis_extremes.py +0 -0
  171. {diffct-2.5.1 → diffct-2.5.3}/tests/test_native_per_axis_helical.py +0 -0
  172. {diffct-2.5.1 → diffct-2.5.3}/tests/test_native_per_axis_spacing.py +0 -0
  173. {diffct-2.5.1 → diffct-2.5.3}/tests/test_native_per_axis_spacing_gpu.py +0 -0
  174. {diffct-2.5.1 → diffct-2.5.3}/tests/test_native_surface_transforms.py +0 -0
  175. {diffct-2.5.1 → diffct-2.5.3}/tests/test_native_volume_layout.py +0 -0
  176. {diffct-2.5.1 → diffct-2.5.3}/tests/test_native_volume_layout_distributed.py +0 -0
  177. {diffct-2.5.1 → diffct-2.5.3}/tests/test_output_pipeline_overlap.py +0 -0
  178. {diffct-2.5.1 → diffct-2.5.3}/tests/test_parallel3d_surface_oracle.py +0 -0
  179. {diffct-2.5.1 → diffct-2.5.3}/tests/test_partition_lifecycle.py +0 -0
  180. {diffct-2.5.1 → diffct-2.5.3}/tests/test_plan_memory_bounds.py +0 -0
  181. {diffct-2.5.1 → diffct-2.5.3}/tests/test_portable_accuracy.py +0 -0
  182. {diffct-2.5.1 → diffct-2.5.3}/tests/test_portable_bounded_autograd.py +0 -0
  183. {diffct-2.5.1 → diffct-2.5.3}/tests/test_portable_cuda_budget.py +0 -0
  184. {diffct-2.5.1 → diffct-2.5.3}/tests/test_portable_distributed_geometry.py +0 -0
  185. {diffct-2.5.1 → diffct-2.5.3}/tests/test_portable_endpoint_precision.py +0 -0
  186. {diffct-2.5.1 → diffct-2.5.3}/tests/test_portable_execution_bounds.py +0 -0
  187. {diffct-2.5.1 → diffct-2.5.3}/tests/test_portable_numeric_regressions.py +0 -0
  188. {diffct-2.5.1 → diffct-2.5.3}/tests/test_portable_sampler_snapshot.py +0 -0
  189. {diffct-2.5.1 → diffct-2.5.3}/tests/test_portable_surface_admission.py +0 -0
  190. {diffct-2.5.1 → diffct-2.5.3}/tests/test_pr42_review_regressions.py +0 -0
  191. {diffct-2.5.1 → diffct-2.5.3}/tests/test_projector_degenerate_geometry.py +0 -0
  192. {diffct-2.5.1 → diffct-2.5.3}/tests/test_projector_geometry_devices.py +0 -0
  193. {diffct-2.5.1 → diffct-2.5.3}/tests/test_ramp_filter_windows.py +0 -0
  194. {diffct-2.5.1 → diffct-2.5.3}/tests/test_reconstruction_api.py +0 -0
  195. {diffct-2.5.1 → diffct-2.5.3}/tests/test_reconstruction_work_reuse.py +0 -0
  196. {diffct-2.5.1 → diffct-2.5.3}/tests/test_reference_backend.py +0 -0
  197. {diffct-2.5.1 → diffct-2.5.3}/tests/test_release_2_0_1.py +0 -0
  198. {diffct-2.5.1 → diffct-2.5.3}/tests/test_review_230.py +0 -0
  199. {diffct-2.5.1 → diffct-2.5.3}/tests/test_review_regressions.py +0 -0
  200. {diffct-2.5.1 → diffct-2.5.3}/tests/test_solver_admission_regressions.py +0 -0
  201. {diffct-2.5.1 → diffct-2.5.3}/tests/test_solver_checkpoint_edges.py +0 -0
  202. {diffct-2.5.1 → diffct-2.5.3}/tests/test_solver_collective_failures.py +0 -0
  203. {diffct-2.5.1 → diffct-2.5.3}/tests/test_spatial_partition.py +0 -0
  204. {diffct-2.5.1 → diffct-2.5.3}/tests/test_surface_composition_kernel.py +0 -0
  205. {diffct-2.5.1 → diffct-2.5.3}/tests/test_surface_compute_shards.py +0 -0
  206. {diffct-2.5.1 → diffct-2.5.3}/tests/test_surface_geometry_cudasim.py +0 -0
  207. {diffct-2.5.1 → diffct-2.5.3}/tests/test_surface_gpu_execution.py +0 -0
  208. {diffct-2.5.1 → diffct-2.5.3}/tests/test_surface_gradient_replay.py +0 -0
  209. {diffct-2.5.1 → diffct-2.5.3}/tests/test_surface_host_sampling_budget.py +0 -0
  210. {diffct-2.5.1 → diffct-2.5.3}/tests/test_surface_native_regressions.py +0 -0
  211. {diffct-2.5.1 → diffct-2.5.3}/tests/test_surface_parameter_updates.py +0 -0
  212. {diffct-2.5.1 → diffct-2.5.3}/tests/test_surface_saved_snapshot_budget.py +0 -0
  213. {diffct-2.5.1 → diffct-2.5.3}/tests/test_surface_snapshot_admission.py +0 -0
  214. {diffct-2.5.1 → diffct-2.5.3}/tests/test_surface_trajectory_transform.py +0 -0
  215. {diffct-2.5.1 → diffct-2.5.3}/tests/test_training_transforms.py +0 -0
  216. {diffct-2.5.1 → diffct-2.5.3}/tests/test_trajectory_admission_cost.py +0 -0
  217. {diffct-2.5.1 → diffct-2.5.3}/tests/test_trajectory_surface_integration.py +0 -0
  218. {diffct-2.5.1 → diffct-2.5.3}/tests/test_transfer_pipeline.py +0 -0
  219. {diffct-2.5.1 → diffct-2.5.3}/tests/test_transfer_retirement_lifetimes.py +0 -0
  220. {diffct-2.5.1 → diffct-2.5.3}/tests/test_tv_zero_dependency.py +0 -0
  221. {diffct-2.5.1 → diffct-2.5.3}/tests/test_two_far_endpoints.py +0 -0
@@ -5,6 +5,143 @@ All notable changes to this project are documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [Unreleased]
9
+
10
+ ## [2.5.3] - 2026-12-02
11
+
12
+ ### Added
13
+
14
+ - `Projector.last_execution` exposes a caller-owned per-thread execution handle
15
+ (`generation`, `owner`, `phase`, `forward_stats`, `backward_stats`,
16
+ `latest_stats`) that preserves caller attribution across bound-trajectory and
17
+ `ParameterizedSurface` calls and isolates stale or higher-order autograd
18
+ backward passes from newer forward reports; `last_execution_stats` remains a
19
+ compatibility view ([#92](https://github.com/sypsyp97/diffct/pull/92)).
20
+ - Optional `diffct[dicom]` reader for sparse DICOM-CT-PD projections and
21
+ `clinical_geometry` for measured cylindrical detectors and flying focal
22
+ spots on CPU or GPU. The clinical gallery uses the scan's water calibration
23
+ ([#82](https://github.com/sypsyp97/diffct/pull/82)).
24
+ - Mayo 2016/2020 public dataset helpers in `diffct.mayo`: patient folder
25
+ discovery, `load_mayo_case` returning `ClinicalScan` plus the vendor
26
+ reference image series, `read_dicom_ct_images` with HU conversion, and
27
+ `attenuation_to_hu`/`hu_to_attenuation` water calibration in both directions
28
+ ([#84](https://github.com/sypsyp97/diffct/pull/84),
29
+ [#88](https://github.com/sypsyp97/diffct/pull/88)).
30
+ - `probe_dicom_ct_pd` reads only CT-PD headers with `stop_before_pixels=True`
31
+ and returns file-count, detector, manufacturer and manufacturer-model
32
+ metadata for cohort selection. `ClinicalScan.manufacturer_model_name`
33
+ exposes the optional DICOM manufacturer model as a constant series property
34
+ ([#88](https://github.com/sypsyp97/diffct/pull/88)).
35
+
36
+ ### Changed
37
+
38
+ - DICOM-CT-PD projection reading accepts `.ima` as well as `.dcm`, unwraps the
39
+ instance-sorted scan angles, and writes pixels into one preallocated array
40
+ rather than forming a second full `np.stack` copy
41
+ ([#88](https://github.com/sypsyp97/diffct/pull/88)).
42
+
43
+ ### Fixed
44
+
45
+ - Distributed mapped CGLS (`cgls_into`) gates rank-local store reads, updates,
46
+ mapped norm reads and flushes before the next collective or return so a local
47
+ I/O failure raises promptly on every rank while keeping the parent process
48
+ group reusable. Pure-tensor `squared_norm` skips I/O gating so `cgls`, `sirt`
49
+ and `tv_reconstruction` add no extra control collectives. Failed checkpoint
50
+ staging or publication attempts clean up only attempt-created directories so
51
+ clean aborts can be retried on the same step, and raise a chained
52
+ `RuntimeError` across all ranks naming leftover rank directory paths if
53
+ cleanup or its protected post-cleanup `os.lstat` check fails. Explicit
54
+ transfer pipeline and search worker lifecycle phases prevent stale re-entry
55
+ and duplicate loads ([#92](https://github.com/sypsyp97/diffct/pull/92)).
56
+ - The read-only check on a `cgls` callback no longer copies the whole iterate
57
+ to the host. It compares a checksum computed on the iterate's own device and
58
+ reads back one flag, so a CUDA solve with a callback makes at most three
59
+ small readbacks per iteration
60
+ ([#81](https://github.com/sypsyp97/diffct/pull/81)).
61
+ - Portable projector backward accepts undefined output gradients, including
62
+ the default `torch.autograd.gradcheck` checks, while keeping distributed
63
+ backward collectives in lockstep
64
+ ([#80](https://github.com/sypsyp97/diffct/pull/80)).
65
+ - Native 2D parallel projection and backprojection with scalar voxel spacing
66
+ now normalize ray directions, matching per-axis spacing and the portable
67
+ backend for non-unit directions. Ray-direction gradients have no radial
68
+ component, consistently differentiating only the direction of each ray
69
+ ([#79](https://github.com/sypsyp97/diffct/pull/79)).
70
+ - `cgls` and `cgls_into` report `converged=True` with reason
71
+ `"normal equations satisfied"` when the normal-equation residual `Aᵀr` is
72
+ exactly zero, reserving `"normal equation breakdown"` for nonzero `Aᵀr`
73
+ whose search direction projects to zero
74
+ ([#78](https://github.com/sypsyp97/diffct/pull/78)).
75
+ - `angular_integration_weights` integrates wrapped short scans over their
76
+ acquired arc rather than treating them as full turns when the unacquired
77
+ gap is clearly larger than the view spacing
78
+ ([#77](https://github.com/sypsyp97/diffct/pull/77)).
79
+ - Mayo 2020 folder discovery chooses deterministically when several candidate
80
+ folders match the same dose/kind classification
81
+ ([#88](https://github.com/sypsyp97/diffct/pull/88)).
82
+ - The CPU test suite runs against a plain wheel without a CUDA runtime. CI
83
+ checks the full suite both with and without the `cu12` extra
84
+ ([#76](https://github.com/sypsyp97/diffct/pull/76)).
85
+
86
+ ### Documentation
87
+
88
+ - Restructured the project README as a clinical CT reconstruction overview with
89
+ real DICOM-CT-PD examples ([#87](https://github.com/sypsyp97/diffct/pull/87)).
90
+ - Documentation search keeps the semantic toggle available, reports model cache
91
+ status accurately, eliminates layout shifts, resolves color schemes before
92
+ first paint and prefetches documentation pages
93
+ ([#85](https://github.com/sypsyp97/diffct/pull/85),
94
+ [#90](https://github.com/sypsyp97/diffct/pull/90),
95
+ [#91](https://github.com/sypsyp97/diffct/pull/91)).
96
+ - Documented `Projector.last_execution`, distributed mapped-solver I/O gating,
97
+ checkpoint cleanup and retry guarantees, and added TLA+ protocol models for
98
+ report ownership, mapped solver I/O and the search worker
99
+ ([#92](https://github.com/sypsyp97/diffct/pull/92)).
100
+
101
+ ## [2.5.2] - 2026-11-15
102
+
103
+ ### Added
104
+
105
+ - `beam="parallel3d"` runs on the native NVIDIA CUDA backend. `backend="numba"`
106
+ accepts it under the same conditions as cone, and `backend="auto"` selects
107
+ it on NVIDIA CUDA with `precision="fast"` and a views or space partition.
108
+ Values, data gradients and trajectory gradients match the portable backend;
109
+ detector surfaces, per-axis spacing, chunking, `*_into` streaming,
110
+ `native_volume_layout`, multiple devices and NCCL partitions are supported
111
+ ([#72](https://github.com/sypsyp97/diffct/pull/72)).
112
+
113
+ ### Fixed
114
+
115
+ - A numerical failure on one rank, such as a CUDA out-of-memory error during
116
+ a kernel launch, now raises on every rank of the same call, on the portable
117
+ and the native backend. The failing rank keeps its own exception; peers
118
+ raise a `RuntimeError` that names the failing rank. Before, peers could
119
+ return success or wait until the process-group timeout. The projector and
120
+ process group stay usable after the error. Distributed calls do one extra
121
+ small control reduction to agree on the outcome
122
+ ([#71](https://github.com/sypsyp97/diffct/pull/71)).
123
+ - Concurrent calls from several Python threads on one `Projector` no longer
124
+ fail with `TypeError` in statistics bookkeeping. `last_execution_stats` is
125
+ per thread: each thread reads the statistics of its own last call
126
+ ([#71](https://github.com/sypsyp97/diffct/pull/71)).
127
+ - Portable store errors no longer strand peer ranks in the next collective;
128
+ analytical weight/output byte overlap is rejected before numerical I/O for
129
+ every dtype; CGLS callback iterates are read-only, and a mutation raises
130
+ before more numerical work
131
+ ([#69](https://github.com/sypsyp97/diffct/pull/69)).
132
+
133
+ ### Documentation
134
+
135
+ - AMD GPUs: the execution guide states that ROCm runs the portable backend and
136
+ lists the tested AMD hardware and software versions.
137
+ - The execution guide describes how a failure on one rank is raised on every
138
+ rank, and the chunking guide states that `last_execution_stats` is per thread.
139
+ - The documentation search recovers from model download failures, offers a
140
+ retry, and falls back to the CPU when WebGPU fails
141
+ ([#70](https://github.com/sypsyp97/diffct/pull/70)).
142
+ - The execution guide describes the 2.5.1 checkpoint and seed behaviour
143
+ ([#68](https://github.com/sypsyp97/diffct/pull/68)).
144
+
8
145
  ## [2.5.1] - 2026-11-07
9
146
 
10
147
  ### Fixed
@@ -14,8 +14,8 @@ authors:
14
14
  given-names: Yipeng
15
15
  email: yipeng.sun@fau.de
16
16
  alias: sypsyp97
17
- version: 2.5.1
18
- date-released: "2026-11-07"
17
+ version: 2.5.3
18
+ date-released: "2026-12-02"
19
19
  license: Apache-2.0
20
20
  repository-code: "https://github.com/sypsyp97/diffct"
21
21
  url: "https://sypsyp97.github.io/diffct/"
diffct-2.5.3/PKG-INFO ADDED
@@ -0,0 +1,217 @@
1
+ Metadata-Version: 2.5
2
+ Name: diffct
3
+ Version: 2.5.3
4
+ Summary: Differentiable CT projection and reconstruction: precision modes, streaming, distributed execution and geometry gradients
5
+ Project-URL: Homepage, https://github.com/sypsyp97/diffct
6
+ Project-URL: Documentation, https://sypsyp97.github.io/diffct/
7
+ Project-URL: Changelog, https://github.com/sypsyp97/diffct/blob/main/CHANGELOG.md
8
+ Project-URL: Issues, https://github.com/sypsyp97/diffct/issues
9
+ Author-email: Yipeng Sun <yipeng.sun@fau.de>
10
+ License-Expression: Apache-2.0
11
+ License-File: LICENSE
12
+ License-File: NOTICE
13
+ Keywords: Apple Silicon,CT reconstruction,CUDA,MPS,PyTorch,ROCm,computed tomography,differentiable programming
14
+ Classifier: Development Status :: 5 - Production/Stable
15
+ Classifier: Environment :: GPU :: NVIDIA CUDA
16
+ Classifier: Intended Audience :: Science/Research
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Topic :: Scientific/Engineering :: Image Processing
20
+ Classifier: Topic :: Scientific/Engineering :: Medical Science Apps.
21
+ Requires-Python: >=3.10
22
+ Requires-Dist: numba
23
+ Requires-Dist: numba-cuda
24
+ Requires-Dist: numpy<2.5
25
+ Requires-Dist: torch
26
+ Provides-Extra: cu12
27
+ Requires-Dist: numba-cuda[cu12]; extra == 'cu12'
28
+ Provides-Extra: cu13
29
+ Requires-Dist: numba-cuda[cu13]; extra == 'cu13'
30
+ Provides-Extra: dicom
31
+ Requires-Dist: pydicom; extra == 'dicom'
32
+ Description-Content-Type: text/markdown
33
+
34
+ <h1 align="center">diffct</h1>
35
+
36
+ <p align="center">English · <a href="https://github.com/sypsyp97/diffct/blob/main/README.zh.md">简体中文</a></p>
37
+
38
+ <p align="center">
39
+ <strong>Differentiable CT operators for measured scanner geometry.</strong><br>
40
+ Project volumes, backproject measurements, reconstruct images and calibrate scanner geometry in PyTorch, from CPU experiments to multi-node CUDA execution.
41
+ </p>
42
+
43
+ <p align="center">
44
+ <a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg?style=flat-square" alt="License"></a>
45
+ <a href="https://doi.org/10.5281/zenodo.14999333"><img src="https://img.shields.io/badge/DOI-10.5281%2Fzenodo.14999333-blue.svg?style=flat-square" alt="DOI"></a>
46
+ <a href="https://pypi.org/project/diffct/"><img src="https://img.shields.io/pypi/v/diffct.svg?style=flat-square&logo=pypi&logoColor=white" alt="PyPI version"></a>
47
+ <a href="https://sypsyp97.github.io/diffct/"><img src="https://img.shields.io/github/actions/workflow/status/sypsyp97/diffct/docs.yml?branch=main&label=docs&style=flat-square" alt="Documentation"></a>
48
+ <a href="https://github.com/sypsyp97/diffct/actions"><img src="https://img.shields.io/github/actions/workflow/status/sypsyp97/diffct/ci.yml?branch=main&label=CI&style=flat-square" alt="CI/CD"></a>
49
+ <a href="https://deepwiki.com/sypsyp97/diffct"><img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/assets/deepwiki-badge.svg" alt="Ask DeepWiki"></a>
50
+ </p>
51
+
52
+ <p align="center">
53
+ <img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/assets/diffct_intro.gif" width="100%" alt="diffct intro: projection, sinogram, trajectories, multi-GPU split, reconstruction and geometry calibration">
54
+ </p>
55
+
56
+ <p align="center">
57
+ The video shows trajectories, autograd, geometry gradients, multi-GPU execution and reconstruction from measured walnut data · <a href="https://github.com/sypsyp97/diffct/blob/main/docs/assets/diffct_intro.mp4">MP4</a>.<br>
58
+ Walnut data: Meaney 2022, Zenodo 6986012, CC BY 4.0; see <a href="https://github.com/sypsyp97/diffct/blob/main/examples/data/NOTICE">examples/data/NOTICE</a>.
59
+ </p>
60
+
61
+ <p align="center">
62
+ <a href="#ct-operators">Operators</a> ·
63
+ <a href="#reconstruction-methods">Reconstruction</a> ·
64
+ <a href="#measured-helical-ct">Clinical CT</a> ·
65
+ <a href="#multi-gpu-scaling">Scaling</a> ·
66
+ <a href="#installation">Installation</a> ·
67
+ <strong><a href="https://sypsyp97.github.io/diffct/">Documentation</a></strong>
68
+ </p>
69
+
70
+ > **Version 2.x** uses per-view trajectories. Code written for 1.x needs [migration](https://sypsyp97.github.io/diffct/migration.html). This README tracks the source checkout. Features under [Unreleased](https://github.com/sypsyp97/diffct/blob/main/CHANGELOG.md#unreleased) require installation from source.
71
+
72
+ ## CT operators
73
+
74
+ diffct gives PyTorch a matched pair of CT projection operators. The trajectory tensors specify a ray direction or source position for each view, together with the detector centre and axes. Circular, helical, saddle, calibrated and measured clinical trajectories use the same tensor format.
75
+
76
+ To our knowledge, diffct is the only open-source GPU CT library with arbitrary per-view trajectories, autograd through the volume, first-order geometry gradients, and multi-node execution. We checked LEAP, TIGRE, ASTRA/tomosipo, DiffDRR and other libraries in October 2026.
77
+
78
+ - **Matched adjoint.** `project()` and `backproject()` implement the cell-constant Siddon model as an exact adjoint pair. `project()` supports gradients with respect to the input volume, and `backproject()` with respect to the input measurements. Both support Hessian-vector products.
79
+ - **Measured geometry.** Per-view source positions can include flying focal spot offsets. `ParameterizedSurface` describes cylindrical and other curved detectors without rebinning.
80
+ - **Reconstruction.** `cgls`, `sirt`, `tv_reconstruction`, differentiable FBP/FDK and gradient-based optimization share the same operators. Differentiable FBP/FDK can learn filters and weights. The projection operators can supply volume gradients for optimization.
81
+ - **Scale.** Automatic chunking, disk-backed state and distributed execution let diffct reconstruct scans that exceed one GPU's memory.
82
+
83
+ Technical report: [diffct: Differentiable CT Operators from Circular Orbits to Arbitrary Trajectories](https://doi.org/10.20944/preprints202605.1446.v2).
84
+
85
+ ## Reconstruction methods
86
+
87
+ The figure compares analytical and iterative reconstruction. The input is a noiseless 120-view fan-beam scan simulated from a clinical abdominal slice of Mayo liver case L213. The reference panel is the vendor image. The other panels show FBP and three iterative methods. SIRT uses 200 iterations, CGLS 30 iterations and TV-regularized reconstruction 300 iterations with weight 0.3.
88
+
89
+ <p align="center">
90
+ <picture>
91
+ <source srcset="docs/source/_static/gallery/readme_methods.png">
92
+ <img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/source/_static/gallery/readme_methods.png" width="100%" alt="Reference patient slice and FBP, SIRT, CGLS and TV reconstructions">
93
+ </picture>
94
+ </p>
95
+
96
+ <p align="center">
97
+ Patient image source: Mayo Clinic LDCT-and-Projection-data, liver case L213, CC BY 4.0.
98
+ </p>
99
+
100
+ ## Measured helical CT
101
+
102
+ diffct reconstructs the measured helical scan of liver case L213. The GE scan has 7,140 full-dose projection views on an 888 × 64 cylindrical detector. The rows show axial, coronal and sagittal sections. The columns compare the vendor image, Adam least-squares reconstruction, SIRT, CGLS and TV-regularized reconstruction. Adam and TV use 150 iterations, SIRT 100 iterations and CGLS 15 iterations. TV uses weight 3. The reconstruction grid uses 0.652 mm voxels in plane and 3 mm voxels along the scan axis.
103
+
104
+ <p align="center">
105
+ <picture>
106
+ <source srcset="docs/source/_static/gallery/readme_clinical.png">
107
+ <img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/source/_static/gallery/readme_clinical.png" width="100%" alt="Measured helical CT case L213: vendor reference, Adam, SIRT, CGLS and TV">
108
+ </picture>
109
+ </p>
110
+
111
+ Patient data: McCollough et al., *Low Dose CT Image and Projection Data (LDCT-and-Projection-data)*, Version 7, The Cancer Imaging Archive, 2020, [10.7937/9npb-2637](https://doi.org/10.7937/9npb-2637). Dataset paper: Moen et al., Medical Physics, 2020, [10.1002/mp.14594](https://doi.org/10.1002/mp.14594). Chest and Liver subsets: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/); see [docs/assets/gallery/NOTICE](https://github.com/sypsyp97/diffct/blob/main/docs/assets/gallery/NOTICE).
112
+
113
+ ## Multi-GPU scaling
114
+
115
+ The benchmark uses a 512³ FP32 volume, A100 64 GB GPUs, a circular cone beam, 360 views, a 1024 × 768 detector and pitch 1.25.
116
+
117
+ | 512³ volume | 1 GPU | 4 GPUs, 1 node | 8 GPUs, 2 nodes |
118
+ |---|---:|---:|---:|
119
+ | Forward projection | 566.79 ms | 150.76 ms (3.8×) | 81.58 ms (6.9×) |
120
+ | Adjoint (backprojection) | 1060.77 ms | 279.37 ms (3.8×) | 224.04 ms (4.7×) |
121
+ | CGLS iteration | 1753.73 ms | 468.09 ms (3.7×) | 337.39 ms (5.2×) |
122
+
123
+ The [performance guide](https://sypsyp97.github.io/diffct/performance.html) gives the methodology, chart and raw samples. For more reconstructions, see the [examples](https://sypsyp97.github.io/diffct/examples.html).
124
+
125
+ ## Installation
126
+
127
+ diffct needs Python 3.10 or newer. Install PyTorch for your device.
128
+
129
+ For native NVIDIA CUDA execution, check the CUDA version of the PyTorch build:
130
+
131
+ ```bash
132
+ python -c "import torch; print(torch.version.cuda)"
133
+ ```
134
+
135
+ When `torch.version.cuda` is 12.x, run:
136
+
137
+ ```bash
138
+ pip install "diffct[cu12]"
139
+ ```
140
+
141
+ When `torch.version.cuda` is 13.x, run:
142
+
143
+ ```bash
144
+ pip install "diffct[cu13]"
145
+ ```
146
+
147
+ For CPU, PyTorch ROCm or Apple Silicon, install diffct without an extra:
148
+
149
+ ```bash
150
+ pip install diffct
151
+ ```
152
+
153
+ Select `backend="torch"` for the portable backend. Apple Silicon uses the built-in MPS support. A community [MLX port by Linda-Sophie Schneider](https://github.com/Linda-SophieSchneider/DiffCT-MLX) also exists. CUDA compatibility notes and source installation: [installation guide](https://sypsyp97.github.io/diffct/installation.html).
154
+
155
+ ## Quickstart
156
+
157
+ Create one projector. Project the image and backproject the measurements. Then compute the loss gradient with respect to the image estimate:
158
+
159
+ ```python
160
+ import torch
161
+ from diffct import Projector, circular_trajectory_2d_parallel
162
+
163
+ trajectory = circular_trajectory_2d_parallel(180, device="cpu")
164
+ A = Projector(trajectory, (64, 64), 96, beam="parallel",
165
+ detector_spacing=1.0, voxel_spacing=1.0)
166
+
167
+ image = torch.zeros(A.volume_shape, device="cuda", dtype=torch.float32)
168
+ image[20:44, 20:44] = 1.0
169
+ measurements = A.project(image) # (180, 96)
170
+ adjoint = A.backproject(measurements) # (64, 64), not an inverse
171
+
172
+ estimate = torch.zeros_like(image, requires_grad=True)
173
+ loss = 0.5 * (A.project(estimate) - measurements).square().sum()
174
+ loss.backward()
175
+ print(measurements.shape, estimate.grad.shape)
176
+ ```
177
+
178
+ Expected output: `torch.Size([180, 96]) torch.Size([64, 64])`. CPU and Apple Silicon variants are in the [quickstart guide](https://sypsyp97.github.io/diffct/quickstart.html).
179
+
180
+ ## Documentation
181
+
182
+ [Quickstart](https://sypsyp97.github.io/diffct/quickstart.html) · [Trajectories and geometry](https://sypsyp97.github.io/diffct/trajectories.html) · [Clinical helical CT](https://sypsyp97.github.io/diffct/clinical_helical_example.html) · [Mayo public datasets](https://sypsyp97.github.io/diffct/mayo_datasets_example.html) · [Multi-GPU](https://sypsyp97.github.io/diffct/multi_gpu.html) · [API reference](https://sypsyp97.github.io/diffct/api.html) · [Examples](https://sypsyp97.github.io/diffct/examples.html)
183
+
184
+ ## Citation
185
+
186
+ If you use diffct in your research, cite both the software and the technical report. Machine-readable metadata is in [CITATION.cff](https://github.com/sypsyp97/diffct/blob/main/CITATION.cff).
187
+
188
+ <details open>
189
+ <summary>BibTeX</summary>
190
+
191
+ ```bibtex
192
+ @software{diffct2025,
193
+ author = {Yipeng Sun},
194
+ title = {diffct: Differentiable Computed Tomography Reconstruction with CUDA},
195
+ year = 2025,
196
+ publisher = {Zenodo},
197
+ doi = {10.5281/zenodo.14999333},
198
+ url = {https://doi.org/10.5281/zenodo.14999333}
199
+ }
200
+
201
+ @article{202605.1446,
202
+ doi = {10.20944/preprints202605.1446.v2},
203
+ url = {https://doi.org/10.20944/preprints202605.1446.v2},
204
+ year = 2026,
205
+ month = {Oct},
206
+ publisher = {Preprints},
207
+ author = {Yipeng Sun and Linda-Sophie Schneider and Chengze Ye and Andreas Maier},
208
+ title = {diffct: Differentiable CT Operators from Circular Orbits to Arbitrary Trajectories},
209
+ journal = {Preprints}
210
+ }
211
+ ```
212
+
213
+ </details>
214
+
215
+ ## License and acknowledgements
216
+
217
+ Apache 2.0, see [LICENSE](https://github.com/sypsyp97/diffct/blob/main/LICENSE). The project draws on [PYRO-NN](https://github.com/csyben/PYRO-NN) and [geometry_gradients_CT](https://github.com/mareikethies/geometry_gradients_CT). Issues and pull requests are welcome.
diffct-2.5.3/README.md ADDED
@@ -0,0 +1,184 @@
1
+ <h1 align="center">diffct</h1>
2
+
3
+ <p align="center">English · <a href="https://github.com/sypsyp97/diffct/blob/main/README.zh.md">简体中文</a></p>
4
+
5
+ <p align="center">
6
+ <strong>Differentiable CT operators for measured scanner geometry.</strong><br>
7
+ Project volumes, backproject measurements, reconstruct images and calibrate scanner geometry in PyTorch, from CPU experiments to multi-node CUDA execution.
8
+ </p>
9
+
10
+ <p align="center">
11
+ <a href="https://opensource.org/licenses/Apache-2.0"><img src="https://img.shields.io/badge/License-Apache_2.0-blue.svg?style=flat-square" alt="License"></a>
12
+ <a href="https://doi.org/10.5281/zenodo.14999333"><img src="https://img.shields.io/badge/DOI-10.5281%2Fzenodo.14999333-blue.svg?style=flat-square" alt="DOI"></a>
13
+ <a href="https://pypi.org/project/diffct/"><img src="https://img.shields.io/pypi/v/diffct.svg?style=flat-square&logo=pypi&logoColor=white" alt="PyPI version"></a>
14
+ <a href="https://sypsyp97.github.io/diffct/"><img src="https://img.shields.io/github/actions/workflow/status/sypsyp97/diffct/docs.yml?branch=main&label=docs&style=flat-square" alt="Documentation"></a>
15
+ <a href="https://github.com/sypsyp97/diffct/actions"><img src="https://img.shields.io/github/actions/workflow/status/sypsyp97/diffct/ci.yml?branch=main&label=CI&style=flat-square" alt="CI/CD"></a>
16
+ <a href="https://deepwiki.com/sypsyp97/diffct"><img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/assets/deepwiki-badge.svg" alt="Ask DeepWiki"></a>
17
+ </p>
18
+
19
+ <p align="center">
20
+ <img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/assets/diffct_intro.gif" width="100%" alt="diffct intro: projection, sinogram, trajectories, multi-GPU split, reconstruction and geometry calibration">
21
+ </p>
22
+
23
+ <p align="center">
24
+ The video shows trajectories, autograd, geometry gradients, multi-GPU execution and reconstruction from measured walnut data · <a href="https://github.com/sypsyp97/diffct/blob/main/docs/assets/diffct_intro.mp4">MP4</a>.<br>
25
+ Walnut data: Meaney 2022, Zenodo 6986012, CC BY 4.0; see <a href="https://github.com/sypsyp97/diffct/blob/main/examples/data/NOTICE">examples/data/NOTICE</a>.
26
+ </p>
27
+
28
+ <p align="center">
29
+ <a href="#ct-operators">Operators</a> ·
30
+ <a href="#reconstruction-methods">Reconstruction</a> ·
31
+ <a href="#measured-helical-ct">Clinical CT</a> ·
32
+ <a href="#multi-gpu-scaling">Scaling</a> ·
33
+ <a href="#installation">Installation</a> ·
34
+ <strong><a href="https://sypsyp97.github.io/diffct/">Documentation</a></strong>
35
+ </p>
36
+
37
+ > **Version 2.x** uses per-view trajectories. Code written for 1.x needs [migration](https://sypsyp97.github.io/diffct/migration.html). This README tracks the source checkout. Features under [Unreleased](https://github.com/sypsyp97/diffct/blob/main/CHANGELOG.md#unreleased) require installation from source.
38
+
39
+ ## CT operators
40
+
41
+ diffct gives PyTorch a matched pair of CT projection operators. The trajectory tensors specify a ray direction or source position for each view, together with the detector centre and axes. Circular, helical, saddle, calibrated and measured clinical trajectories use the same tensor format.
42
+
43
+ To our knowledge, diffct is the only open-source GPU CT library with arbitrary per-view trajectories, autograd through the volume, first-order geometry gradients, and multi-node execution. We checked LEAP, TIGRE, ASTRA/tomosipo, DiffDRR and other libraries in October 2026.
44
+
45
+ - **Matched adjoint.** `project()` and `backproject()` implement the cell-constant Siddon model as an exact adjoint pair. `project()` supports gradients with respect to the input volume, and `backproject()` with respect to the input measurements. Both support Hessian-vector products.
46
+ - **Measured geometry.** Per-view source positions can include flying focal spot offsets. `ParameterizedSurface` describes cylindrical and other curved detectors without rebinning.
47
+ - **Reconstruction.** `cgls`, `sirt`, `tv_reconstruction`, differentiable FBP/FDK and gradient-based optimization share the same operators. Differentiable FBP/FDK can learn filters and weights. The projection operators can supply volume gradients for optimization.
48
+ - **Scale.** Automatic chunking, disk-backed state and distributed execution let diffct reconstruct scans that exceed one GPU's memory.
49
+
50
+ Technical report: [diffct: Differentiable CT Operators from Circular Orbits to Arbitrary Trajectories](https://doi.org/10.20944/preprints202605.1446.v2).
51
+
52
+ ## Reconstruction methods
53
+
54
+ The figure compares analytical and iterative reconstruction. The input is a noiseless 120-view fan-beam scan simulated from a clinical abdominal slice of Mayo liver case L213. The reference panel is the vendor image. The other panels show FBP and three iterative methods. SIRT uses 200 iterations, CGLS 30 iterations and TV-regularized reconstruction 300 iterations with weight 0.3.
55
+
56
+ <p align="center">
57
+ <picture>
58
+ <source srcset="docs/source/_static/gallery/readme_methods.png">
59
+ <img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/source/_static/gallery/readme_methods.png" width="100%" alt="Reference patient slice and FBP, SIRT, CGLS and TV reconstructions">
60
+ </picture>
61
+ </p>
62
+
63
+ <p align="center">
64
+ Patient image source: Mayo Clinic LDCT-and-Projection-data, liver case L213, CC BY 4.0.
65
+ </p>
66
+
67
+ ## Measured helical CT
68
+
69
+ diffct reconstructs the measured helical scan of liver case L213. The GE scan has 7,140 full-dose projection views on an 888 × 64 cylindrical detector. The rows show axial, coronal and sagittal sections. The columns compare the vendor image, Adam least-squares reconstruction, SIRT, CGLS and TV-regularized reconstruction. Adam and TV use 150 iterations, SIRT 100 iterations and CGLS 15 iterations. TV uses weight 3. The reconstruction grid uses 0.652 mm voxels in plane and 3 mm voxels along the scan axis.
70
+
71
+ <p align="center">
72
+ <picture>
73
+ <source srcset="docs/source/_static/gallery/readme_clinical.png">
74
+ <img src="https://raw.githubusercontent.com/sypsyp97/diffct/main/docs/source/_static/gallery/readme_clinical.png" width="100%" alt="Measured helical CT case L213: vendor reference, Adam, SIRT, CGLS and TV">
75
+ </picture>
76
+ </p>
77
+
78
+ Patient data: McCollough et al., *Low Dose CT Image and Projection Data (LDCT-and-Projection-data)*, Version 7, The Cancer Imaging Archive, 2020, [10.7937/9npb-2637](https://doi.org/10.7937/9npb-2637). Dataset paper: Moen et al., Medical Physics, 2020, [10.1002/mp.14594](https://doi.org/10.1002/mp.14594). Chest and Liver subsets: [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/); see [docs/assets/gallery/NOTICE](https://github.com/sypsyp97/diffct/blob/main/docs/assets/gallery/NOTICE).
79
+
80
+ ## Multi-GPU scaling
81
+
82
+ The benchmark uses a 512³ FP32 volume, A100 64 GB GPUs, a circular cone beam, 360 views, a 1024 × 768 detector and pitch 1.25.
83
+
84
+ | 512³ volume | 1 GPU | 4 GPUs, 1 node | 8 GPUs, 2 nodes |
85
+ |---|---:|---:|---:|
86
+ | Forward projection | 566.79 ms | 150.76 ms (3.8×) | 81.58 ms (6.9×) |
87
+ | Adjoint (backprojection) | 1060.77 ms | 279.37 ms (3.8×) | 224.04 ms (4.7×) |
88
+ | CGLS iteration | 1753.73 ms | 468.09 ms (3.7×) | 337.39 ms (5.2×) |
89
+
90
+ The [performance guide](https://sypsyp97.github.io/diffct/performance.html) gives the methodology, chart and raw samples. For more reconstructions, see the [examples](https://sypsyp97.github.io/diffct/examples.html).
91
+
92
+ ## Installation
93
+
94
+ diffct needs Python 3.10 or newer. Install PyTorch for your device.
95
+
96
+ For native NVIDIA CUDA execution, check the CUDA version of the PyTorch build:
97
+
98
+ ```bash
99
+ python -c "import torch; print(torch.version.cuda)"
100
+ ```
101
+
102
+ When `torch.version.cuda` is 12.x, run:
103
+
104
+ ```bash
105
+ pip install "diffct[cu12]"
106
+ ```
107
+
108
+ When `torch.version.cuda` is 13.x, run:
109
+
110
+ ```bash
111
+ pip install "diffct[cu13]"
112
+ ```
113
+
114
+ For CPU, PyTorch ROCm or Apple Silicon, install diffct without an extra:
115
+
116
+ ```bash
117
+ pip install diffct
118
+ ```
119
+
120
+ Select `backend="torch"` for the portable backend. Apple Silicon uses the built-in MPS support. A community [MLX port by Linda-Sophie Schneider](https://github.com/Linda-SophieSchneider/DiffCT-MLX) also exists. CUDA compatibility notes and source installation: [installation guide](https://sypsyp97.github.io/diffct/installation.html).
121
+
122
+ ## Quickstart
123
+
124
+ Create one projector. Project the image and backproject the measurements. Then compute the loss gradient with respect to the image estimate:
125
+
126
+ ```python
127
+ import torch
128
+ from diffct import Projector, circular_trajectory_2d_parallel
129
+
130
+ trajectory = circular_trajectory_2d_parallel(180, device="cpu")
131
+ A = Projector(trajectory, (64, 64), 96, beam="parallel",
132
+ detector_spacing=1.0, voxel_spacing=1.0)
133
+
134
+ image = torch.zeros(A.volume_shape, device="cuda", dtype=torch.float32)
135
+ image[20:44, 20:44] = 1.0
136
+ measurements = A.project(image) # (180, 96)
137
+ adjoint = A.backproject(measurements) # (64, 64), not an inverse
138
+
139
+ estimate = torch.zeros_like(image, requires_grad=True)
140
+ loss = 0.5 * (A.project(estimate) - measurements).square().sum()
141
+ loss.backward()
142
+ print(measurements.shape, estimate.grad.shape)
143
+ ```
144
+
145
+ Expected output: `torch.Size([180, 96]) torch.Size([64, 64])`. CPU and Apple Silicon variants are in the [quickstart guide](https://sypsyp97.github.io/diffct/quickstart.html).
146
+
147
+ ## Documentation
148
+
149
+ [Quickstart](https://sypsyp97.github.io/diffct/quickstart.html) · [Trajectories and geometry](https://sypsyp97.github.io/diffct/trajectories.html) · [Clinical helical CT](https://sypsyp97.github.io/diffct/clinical_helical_example.html) · [Mayo public datasets](https://sypsyp97.github.io/diffct/mayo_datasets_example.html) · [Multi-GPU](https://sypsyp97.github.io/diffct/multi_gpu.html) · [API reference](https://sypsyp97.github.io/diffct/api.html) · [Examples](https://sypsyp97.github.io/diffct/examples.html)
150
+
151
+ ## Citation
152
+
153
+ If you use diffct in your research, cite both the software and the technical report. Machine-readable metadata is in [CITATION.cff](https://github.com/sypsyp97/diffct/blob/main/CITATION.cff).
154
+
155
+ <details open>
156
+ <summary>BibTeX</summary>
157
+
158
+ ```bibtex
159
+ @software{diffct2025,
160
+ author = {Yipeng Sun},
161
+ title = {diffct: Differentiable Computed Tomography Reconstruction with CUDA},
162
+ year = 2025,
163
+ publisher = {Zenodo},
164
+ doi = {10.5281/zenodo.14999333},
165
+ url = {https://doi.org/10.5281/zenodo.14999333}
166
+ }
167
+
168
+ @article{202605.1446,
169
+ doi = {10.20944/preprints202605.1446.v2},
170
+ url = {https://doi.org/10.20944/preprints202605.1446.v2},
171
+ year = 2026,
172
+ month = {Oct},
173
+ publisher = {Preprints},
174
+ author = {Yipeng Sun and Linda-Sophie Schneider and Chengze Ye and Andreas Maier},
175
+ title = {diffct: Differentiable CT Operators from Circular Orbits to Arbitrary Trajectories},
176
+ journal = {Preprints}
177
+ }
178
+ ```
179
+
180
+ </details>
181
+
182
+ ## License and acknowledgements
183
+
184
+ Apache 2.0, see [LICENSE](https://github.com/sypsyp97/diffct/blob/main/LICENSE). The project draws on [PYRO-NN](https://github.com/csyben/PYRO-NN) and [geometry_gradients_CT](https://github.com/mareikethies/geometry_gradients_CT). Issues and pull requests are welcome.
@@ -15,6 +15,11 @@ from .projectors import (
15
15
  )
16
16
 
17
17
  from .operators import Projector
18
+ from .clinical import (ClinicalScan, ClinicalScanProbe, ClinicalGeometry, read_dicom_ct_pd,
19
+ probe_dicom_ct_pd, clinical_geometry)
20
+ from .mayo import (CTImageSeries, Mayo2020Case, MayoChallenge2016Case, attenuation_to_hu,
21
+ hu_to_attenuation, discover_mayo_2020_cases, discover_mayo_challenge_2016_cases,
22
+ load_mayo_case, read_dicom_ct_images)
18
23
  from .storage import TensorStore, NpyStore
19
24
  from .surfaces import ParameterizedSurface
20
25
  from .reconstruction import (
@@ -64,10 +69,25 @@ try:
64
69
  except ImportError:
65
70
  pass
66
71
 
67
- __version__ = '2.5.1'
72
+ __version__ = '2.5.3'
68
73
 
69
74
  __all__ = [
70
75
  'Projector',
76
+ 'ClinicalScan',
77
+ 'ClinicalScanProbe',
78
+ 'ClinicalGeometry',
79
+ 'read_dicom_ct_pd',
80
+ 'probe_dicom_ct_pd',
81
+ 'clinical_geometry',
82
+ 'CTImageSeries',
83
+ 'Mayo2020Case',
84
+ 'MayoChallenge2016Case',
85
+ 'attenuation_to_hu',
86
+ 'hu_to_attenuation',
87
+ 'discover_mayo_2020_cases',
88
+ 'discover_mayo_challenge_2016_cases',
89
+ 'load_mayo_case',
90
+ 'read_dicom_ct_images',
71
91
  'TensorStore',
72
92
  'NpyStore',
73
93
  'ParameterizedSurface',