# SlicerRadiomics: the 3D Slicer interface to PyRadiomics. A scripted module # (Radiomics, under Informatics) computes radiomics features of segments or label # maps into a table; a Python CLI (SlicerRadiomicsCLI) runs the pyradiomics # command line on files. # # PURE-SCRIPTED: nothing to compile. Upstream's superbuild pip-installs pyradiomics # (146e3bd0) into the extension; here it is python3-pyradiomics. %global commit 063a9ded6e9a8a5af3f0dea209321e9e30237c0d %global shortcommit %(c=%{commit}; echo ${c:0:8}) %global snapdate 20260620 %global slicer_inst %{_prefix}/lib/slicer %global slicer_subdir Slicer-5.12 %global qtsm %{slicer_inst}/lib/%{slicer_subdir}/qt-scripted-modules %global climod %{slicer_inst}/lib/%{slicer_subdir}/cli-modules Name: 3dslicer-radiomics Version: 0 Release: 0.1.%{snapdate}git%{shortcommit}%{?dist} Summary: Radiomics feature extraction (PyRadiomics) for 3D Slicer License: BSD-3-Clause URL: https://github.com/AIM-Harvard/SlicerRadiomics Source0: %{url}/archive/%{commit}/SlicerRadiomics-%{shortcommit}.tar.gz # Read the label map with sitkUtils.PullVolumeFromSlicer (numpy-based, how Slicer 5.12's # own sitkUtils pulls volumes) instead of sitk.ReadImage on a "slicer:#" # address, which needs Slicer's MRMLIDImageIO ITK plugin: it is not built here # (lib/Slicer-5.12/ITKFactories does not exist), so every label-map extraction failed # with 'The file "slicer:0x...#vtkMRMLLabelMapVolumeNode1" does not exist.' Patch0: 3dslicer-radiomics-pull-volume.patch BuildArch: noarch Requires: 3dslicer Requires: python3-pyradiomics # Imported by the module (SlicerRadiomics.py). Requires: python3-pywt Requires: python3-six Requires: python3-dateutil Requires: python3-simpleitk Requires: python3-numpy %description SlicerRadiomics provides a 3D Slicer interface to PyRadiomics, an open-source Python package for extracting radiomics features from medical images: shape, first-order statistics and texture features, on the original image and on filtered images. Features of segments or label maps are written to a table. A command-line module runs PyRadiomics on image and mask files. %prep %autosetup -n SlicerRadiomics-%{commit} -p1 # The CLI's "#!/usr/bin/env python-real" (Slicer's superbuild interpreter) would make # rpm generate an unsatisfiable Requires: /usr/bin/python-real; Slicer runs Python CLIs # with the system interpreter here (see 3dslicer.spec). sed -i '1s|^#!/usr/bin/env python-real$|#!/usr/bin/python3|' SlicerRadiomicsCLI/SlicerRadiomicsCLI.py head -1 SlicerRadiomicsCLI/SlicerRadiomicsCLI.py | grep -qx '#!/usr/bin/python3' \ || { echo "ERROR: CLI shebang not rewritten" >&2; exit 1; } %build # Pure-scripted: nothing to compile. %install # The scripted module: exactly what SlicerRadiomics/CMakeLists.txt lists. _mod=SlicerRadiomics; _n=0 for _f in $(sed -n '/^set(MODULE_PYTHON_\(SCRIPTS\|RESOURCES\)$/,/^ )$/p' $_mod/CMakeLists.txt \ | grep -vE '^set\(|^ \)$' | sed -e 's/^ *//' -e "s/\${MODULE_NAME}/$_mod/g"); do test -f "$_mod/$_f" || { echo "ERROR: $_mod lists $_f, which is missing" >&2; exit 1; } install -Dpm0644 "$_mod/$_f" "%{buildroot}%{qtsm}/$_f" _n=$((_n + 1)) done test "$_n" -eq 2 || { echo "ERROR: installed $_n $_mod files, expected 2" >&2; exit 1; } # The CLI: script + XML descriptor into cli-modules (SlicerRadiomicsAddCLI's rules). install -Dpm0644 SlicerRadiomicsCLI/SlicerRadiomicsCLI.xml %{buildroot}%{climod}/SlicerRadiomicsCLI.xml install -Dpm0755 SlicerRadiomicsCLI/SlicerRadiomicsCLI.py %{buildroot}%{climod}/SlicerRadiomicsCLI.py %files %license LICENSE.txt %doc README.md USAGE.md %{qtsm}/SlicerRadiomics.py %{qtsm}/Resources/Icons/SlicerRadiomics.png %{climod}/SlicerRadiomicsCLI.py %{climod}/SlicerRadiomicsCLI.xml %changelog * Sat Oct 10 2026 Morgan Hough - 0-0.1.20260620git063a9ded - Initial package. SlicerRadiomics (module + Python CLI) on python3-pyradiomics. - Patch0: read label maps with sitkUtils.PullVolumeFromSlicer, not a slicer: address.