1
0

4 Commits

Author SHA256 Message Date
2848039a17 Accepting request 1296683 from devel:languages:python:numeric
- Add patch ignore-userwarnings.patch:
  * Ignore any UserWarnings that arise, rather than to trying to swallow
    them with pytest.warns().

OBS-URL: https://build.opensuse.org/request/show/1296683
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-nibabel?expand=0&rev=15
2025-07-31 15:46:56 +00:00
2ed7f3d336 - Add patch ignore-userwarnings.patch:
* Ignore any UserWarnings that arise, rather than to trying to swallow
    them with pytest.warns().

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-nibabel?expand=0&rev=30
2025-07-31 02:59:59 +00:00
5d26cf4b61 Accepting request 1226405 from devel:languages:python:numeric
- Update to 5.3.2:
  * New features
    + Update NIfTI extension protocol to include .content : bytes, .text :
      str and .json : dict properties for accessing extension contents.
  * Enhancements
    + Ability to read data from many multiframe DICOM files that previously
      generated errors
    + nib-nifti-dx now supports NIfTI-2 files with a --nifti2 flag
    + Update nibabel.streamlines.tractogram to support ragged arrays.
    + Improve error message for for dicomwrapper errors in shape
      calculation
    + Support "flat" ASCII-encoded GIFTI DataArrays
  * Bug fixes
    + Fix location initialization/update in OrthoSlicer3D for permuted axes
    + Fix DICOM scaling, making frame filtering explicit
    + Fixed multiframe DICOM issue where data could be flipped along slice
      dimension relative to the affine
    + Fixed multiframe DICOM issue where image_position and the translation
      component in the affine could be incorrect
  * Maintenance
    + Numpy 2.0 compatibility and addressing deprecations in numpy API
    + Python 3.13 compatibility
    + Testing on Python 3.13 with free-threading
    + Proactively address deprecations in coming Python versions
    + Replace nose-era setup() and teardown() functions with pytest
      equivalents
  * API changes and deprecations
    + Raise HeaderDataError from set_qform if the affine fails to
      decompose. This would previously result in numpy.linalgLinAlgError.
    + The nibabel.onetime.auto_attr module can be replaced by

OBS-URL: https://build.opensuse.org/request/show/1226405
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-nibabel?expand=0&rev=14
2024-11-26 19:55:59 +00:00
764bd6c788 - Update to 5.3.2:
* New features
    + Update NIfTI extension protocol to include .content : bytes, .text :
      str and .json : dict properties for accessing extension contents.
  * Enhancements
    + Ability to read data from many multiframe DICOM files that previously
      generated errors
    + nib-nifti-dx now supports NIfTI-2 files with a --nifti2 flag
    + Update nibabel.streamlines.tractogram to support ragged arrays.
    + Improve error message for for dicomwrapper errors in shape
      calculation
    + Support "flat" ASCII-encoded GIFTI DataArrays
  * Bug fixes
    + Fix location initialization/update in OrthoSlicer3D for permuted axes
    + Fix DICOM scaling, making frame filtering explicit
    + Fixed multiframe DICOM issue where data could be flipped along slice
      dimension relative to the affine
    + Fixed multiframe DICOM issue where image_position and the translation
      component in the affine could be incorrect
  * Maintenance
    + Numpy 2.0 compatibility and addressing deprecations in numpy API
    + Python 3.13 compatibility
    + Testing on Python 3.13 with free-threading
    + Proactively address deprecations in coming Python versions
    + Replace nose-era setup() and teardown() functions with pytest
      equivalents
  * API changes and deprecations
    + Raise HeaderDataError from set_qform if the affine fails to
      decompose. This would previously result in numpy.linalgLinAlgError.
    + The nibabel.onetime.auto_attr module can be replaced by

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:numeric/python-nibabel?expand=0&rev=28
2024-11-26 05:23:34 +00:00
7 changed files with 103 additions and 108 deletions

41
ignore-userwarnings.patch Normal file
View File

@@ -0,0 +1,41 @@
From 3f40a3bc0c4bd996734576a15785ad0f769a963a Mon Sep 17 00:00:00 2001
From: "Christopher J. Markiewicz" <markiewicz@stanford.edu>
Date: Fri, 16 May 2025 14:25:24 -0400
Subject: [PATCH 2/2] fix: Ignore warning that may not be emitted
---
nibabel/tests/test_processing.py | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/nibabel/tests/test_processing.py b/nibabel/tests/test_processing.py
index f1a4f0a90..7e2cc4b16 100644
--- a/nibabel/tests/test_processing.py
+++ b/nibabel/tests/test_processing.py
@@ -9,6 +9,7 @@
"""Testing processing module"""
import logging
+import warnings
from os.path import dirname
from os.path import join as pjoin
@@ -169,7 +170,8 @@ def test_resample_from_to(caplog):
exp_out[1:, :, :] = data[1, :, :]
assert_almost_equal(out.dataobj, exp_out)
out = resample_from_to(img, trans_p_25_img)
- with pytest.warns(UserWarning): # Suppress scipy warning
+ with warnings.catch_warnings():
+ warnings.simplefilter('ignore', UserWarning)
exp_out = spnd.affine_transform(data, [1, 1, 1], [-0.25, 0, 0], order=3)
assert_almost_equal(out.dataobj, exp_out)
# Test cval
@@ -275,7 +277,8 @@ def test_resample_to_output(caplog):
assert_array_equal(out_img.dataobj, np.flipud(data))
# Subsample voxels
out_img = resample_to_output(Nifti1Image(data, np.diag([4, 5, 6, 1])))
- with pytest.warns(UserWarning): # Suppress scipy warning
+ with warnings.catch_warnings():
+ warnings.simplefilter('ignore', UserWarning)
exp_out = spnd.affine_transform(data, [1 / 4, 1 / 5, 1 / 6], output_shape=(5, 11, 19))
assert_array_equal(out_img.dataobj, exp_out)
# Unsubsample with voxel sizes

View File

@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b6c80b2e728e4bc2b65f1142d9b8d2287a9102a8bf8477e115ef0d8334559975
size 4503320

3
nibabel-5.3.2.tar.gz Normal file
View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0bdca6503b1c784b446c745a4542367de7756cfba0d72143b91f9ffb78be569b
size 4504842

View File

@@ -1,3 +1,50 @@
-------------------------------------------------------------------
Thu Jul 31 02:59:03 UTC 2025 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch ignore-userwarnings.patch:
* Ignore any UserWarnings that arise, rather than to trying to swallow
them with pytest.warns().
-------------------------------------------------------------------
Tue Nov 26 05:22:53 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Update to 5.3.2:
* New features
+ Update NIfTI extension protocol to include .content : bytes, .text :
str and .json : dict properties for accessing extension contents.
* Enhancements
+ Ability to read data from many multiframe DICOM files that previously
generated errors
+ nib-nifti-dx now supports NIfTI-2 files with a --nifti2 flag
+ Update nibabel.streamlines.tractogram to support ragged arrays.
+ Improve error message for for dicomwrapper errors in shape
calculation
+ Support "flat" ASCII-encoded GIFTI DataArrays
* Bug fixes
+ Fix location initialization/update in OrthoSlicer3D for permuted axes
+ Fix DICOM scaling, making frame filtering explicit
+ Fixed multiframe DICOM issue where data could be flipped along slice
dimension relative to the affine
+ Fixed multiframe DICOM issue where image_position and the translation
component in the affine could be incorrect
* Maintenance
+ Numpy 2.0 compatibility and addressing deprecations in numpy API
+ Python 3.13 compatibility
+ Testing on Python 3.13 with free-threading
+ Proactively address deprecations in coming Python versions
+ Replace nose-era setup() and teardown() functions with pytest
equivalents
* API changes and deprecations
+ Raise HeaderDataError from set_qform if the affine fails to
decompose. This would previously result in numpy.linalgLinAlgError.
+ The nibabel.onetime.auto_attr module can be replaced by
functoolscached_property in all supported versions of Python. This
alias may be removed in future versions.
+ Removed the deprecated nisext (setuptools extensions) package.
- Dropped patches, included upstream:
* support-pytest-8.patch
* support-numpy-2.patch
-------------------------------------------------------------------
Thu Jul 25 02:05:50 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-nibabel
#
# Copyright (c) 2024 SUSE LLC
# Copyright (c) 2025 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -18,17 +18,15 @@
%define binaries nib-conform nib-convert nib-dicomfs nib-diff nib-ls nib-nifti-dx nib-roi nib-stats nib-tck2trk nib-trk2tck parrec2nii
Name: python-nibabel
Version: 5.2.1
Version: 5.3.2
Release: 0
Summary: Tool to access multiple neuroimaging data formats
License: MIT
URL: https://nipy.org/nibabel
# SourceRepository: https://github.com/nipy/nibabel
Source: https://files.pythonhosted.org/packages/source/n/nibabel/nibabel-%{version}.tar.gz
# PATCH-FIX-UPSTREAM gh#nipy/nibabel#1325
Patch0: support-pytest-8.patch
# PATCH-FIX-UPSTREAM gh#nipy/nibabel#1304
Patch1: support-numpy-2.patch
# PATCH-FIX-UPSTREAM One commit of gh#nipy/nibabel#1416
Patch0: ignore-userwarnings.patch
BuildRequires: %{python_module base >= 3.8}
BuildRequires: %{python_module hatch-vcs}
BuildRequires: %{python_module hatchling}
@@ -37,7 +35,12 @@ BuildRequires: fdupes
BuildRequires: python-rpm-macros
Requires: python-numpy >= 1.20
Requires: python-packaging => 17
Requires: (python-importlib-resources >= 1.3 if python-base < 3.9)
%if 0%{?python_version_nodots} < 312
Requires: python-importlib-resources >= 5.12
%endif
%if 0%{?python_version_nodots} < 313
Requires: python-typing-extensions >= 4.6
%endif
Requires(post): update-alternatives
Requires(postun): update-alternatives
Recommends: python-Pillow
@@ -48,7 +51,7 @@ BuildArch: noarch
# SECTION test requirements
BuildRequires: %{python_module Pillow}
BuildRequires: %{python_module h5py}
BuildRequires: %{python_module importlib-resources >= 1.3 if %python-base < 3.9}
BuildRequires: %{python_module importlib-resources >= 5.12 if %python-base < 3.12}
BuildRequires: %{python_module numpy >= 1.20}
BuildRequires: %{python_module packaging >= 17}
BuildRequires: %{python_module pydicom >= 1}
@@ -57,6 +60,7 @@ BuildRequires: %{python_module pytest-httpserver}
BuildRequires: %{python_module pytest-xdist}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module scipy}
BuildRequires: %{python_module typing-extensions >= 4.6 if %python-base < 3.13}
BuildRequires: %{pythons}
BuildRequires: git-core
# /SECTION
@@ -101,7 +105,6 @@ done
%license COPYING
%{expand:%(for b in %{binaries}; do echo "%%python_alternative %%{_bindir}/$b"; done)}
%{python_sitelib}/nibabel
%{python_sitelib}/nisext
%{python_sitelib}/nibabel-%{version}.dist-info
%changelog

View File

@@ -1,36 +0,0 @@
From 2bad8cce331976af3e8b42cecaed76bb075ee8b3 Mon Sep 17 00:00:00 2001
From: Chris Markiewicz <effigies@gmail.com>
Date: Tue, 5 Mar 2024 08:16:05 -0500
Subject: [PATCH] FIX: Use np.asarray instead of np.array(..., copy=False)
---
nibabel/affines.py | 2 +-
nibabel/casting.py | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/nibabel/affines.py b/nibabel/affines.py
index 05fdd7bb5..1478fd2dc 100644
--- a/nibabel/affines.py
+++ b/nibabel/affines.py
@@ -365,7 +365,7 @@ def rescale_affine(affine, shape, zooms, new_shape=None):
A new affine transform with the specified voxel sizes
"""
- shape = np.array(shape, copy=False)
+ shape = np.asarray(shape)
new_shape = np.array(new_shape if new_shape is not None else shape)
s = voxel_sizes(affine)
diff --git a/nibabel/casting.py b/nibabel/casting.py
index f3e04f30f..09015135f 100644
--- a/nibabel/casting.py
+++ b/nibabel/casting.py
@@ -611,7 +611,7 @@ def int_abs(arr):
>>> int_abs(np.array([-128, 127], dtype=np.float32))
array([128., 127.], dtype=float32)
"""
- arr = np.array(arr, copy=False)
+ arr = np.asarray(arr)
dt = arr.dtype
if dt.kind == 'u':
return arr

View File

@@ -1,60 +0,0 @@
From 82c8588528d5a06fd0dfc99e3cbb83d5cc299e2b Mon Sep 17 00:00:00 2001
From: Sandro <devel@penguinpee.nl>
Date: Wed, 29 May 2024 00:20:34 +0200
Subject: [PATCH] Replace deprecated setup() and teardown()
Those were compatibility functions for porting from nose. They are now
deprecated and have been removed from pytest.
This will make all tests compatible with pytests 8.x.
---
nibabel/streamlines/tests/test_streamlines.py | 2 +-
nibabel/tests/test_deprecated.py | 4 ++--
nibabel/tests/test_dft.py | 2 +-
3 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/nibabel/streamlines/tests/test_streamlines.py b/nibabel/streamlines/tests/test_streamlines.py
index f0bd9c7c4..53a43c393 100644
--- a/nibabel/streamlines/tests/test_streamlines.py
+++ b/nibabel/streamlines/tests/test_streamlines.py
@@ -20,7 +20,7 @@
DATA = {}
-def setup():
+def setup_module():
global DATA
DATA['empty_filenames'] = [pjoin(data_path, 'empty' + ext) for ext in FORMATS.keys()]
DATA['simple_filenames'] = [pjoin(data_path, 'simple' + ext) for ext in FORMATS.keys()]
diff --git a/nibabel/tests/test_deprecated.py b/nibabel/tests/test_deprecated.py
index f1c3d517c..01636632e 100644
--- a/nibabel/tests/test_deprecated.py
+++ b/nibabel/tests/test_deprecated.py
@@ -14,12 +14,12 @@
from nibabel.tests.test_deprecator import TestDeprecatorFunc as _TestDF
-def setup():
+def setup_module():
# Hack nibabel version string
pkg_info.cmp_pkg_version.__defaults__ = ('2.0',)
-def teardown():
+def teardown_module():
# Hack nibabel version string back again
pkg_info.cmp_pkg_version.__defaults__ = (pkg_info.__version__,)
diff --git a/nibabel/tests/test_dft.py b/nibabel/tests/test_dft.py
index 654af9827..6c6695b16 100644
--- a/nibabel/tests/test_dft.py
+++ b/nibabel/tests/test_dft.py
@@ -26,7 +26,7 @@
data_dir = pjoin(dirname(__file__), 'data')
-def setUpModule():
+def setup_module():
if os.name == 'nt':
raise unittest.SkipTest('FUSE not available for windows, skipping dft tests')
if not have_dicom: