# ismrmrd (Python) -- the ISMRM Raw Data format in pure Python: acquisitions, # images, waveforms and the XML header, read from and written to ISMRMRD HDF5 # files and streams. # # WHY IT IS HERE: MITK task 16 (docs/mitk-tasks.md), reconstructing raw MRI # k-space into an image MITK can load (contrib/mitk/mri-recon/). The COPR # already has the C/C++ library, ismrmrd 1.15.0; this is its Python twin, a # separate upstream project (ismrmrd/ismrmrd-python) of the same version. # # Class 1 under docs/PACKAGING-POLICY.md: Fedora ships no package by this source # name and nothing provides python3dist(ismrmrd). Verified 2026-10-12 on f44 # and rawhide: # dnf repoquery --whatprovides 'python3dist(ismrmrd)' -> empty # # Licence: pyproject.toml says LicenseRef-IsmrmrdSoftwareLicense. The text is # MIT's grant, conditions and warranty disclaimer, plus an NIH public-domain # statement and a no-endorsement sentence. Fedora's own ismrmrd package (the C # library, same LICENSE text) tags it MIT, and so does this COPR's; this # package follows that precedent. %global pypi_name ismrmrd Name: python-%{pypi_name} Version: 1.15.0 Release: 1%{?dist} Summary: Python implementation of the ISMRM Raw Data format License: MIT URL: https://github.com/ismrmrd/ismrmrd-python Source0: %{pypi_source %{pypi_name}} BuildArch: noarch BuildRequires: python3-devel BuildRequires: python3dist(pytest) %global _description %{expand: The ISMRM Raw Data (ISMRMRD) format is a vendor-neutral format for raw magnetic resonance imaging data: k-space acquisitions with their trajectories and coil data, reconstructed images, physiological waveforms, and an XML header that describes the encoding (matrix, field of view, trajectory, acceleration). This package reads and writes ISMRMRD HDF5 files and serialised streams from Python, with NumPy arrays for the data.} %description %_description %package -n python3-%{pypi_name} Summary: %{summary} %description -n python3-%{pypi_name} %_description %prep %autosetup -p1 -n %{pypi_name}-%{version} # setup.py's generate_schema command is for maintainers (it needs xsdata[cli]); # the generated ismrmrd/xsd/ismrmrdschema/ is shipped in the sdist and used as is. %generate_buildrequires %pyproject_buildrequires %build %pyproject_wheel %install %pyproject_install %pyproject_save_files -l %{pypi_name} %check %pyproject_check_import # Upstream's suite, against the installed package (tests import test_common as a # sibling module, so run from tests/). cd tests %pytest -c /dev/null --rootdir=. . -p no:cacheprovider -q -rs cd .. # Round trip a header and one acquisition through an HDF5 file. %{py3_test_envvars} %{python3} -c ' import os, tempfile import numpy as np import ismrmrd, ismrmrd.xsd X = ismrmrd.xsd h = X.ismrmrdHeader(experimentalConditions=X.experimentalConditionsType( H1resonanceFrequency_Hz=127740000)) space = X.encodingSpaceType(matrixSize=X.matrixSizeType(x=64, y=48, z=1), fieldOfView_mm=X.fieldOfViewMm(x=256.0, y=192.0, z=5.0)) h.encoding.append(X.encodingType( encodedSpace=space, reconSpace=space, trajectory=X.trajectoryType.CARTESIAN, encodingLimits=X.encodingLimitsType( kspace_encoding_step_1=X.limitType(minimum=0, maximum=47, center=24)))) d = tempfile.mkdtemp() f = os.path.join(d, "t.h5") ds = ismrmrd.Dataset(f, "dataset", create_if_needed=True) ds.write_xml_header(X.ToXML(h, "utf-8")) a = ismrmrd.Acquisition.from_array(np.arange(4 * 64, dtype=np.complex64).reshape(4, 64)) a.idx.kspace_encode_step_1 = 7 ds.append_acquisition(a) ds.close() ds = ismrmrd.Dataset(f, "dataset", create_if_needed=False) h2 = X.CreateFromDocument(ds.read_xml_header()) assert h2.encoding[0].encodingLimits.kspace_encoding_step_1.center == 24 b = ds.read_acquisition(0) assert h2.encoding[0].encodedSpace.matrixSize.y == 48 assert h2.encoding[0].encodedSpace.fieldOfView_mm.x == 256.0 assert b.idx.kspace_encode_step_1 == 7 and b.data.shape == (4, 64) assert np.array_equal(b.data, a.data) print("round trip ok:", ds.number_of_acquisitions(), "acquisition") ' %files -n python3-%{pypi_name} -f %{pyproject_files} %doc README.md %changelog * Mon Oct 12 2026 Morgan Hough - 1.15.0-1 - Initial package, for MITK raw MRI reconstruction (MITK task 16).