# spec2nii: conversion of in vivo MR spectroscopy data (Siemens, Philips, GE, Bruker, Varian, UIH, jMRUI, ...) to NIfTI-MRS (Will Clarke, Oxford). # FMRIB's installer ships it for FSL-MRS users; fsl_mrs itself never imports it (it only tells users to run it). Not in Fedora. %global pypi_name spec2nii Name: python-%{pypi_name} Version: 0.8.15 Release: 1%{?dist} Summary: Multi-format in vivo MR spectroscopy conversion to NIfTI License: BSD-3-Clause URL: https://github.com/wtclarke/spec2nii Source0: %{pypi_source %{pypi_name}} BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3-pytest BuildRequires: python3-h5py BuildRequires: python3-pillow %global _description %{expand: spec2nii converts MR spectroscopy (MRS) and spectroscopic imaging data from vendor formats to NIfTI-MRS, the standard container used by FSL-MRS and other tools: Siemens twix and DICOM, Philips SDAT/SPAR and DICOM, GE P-files, Bruker, Varian, UIH, jMRUI and LCModel formats.} %description %_description %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %_description %prep %autosetup -n %{pypi_name}-%{version} # upstream pins brukerapi >=0.2.5,<0.2.6; Fedora ships 0.2.6. Relax the upper bound only; tests/test_bruker.py decides whether 0.2.6 is good enough. grep -q '"brukerapi>=0.2.5,<0.2.6"' pyproject.toml sed -i 's/"brukerapi>=0.2.5,<0.2.6"/"brukerapi>=0.2.5"/' pyproject.toml # upstream also wants textual >=7.4,<9 (used only by bruker.py, for the interactive --inspect browser); Fedora has textual 4.0. The widgets bruker.py # imports exist in 4.0, so relax the lower bound; whether --inspect itself works on 4.0 is NOT covered by the test suite. grep -q '"textual>=7.4.0,<9"' pyproject.toml sed -i 's/"textual>=7.4.0,<9"/"textual>=4.0"/' pyproject.toml # upstream's package search excludes only tests*, so its documentation folder notes/ is installed into site-packages as a top-level package "notes" grep -q 'exclude = \["tests\*"\]' pyproject.toml sed -i 's/exclude = \["tests\*"\]/exclude = ["tests*", "notes*"]/' pyproject.toml %generate_buildrequires export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} %pyproject_buildrequires %build export SETUPTOOLS_SCM_PRETEND_VERSION=%{version} %pyproject_wheel %install %pyproject_install %pyproject_save_files %{pypi_name} %check %pyproject_check_import # Upstream keeps its test data (1.3 GB packed) in a separate repository (git.fmrib.ox.ac.uk/wclarke/spec2nii_test_data, a submodule the sdist omits), # and nearly every test reads it, so only these six run here (the others fail with FileNotFoundError on the missing data, not on the converters). # The data-backed suite was run once locally against the real data; see the changelog. %pytest -v \ tests/test_ge_pfile.py::test_mm_mega tests/test_ge_pfile.py::test_mm_press \ tests/test_other_func.py::test_insert_not_nmrs tests/test_other_func.py::test_remove_zero_higher_dim_indices \ tests/test_siemens_rda.py::test_csi_ve_against_dicom tests/test_siemens_rda.py::test_svs_ve_against_dicom %files -n python3-%{pypi_name} -f %{pyproject_files} %license LICENSE NOTICE %doc README.md CHANGELOG.md %{_bindir}/spec2nii %changelog * Fri Oct 09 2026 Morgan Hough - 0.8.15-1 - Initial package: spec2nii 0.8.15 (free project, BSD-3-Clause). Two dependency pins are relaxed because Fedora is behind: brukerapi <0.2.6 (Fedora has 0.2.6) and textual >=7.4 (Fedora has 4.0; used only by the interactive --inspect browser in bruker.py, which the tests do not exercise). The upstream suite, including tests/test_bruker.py, runs in %%check against them. - Validation against upstream's real test data (spec2nii_test_data, 3.4 GB packed, run once locally in a clean chroot with this package installed, not in the build): 92 of 105 tests pass. 12 fail only because they call `fsleyes render` (the orientation tests; FSLeyes was not installed in that chroot). 1 genuinely fails: tests/test_bruker.py::test_rawdata_pv_360_1_1 (ParaVision 360.1.1 raw data) raises brukerapi MissingProperty "numpy_dtype" under brukerapi 0.2.6, the version Fedora ships; upstream pins brukerapi <0.2.6 and that is the likely reason. Every other Bruker test passes, so other Bruker data is unaffected. %%check here runs only the six tests that need no data. - Also excludes upstream's stray top-level `notes` package (its docs folder, installed into site-packages by upstream's package search).