ToolsFor302
ToolsFor302 provides Python helpers for dose grid loading, plotting, and gamma analysis.
Installation
pip install ToolsFor302
Runtime dependencies are installed by default: numpy, matplotlib,
ipywidgets, SimpleITK, pymedphys, and pydicom.
Usage
ToolsFor302 0.3.4 uses DoseVolume as the common dose data container.
from ToolsFor302 import (
DoseVolume,
read_mhd_dose,
read_bin_dose,
read_dicom_dose,
calculate_gamma,
plot_slice,
plot_gamma_histogram,
)
Read dose files:
mhd_volume = read_mhd_dose("dose.mhd")
bin_volume = read_bin_dose(
"dose.bin",
dtype="float",
shape=(128, 256, 256),
spacing_mm=(2.5, 1.0, 1.0),
)
dicom_volume = read_dicom_dose("rt_dose.dcm")
Create a volume directly:
import numpy as np
volume = DoseVolume(
array=np.zeros((16, 64, 64)),
axes_mm=(
np.arange(16) * 2.5,
np.arange(64) * 1.0,
np.arange(64) * 1.0,
),
metadata={"source": "example"},
)
Calculate gamma:
result = calculate_gamma(
reference=mhd_volume,
evaluation=dicom_volume,
dose_percent_threshold=3,
distance_mm_threshold=3,
lower_percent_dose_cutoff=10,
)
print(result.pass_rate_percent)
Plot dose and gamma data:
slice_plot = plot_slice(mhd_volume, slice_index=20, show=True)
gamma_plot = plot_gamma_histogram(result, show=True)
slice_plot.fig.savefig("dose_slice.png")
Project structure
ToolsFor302_pypi/
├── ToolsFor302/ # Package source code
│ ├── __init__.py # Public API exports
│ ├── dlTools.py # Placeholder download/helper tools
│ └── doseTools.py # Dose volume, I/O, plotting, and gamma tools
├── tests/ # Public API and doseTools tests
├── dist/ # Built release artifacts
├── LICENSE
├── README.md
├── setup.py
└── .gitignore
API note
Version 0.3.4 is a breaking API cleanup. Old functions such as
load_mhd_dose, load_bin_dose, cal_gamma, and show_gamma are no longer
exported. Use read_mhd_dose, read_bin_dose, calculate_gamma, and the
plot_* functions instead.
Metadata
Release files for ToolsFor302 0.3.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| toolsfor302-0.3.4.tar.gz | 10.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| toolsfor302-0.3.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.6 kB
Release files / toolsfor302-0.3.4.tar.gz
| Download URL | toolsfor302-0.3.4.tar.gz |
|---|---|
| Size | 10.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
df3a8d75eba350d5a556bc743cd8e12b5d290ae0858aa09025e50e2ecc5c92a2
|
|
BLAKE2b-256 checksum How to use checksums |
b338b3cf95cebad10097475e289db517bf8ff34bcab570c999a5350739654ff7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|
Release files / toolsfor302-0.3.4-py3-none-any.whl
| Download URL | toolsfor302-0.3.4-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
211978c040eec85778482eb2703aea548975c560bb5e46941a22e5d67c1d900f
|
|
BLAKE2b-256 checksum How to use checksums |
d8344e3ad9a911ce9c9589bdbd0f6af9164926690ed500cf2ee37c5449367539
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.11.7
|