Name: python-totalsegmentator Version: 2.18.0 Release: 2%{?dist} Summary: Robust segmentation of anatomical structures in CT and MR images License: Apache-2.0 URL: https://github.com/wasserth/TotalSegmentator Source0: %{pypi_source totalsegmentator} BuildArch: noarch BuildRequires: python3-devel BuildRequires: pyproject-rpm-macros # TELEMETRY: left as upstream ships it (opt-out). Decision recorded 2026-10-05. # TotalSegmentator posts a usage record to stats.totalsegmentator.com on every # prediction unless "send_usage_stats" is false in ~/.totalsegmentator/config.json, # which setup_totalseg() creates as TRUE on first use. The record includes the # licence number. The decision (Morgan) was to leave the default as the author # made it and document it, in %%description below, rather than carry a patch. # Considered and not done: changing the default in config.py setup_totalseg(). # Context if this is revisited: the Fedora Packaging Committee ticket on exactly # this question (pagure.io/packaging-committee/issue/991) was closed "nothingtodo" # on 2020-12-17 with "FESCo or the Council would need to make distro policy here"; # no written rule was found, the community norm in that thread is opt-in, and the # guideline text itself could not be read. The project is essentially one # developer's (Jakob Wasserthal, University Hospital Basel), who also runs the # statistics server and the licence service, so an upstream request is possible. # Revisit if a Fedora policy appears or upstream changes the default. %global _description %{expand: TotalSegmentator segments anatomical structures in CT and MR images using nnU-Net. It provides the TotalSegmentator command line tool, a Python API (totalsegmentator.python_api), and a set of totalseg_* helper tools for combining masks, computing statistics and generating spine, aorta and pulmonary reports. This package ships the CODE only. Two things follow from that and users should know about them before running it: * No model weights are included. Upstream does not ship them in the sdist; the first run of any task downloads that task's weights over the network from GitHub releases (and, for licensed tasks, from a vendor backend) into ~/.totalsegmentator. The tool therefore contacts the internet on first use and cannot segment anything offline until weights have been fetched. Use totalseg_download_weights, or TOTALSEG_WEIGHTS_PATH to point at a pre-populated directory, if that matters for your site. * Usage statistics are sent by default, exactly as upstream ships it; this package does not change that. On first run a config file is written to ~/.totalsegmentator/config.json (or under TOTALSEG_HOME_DIR) with "send_usage_stats": true. After that, every prediction POSTs a record to https://stats.totalsegmentator.com containing: a random installation id that persists across runs, a running count of your predictions, the task and options used (fast, preview, multilabel, ROI subset, statistics, radiomics), your operating system and machine type, the TotalSegmentator and Python versions, whether CUDA is available, and the licence number if you have set one for a restricted task. Reading the code (config.py, send_usage_stats), no image data is sent, and a failed request is ignored silently. It also happens when other software calls TotalSegmentator through its Python API. Set "send_usage_stats" to false in the config file to turn it off. The code is Apache-2.0, which is what this package is licensed under. The downloaded weights are not all under the same terms: several tasks require a (free for non-commercial use) licence key, and the brain_aneurysm task's weights are CC BY-NC 4.0 with no commercial licence available. Selecting those tasks fetches material that is not free software, and that material is not part of this RPM.} %description %{_description} %package -n python3-totalsegmentator Summary: %{summary} # The totalseg_mcp entry point lives in the totalsegmentator_mcp package and # needs upstream's "mcp" extra. mcp and uvicorn are in Fedora, so recommend # them rather than hard-requiring them: everything else in the package works # without them. The third member of that extra, xgboost, is not packaged for # Fedora, so totalseg_get_phase and totalseg_get_modality will not run. Recommends: python3-mcp Recommends: python3-uvicorn %description -n python3-totalsegmentator %{_description} %prep %autosetup -n totalsegmentator-%{version} %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files totalsegmentator totalsegmentator_mcp %check # NOTE ON MACRO ARGUMENTS: RPM parses a macro's arguments from a single # physical line. Backslash line continuations here are consumed by the shell # *after* macro expansion, so the -e flags are silently dropped and every # module gets imported. Keep this on one line. # # Excluded modules, each for a concrete reason: # # totalsegmentator.download_pretrained_weights # Upstream ships this as a package module but wrote it as a standalone # script: it does "from libs import ..." and "from config import ...", # implicit relative imports that stopped working in Python 3. It is # unimportable as installed on any platform; the supported entry point # for the same job is totalseg_download_weights. # totalsegmentator.registration # totalsegmentator.bin.totalseg_evans_index (imports the above) # Import "ants" (antspyx) at module level. antspyx is an undeclared # dependency upstream -- it is not in install_requires, there is only a # "# pip install antspyx" comment next to the import -- and it is not # packaged for Fedora. The Evans index tool is unusable without it. # totalsegmentator.bin.totalseg_get_phase # totalsegmentator.bin.totalseg_get_modality # Import xgboost at module level. xgboost is in upstream's "mcp" extra, # not in install_requires, and is not packaged for Fedora. # totalsegmentator_mcp.* # Imports mcp and uvicorn, upstream's "mcp" extra; Recommends above # rather than pulled into the buildroot. # # Deliberately NOT excluded: totalsegmentator.nnunet, # totalsegmentator.nnunet_runtime_patches and totalsegmentator.custom_trainers. # Those are the core inference path. They import nnunetv2, which imports # SimpleITK. As of 2026-09-29 python3-simpleitk-2.5.5-10.fc45 in the COPR is # ABI-broken against InsightToolkit5-5.4.7-19.fc45 and raises # ImportError: /lib64/libSimpleITKRegistration-2.5.so.1: undefined symbol: # _ZN3itk35ObjectToObjectOptimizerBaseTemplateIdE18SetNumberOfThreadsEj # so this %%check fails. That is a real, user-visible defect -- segmentation # cannot run -- and masking it with another -e would ship a package that # installs and then does nothing. Rebuild python3-simpleitk against the # current InsightToolkit5 and this check passes with no spec change. %pyproject_check_import -e totalsegmentator.download_pretrained_weights -e totalsegmentator.registration -e totalsegmentator.bin.totalseg_evans_index -e totalsegmentator.bin.totalseg_get_phase -e totalsegmentator.bin.totalseg_get_modality -e 'totalsegmentator_mcp*' %files -n python3-totalsegmentator -f %{pyproject_files} %license LICENSE %doc README.md CHANGELOG.md # The console scripts are listed explicitly: %%pyproject_save_files does not # pick up %%{_bindir} entry points here, and without these the build fails on # installed-but-unpackaged files. Listing them also makes it obvious when # upstream adds or renames a tool. %{_bindir}/TotalSegmentator %{_bindir}/crop_to_body %{_bindir}/totalseg_aorta_report %{_bindir}/totalseg_combine_masks %{_bindir}/totalseg_download_weights %{_bindir}/totalseg_evans_index %{_bindir}/totalseg_get_body_stats %{_bindir}/totalseg_get_modality %{_bindir}/totalseg_get_phase %{_bindir}/totalseg_import_weights %{_bindir}/totalseg_info %{_bindir}/totalseg_mcp %{_bindir}/totalseg_pulmonary_report %{_bindir}/totalseg_set_license %{_bindir}/totalseg_setup_manually %{_bindir}/totalseg_spine_report %changelog * Mon Oct 05 2026 Morgan Hough - 2.18.0-2 - Documentation only; no code or behaviour change. The usage-statistics note in %%description said the record holds "a random installation id, the task name and platform details". Read from config.py send_usage_stats it also holds a running prediction count, the option flags, the Python version, CUDA availability and the LICENCE NUMBER; the note now says so, and says it also applies when other software calls the Python API. The decision to leave telemetry as upstream ships it, and the reasons, are recorded in a comment above %%description. * Tue Sep 29 2026 Morgan Hough - 2.18.0-1 - Initial package: totalsegmentator 2.18.0. - Packaged because it is the segmentation backend several of our imaging pipelines call out to, and because all 23 of its runtime dependencies (torch, nnunetv2, SimpleITK, nibabel, dipy, fury, dicom2nifti and the rest) are already built for f45, so this is the last missing piece rather than the start of a dependency chain. - Ships code only, no model weights. Upstream keeps weights out of the sdist and downloads them from GitHub releases on first run, so the RPM installs a tool that reaches the network before it can do any work. Called out in the description so nobody is surprised by it on an air-gapped host. - Also called out in the description: usage statistics are on by default and POST to stats.totalsegmentator.com on every prediction, disabled by setting send_usage_stats to false in ~/.totalsegmentator/config.json. - Licensing: the code we package is Apache-2.0 and the LICENSE file is the full text, so the RPM is unambiguously free. The downloaded weights are a separate matter and are not all free: the brain_aneurysm task's weights are CC BY-NC 4.0 with no commercial licence offered, and several other tasks need a vendor licence key. None of that material is in the RPM, but a user who picks those tasks will pull it down, so the description says so. - BLOCKER, external to this spec: %%check currently fails. The core modules totalsegmentator.nnunet, nnunet_runtime_patches and custom_trainers import nnunetv2, which imports SimpleITK, and python3-simpleitk-2.5.5-10.fc45 in the COPR is ABI-broken against InsightToolkit5-5.4.7-19.fc45 (undefined symbol itk::ObjectToObjectOptimizerBaseTemplate::SetNumberOfThreads). InsightToolkit5 was rebuilt after SimpleITK was; SimpleITK needs a rebuild. Not worked around here on purpose: excluding those modules would produce a package that installs and cannot segment anything. - %%check excludes five modules that cannot import in a Fedora buildroot: download_pretrained_weights (upstream left Python 2 style implicit relative imports in it), registration and totalseg_evans_index (need the undeclared, unpackaged antspyx), and totalseg_get_phase / totalseg_get_modality (need xgboost, which is in upstream's "mcp" extra and is not packaged). The totalsegmentator_mcp package is excluded too and its mcp and uvicorn dependencies are Recommends, since those two are in Fedora.