# brainweb-dl -- download and cache BrainWeb simulated brain MRI (the McGill/MNI # BrainWeb database: 1 normal + 20 anatomical models, fuzzy and crisp tissue # segmentations, simulated T1/T2/PD/T2* contrasts) as NumPy arrays or NIfTI. # Pure Python. # # WHY IT IS HERE: deepinv.datasets.BrainWebMRI loads its phantoms through # brainweb_dl.get_mri. BrainWeb is also a common ground-truth phantom for # segmentation and reconstruction tests elsewhere in this Copr. # # Class 1 under docs/PACKAGING-POLICY.md: Fedora ships no package by this source # name and nothing provides python3dist(brainweb-dl). Verified 2026-10-12: # dnf repoquery --whatprovides 'python3dist(brainweb-dl)' -> empty # # Data: nothing is packaged. The tool downloads from brainweb.bic.mni.mcgill.ca # when the user calls it, into ~/.cache/brainweb (or BRAINWEB_DIR). The two # tissue tables in brainweb_dl/data/ are the tool's own parameter lists (T1, T2, # T2*, PD per tissue class), part of the MIT-licensed source. %global pypi_name brainweb-dl %global import_name brainweb_dl Name: python-%{pypi_name} Version: 0.4.6 Release: 1%{?dist} Summary: Download and cache the BrainWeb simulated brain MRI database License: MIT URL: https://github.com/paquiteau/brainweb-dl Source0: %{pypi_source brainweb_dl} BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3dist(pytest) %global _description %{expand: brainweb-dl downloads volumes from the BrainWeb simulated brain database (McGill University, Montreal Neurological Institute) and caches them locally: the original normal brain and the twenty anatomical models, with fuzzy or crisp tissue segmentations and simulated T1, T2, PD and T2* images at chosen noise, RF inhomogeneity and resolution. Volumes come back as NumPy arrays or are saved as NIfTI. A brainweb-dl command does the same from the shell.} %description %_description %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %_description %prep %autosetup -p1 -n brainweb_dl-%{version} %generate_buildrequires # Core requirements only: the "test" extra adds pytest-black, pytest-cov and # pytest-sugar for upstream CI. %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files -l %{import_name} %check %pyproject_check_import # Every other upstream test downloads from brainweb.bic.mni.mcgill.ca. The three # test_get_mri1_unavailable cases check argument validation before any request # is made, so they run offline. %pytest -c /dev/null --rootdir=. tests -p no:cacheprovider -q -rs \ -k test_get_mri1_unavailable # The bundled tissue tables load, and the CLI starts. %{py3_test_envvars} %{python3} -c ' from importlib.resources import files from brainweb_dl._brainweb import _load_tissue_map for name, n in (("brainweb1_tissues.csv", 10), ("brainweb20_tissues.csv", 12)): rows = _load_tissue_map(files("brainweb_dl") / "data" / name) assert len(rows) == n, (name, len(rows)) assert {"ID", "Label", "T1 (ms)", "T2 (ms)", "T2s (ms)"} <= set(rows[0]), rows[0] csf = next(r for r in rows if r["ID"] == "csf") assert int(csf["T1 (ms)"]) > 2000, csf print(name, len(rows), "tissue classes") ' %{py3_test_envvars} %{buildroot}%{_bindir}/brainweb-dl --help >/dev/null %files -n python3-%{pypi_name} -f %{pyproject_files} %doc README.md %{_bindir}/brainweb-dl %changelog * Mon Oct 12 2026 Morgan Hough - 0.4.6-1 - Initial package: phantom loader for deepinv.datasets.BrainWebMRI.