All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog, and this project adheres to Semantic Versioning.
0.4.1 - 2026-06-16
- multiple corresponding units for given quantities in the GUI
- missing keys in init_beam not being skipped
- hotfix for deprecated numpy.matrix in to_namespace()
0.4.0 - 2026-05-17
pyRadPlan.ai_agentsmodule: LLM-powered treatment planning helpers built onpydantic-aigenerate_beam_angles(pln, treatment_site)— queries an LLM to suggest gantry and couch angles for a given treatment site and radiation mode, and writes them intopln.prop_stfgenerate_voi_objectives(pln, cst, treatment_site)— queries an LLM to propose optimization objectives for each VOI in aStructureSetand attaches validated objective instances directly to the VOIsAiSettings— pydantic-settings class for global configuration; reads the default model from thePYRADPLAN_AI_MODELenvironment variable (default:claude-sonnet-4-5); any provider supported by pydantic-ai can be selected via the model string- New example
examples/utils_ai_agents.pydemonstrating an end-to-end proton prostate plan with AI-generated beam angles and objectives - AGENTS.md and CLAUDE.md for AI-assisted development
- GPU-accelerated dose calculation via Array API using CuPy and PyTorch backends (alongside NumPy/
array_api_strict), including memory management, streaming, and per-beam cleanup to_namespace()helper to convert arrays (and scipy sparse matrices) between Array API namespaces, with explicitdevice=andkeep_sparse_compatoptionschoose_device()to select a sensible default device for a given namespace, with multi-GPU index support (gpu:N/cuda:N)- DLPack-based device handling (
get_device_info,is_on_gpu,DLPACK_CPU/DLPACK_CUDAconstants) for seamless backend interop - GPU lifecycle helpers:
free_gpu_memory(),create_stream(),get_current_stream(),synchronize(),record_event(),elapsed_time() from_numpy()/to_numpy()helpers with device targeting- Backend availability checks and a preferred-backend wishlist (
cupy_available,pytorch_gpu_available,jax_available,jax_gpu_available,numba_cuda_available,PREFERRED_GPU_ARRAY_BACKEND) - Native CUDA kernel implementation for geometric distance calculation:
_calc_geo_dists_cupy_kernel(CuPyElementwiseKernel),_calc_geo_dists_cupy_raw_kernel(CuPyRawKernel), and_calc_geo_dists_torch_kernel, replacing the previous Numba CUDA path - Array API conform N-D interpolation
interpnd()on rectilinear grids (generic 2D/3D fallback, with dedicatedRegularGridInterpolatorpaths for NumPy/SciPy, JAX, and CuPy) - Improved
interp1d: fast paths usingxp.interpfor NumPy/JAX/CuPy, JAXjitand PyTorchtorch.compilebackends (withtorch.jit.scriptfallback if Triton is not installed), support for lists/tuples/dicts of arrays with optional stacking - Array API compatibility for beam initialization and ray geometry computation (
get_gantry_rotation_matrix,get_couch_rotation_matrix) - More efficient sparse matrix conversion using direct CSR/CSC construction, avoiding unnecessary deep copies
- Kernel-data caching and
ParticlePencilBeamKernel.to_namespace()to move kernel arrays onto the active backend/device - Device propagation through fluence optimization (
NonLinearFluencePlanningProblem,OptimizerIpopt, scipy solver,SolverBase.device) - New example
examples/utils_backends.pydemonstrating how to query backends and run dose calculation on different array backends - Benchmarks
benchmark/benchmark_interp1d.pyandbenchmark/benchmark_interpnd.pyfor interpolation across backends - quantity resolver that checks for presence of quantities and instantiates the required ones
- biological RBE calculation from alpha and beta kernels
- biological based optimization
- alpha and beta parameters to dij with function
get_reference_lq_paramsto get them for a given ct and cst - quantity resolver that checks for presence of quantities and instantiates the required ones
- a TOPAS monte carlo interface. Implemented are protons and ions with basic physical and let based scoring. Material conversions are water and a pre defined schneider converter. The interface is structure into input files so that different beam models or scorers can be added easily. The interface also as template files that are used to create the simulation files. Which also give a nice overwiev on the structure of the simulation files.
- jinja2 as project dependency
- Documentation: extended user guide
- Documentation: extended installation instructions
- First implementation of an interactive result viewer widget (
guiextra) for visualizing dose/quantity distributions slice-by-slice with scroll/zoom, VOI contour overlay, isoline rendering, and colormap selection - DVH viewer and DVH comparison tools in the GUI analysis widget
- Quality indicator (QI) panel in the GUI analysis widget
visibleandvisible_colorfields onVOIfor storing per-structure display propertiesDEFAULT_VOI_COLORSpalette (per VOI type: TARGET, OAR, EXTERNAL, HELPER) exported frompyRadPlan.cstStructureSet.set_colors()method that auto-assigns colors from the predefined palette, skipping colors already in use, preserving any explicitly setvisible_colorvisible_colorfield validator onVOIaccepting named color strings, float 0–1 arrays, and int 0–255 tuples
- Pencil beam dose calculation now applies the lateral cutoff mask before computation rather than after, and keeps Dij assembly on the CPU (size limited) while the rest of the calculation runs on GPU
- Per-beam dose/LET/effect computation in
Dij.compute_beam_dose()now slices intensities by beam (faster matmul) instead of multiplying by a beam mask, and is fully Array API namespace aware - Siddon raytracer now picks up the engine's device and allocates plane/coordinate arrays directly on that device
- SVD photon pencil beam engine refactored to use Array API arrays for ray-position aggregation and kernel weighting (still calls SciPy interpolators on host arrays)
- resampling in BLD now uses interpolation to return mask on the grid provided by the dose engine
- in SVDPB field_grid is now built before the resampling of the beamlet mask to guarantee matching grids
_draw_contours()inplot_slicenow usesvoi.visible_colorinstead of a colormap cycle, so contour colors are consistent with the GUI viewer- GUI optional dependency changed from
PyQt5topyside6>=6.0.1andpyqtgraph>=0.12.0 - Proton pencil-beam example updated to use the new dose viewer widget
resample_imagenow falls back to linear interpolation when BSpline is requested but the image has fewer than 4 voxels in any dimension, preventing intermittent NaN values from the BSpline prefilter on small grids- CuPy issue in LPS coordinate handling (gantry/couch rotation matrices now built via
xp.stackwith the correct device/dtype) - SVD pencil beam engine updated to match changes in the base pencil beam engine
- Device handling and type checks in optimization solvers (IPOPT and SciPy) so the optimization runs on the same device as the quantities
- Preliminary workaround for CUDA / cuBLAS DLL conflicts when PyTorch and CuPy are imported in the same environment
free_gpu_memory()now skips NumPy/array_api_strictnamespaces silentlyBeam.validate_nparray_dtypehandles non-list array inputs viato_numpy()so non-NumPy arrays validate correctly on importto_namespace()raisesTypeErrorfor scalar / list / tuple inputs instead of failing on the sparse-array checkStructureSetnow callsset_colors()during validation so every VOI always has a color assigned- property .size raising an error in dij.py when torch is used. Switching to array_api_compat.size()
0.3.5 - 2026-05-12
- transmission mask in beam limiting devices now uses edge smoothing to account for finite grid size
- Bugfix in FRED MC engine, where temporary files were not deleted
0.3.4 - 2026-05-05
- dose engines now have private flags
_dij_guarantee_canonicaland_dij_guarantee_nonzeroto guarantee sparse dij structure before finalization - Issue and Pull/Merge Request templates
- default pre-commit hooks for line endings, case conflicts, merge conflicts, etc. Also added codespell, CITATION.cff verifyer and toml check
plot_slice()andplot_multiple_slices()now accept a genericimage_volume(CT, dict, orsitk.Image) instead of only aCTvia thectargumentplot_slice()gainedimage_windowandwindow_mode("minmax"or"centerwidth") options for grayscale windowing, replacing the previousct_windowoverlay_unitinplot_slice()now also accepts apint.Quantity- Jennifer Josephine Hardt added as author (CITATION.cff and pyproject.toml)
- Added an
extrapolateoption toresample_imageto choose the extrapolator. Default is to use a nearest neighbor extrapolator, but individual values can beprovided as well.
- New version of photons_Generic.mat basedata file can now be provided, allowing a "version" field alongside "meta" and "data" files within the machine struct. Version 2 requires correct kernel normalization (without implying a spacing in the convolution integral). photons_Generic.mat has been updated to version 2 with correct kernel normalization.
- Photon dose calculation now does not rely on hardcoded convolution resolution integral normalization of machine kernels. Assumes that old kernels use hardcoded factor of 4 for 0.5 mm resolution (1/0.5^2).
- Sparse structure now uses one shared index structure across dijs if possible
plot_slice()internally refactored into modular helpers (input validation, axis resolution, image/contour/overlay drawing, scale bar, finalization) for readability and reuse- Slice titles now follow the format
Slice ID = N at X mm(orSlice ID = Nwhen no image volume is provided) plot_slice()/plot_multiple_slices()parameterctrenamed toimage_volumeandct_windowrenamed toimage_window
ctandct_windowarguments toplot_slice()/plot_multiple_slices()still work as aliases forimage_volumeandimage_windowbut emit aDeprecationWarning
- CI Release Workflow now tests correctly on release commits without an Unreleased section in the Changelog.
- CI Release Workflow now fetches tags correctly and supplies the correct release body from the tag message
0.3.3 - 2026-04-14
- Automatic Release workflow on GitHub reading CHANGELOG.md and tag message
- Benchmark Folder with initial Raytracer benchmark that can be run with pytest-benchmark
- Changelog now follows thee Keep A Changelog conventions
- Fixed raytracer issue where certain geometrical configurations could lead to individual rays starting with invalid indices, inserting misplaced NaN's into the radiological depth cube.
0.3.2 - 2026-04-07
- Mimicking objective for dose-mimicking optimization (
SquaredMimicking) - Prototype for field-based dose calculation using Beam Limiting Device & FieldShape hierarchy
- CITATION.cff with authors and ORCIDs
- Raytracer candidate matrix now uses lateral cutoff by default (overridable)
- Fixed binary mask interpolation in VOI
- Fixed import of empty voxel index lists from matRad
- Fixed crash when optimization problem has no objectives
- Fixed export of
Nonevalues and type check indij/grids - Fixed missing x-divergence of ray in FRED MC engine
- Fixed single-field STF generator to properly inherit from IMRT generator
0.3.1 - 2026-01-28
- Performant and Array API compatible candidate ray matrix setup alternative for cube raytracing
- Convenience plotting function to display multiple slices (
plot_distributions)
numbais no longer a mandatory dependency
- Fix readthedocs YAML to correct Python version
- Small code quality fixes
0.3.0 - 2026-01-12
- Partial Array API compatibility with GPU support for CuPy and Torch (drops Python 3.9)
- FRED interface (Monte Carlo tool)
- VHEE planning with a generic (unfocused) beam and a focused beam
dij.compute_result_ct_grid()now returns quantities per beamcreate_body_segmentation()method for the CST object- Option to cancel solver at any iteration via keyboard input
- Comprehensive Sphinx documentation
- Various examples conforming to jupytext norm
- Increased memory efficiency in dose calculation
- Tuned initial Scipy solver parameters
- Refactored cst, ct, machine, and stf test data
- Added Python version matrix to CI tests
- Fixed overlap priorities when similar levels exist
- Fixed
np.floatingdeprecation - Fixed pydantic >= 2.11 compatibility
- Fixed issues with single bixel calculations in raytracer
- Elevated minimum required version of numpydantic
0.2.8 - 2025-06-28
DVHCollectionandDVHfor plan analysis- Maps to associate bixel/beamlet indices with beams/rays in stf
- Performance improvements for raytracer and dij filling
- Ray tracer recovery in case of numerical issues
- CT validates given x/y/z vectors correctly
- Fixed validation of VOIs with single voxels imported from matRad
0.2.7 - 2025-06-27
0.2.6 - 2025-06-26
0.2.5 - 2025-06-20
0.2.4 - 2025-05-22
0.2.3 - 2025-05-09
- Slice visualization function
- LET calculation for protons
- Scenarios are now pydantic models
- Docstring and code quality improvements
- Performance fix for raytracer
- Fixed issues with ray validation
- Various validation fixes
0.2.2 - 2025-02-27
- matRad-compatible data structures with stable validation and serialization using pydantic
- Native reimplementation of matRad's pencil beam dose calculation for photons, protons & ions
- Generic machine data
- Native optimization framework using scipy or IPOPT (via ipyopt)