Skip to content

Commit cdc788d

Browse files
committed
Merge remote-tracking branch 'upstream/master' into correct-bug-OrthoSlicer3D
2 parents 4f36bc7 + d15ec58 commit cdc788d

37 files changed

+1138
-440
lines changed

.coveragerc

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,18 @@
11
[run]
22
branch = True
33
source = nibabel
4-
include = */nibabel/*
54
omit =
65
*/externals/*
76
*/benchmarks/*
8-
*/tests/*
97
nibabel/_version.py
8+
9+
[report]
10+
exclude_also =
11+
def __repr__
12+
if (ty\.|typing\.)?TYPE_CHECKING:
13+
class .*\((ty\.|typing\.)Protocol\):
14+
@(ty\.|typing\.)overload
15+
if 0:
16+
if __name__ == .__main__.:
17+
@(abc\.)?abstractmethod
18+
raise NotImplementedError

.github/workflows/test.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,9 @@ jobs:
125125
- os: ubuntu-latest
126126
python-version: 3.8
127127
dependencies: 'min'
128-
# NumPy 2.0
128+
# NoGIL
129129
- os: ubuntu-latest
130-
python-version: '3.12'
130+
python-version: '3.13-dev'
131131
dependencies: 'dev'
132132
exclude:
133133
# x86 for Windows + Python<3.12
@@ -168,11 +168,18 @@ jobs:
168168
submodules: recursive
169169
fetch-depth: 0
170170
- name: Set up Python ${{ matrix.python-version }}
171+
if: "!endsWith(matrix.python-version, '-dev')"
171172
uses: actions/setup-python@v5
172173
with:
173174
python-version: ${{ matrix.python-version }}
174175
architecture: ${{ matrix.architecture }}
175176
allow-prereleases: true
177+
- name: Set up Python ${{ matrix.python-version }}
178+
if: endsWith(matrix.python-version, '-dev')
179+
uses: deadsnakes/[email protected]
180+
with:
181+
python-version: ${{ matrix.python-version }}
182+
nogil: true
176183
- name: Display Python version
177184
run: python -c "import sys; print(sys.version)"
178185
- name: Install tox
@@ -182,7 +189,7 @@ jobs:
182189
- name: Show tox config
183190
run: tox c
184191
- name: Run tox
185-
run: tox -v --exit-and-dump-after 1200
192+
run: tox -vv --exit-and-dump-after 1200
186193
- uses: codecov/codecov-action@v4
187194
if: ${{ always() }}
188195
with:

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ repos:
1616
rev: v0.3.4
1717
hooks:
1818
- id: ruff
19-
args: [--fix, --show-fix, --exit-non-zero-on-fix]
19+
args: [--fix, --show-fixes, --exit-non-zero-on-fix]
2020
exclude: = ["doc", "tools"]
2121
- id: ruff-format
2222
exclude: = ["doc", "tools"]

Changelog

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,33 @@ Eric Larson (EL), Demian Wassermann, Stephan Gerhard and Ross Markello (RM).
2525

2626
References like "pr/298" refer to github pull request numbers.
2727

28+
Upcoming release (To be determined)
29+
===================================
30+
31+
New features
32+
------------
33+
34+
Enhancements
35+
------------
36+
* Ability to read data from many multiframe DICOM files that previously generated errors
37+
38+
Bug fixes
39+
---------
40+
* Fixed multiframe DICOM issue where data could be flipped along slice dimension relative to the
41+
affine
42+
* Fixed multiframe DICOM issue where ``image_position`` and the translation component in the
43+
``affine`` could be incorrect
44+
45+
Documentation
46+
-------------
47+
48+
Maintenance
49+
-----------
50+
51+
API changes and deprecations
52+
----------------------------
53+
54+
2855
5.2.1 (Monday 26 February 2024)
2956
===============================
3057

doc/source/conf.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@
2828
import tomli as tomllib
2929

3030
# Check for external Sphinx extensions we depend on
31+
try:
32+
import numpy as np
33+
except ImportError:
34+
raise RuntimeError('Need to install "numpy" package for doc build')
3135
try:
3236
import numpydoc
3337
except ImportError:
@@ -45,6 +49,11 @@
4549
'Need nibabel on Python PATH; consider "make htmldoc" from nibabel root directory'
4650
)
4751

52+
from packaging.version import Version
53+
54+
if Version(np.__version__) >= Version('1.22'):
55+
np.set_printoptions(legacy='1.21')
56+
4857
# -- General configuration ----------------------------------------------------
4958

5059
# We load the nibabel release info into a dict by explicit execution

doc/tools/build_modref_templates.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
import sys
1010

1111
# version comparison
12-
from distutils.version import LooseVersion as V
12+
from packaging.version import Version as V
1313
from os.path import join as pjoin
1414

1515
# local imports
@@ -73,6 +73,8 @@ def abort(error):
7373
if re.match('^_version_(major|minor|micro|extra)', v)
7474
]
7575
)
76+
77+
source_version = V(source_version)
7678
print('***', source_version)
7779

7880
if source_version != installed_version:

nibabel/_compression.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
from .optpkg import optional_package
1919

20-
if ty.TYPE_CHECKING: # pragma: no cover
20+
if ty.TYPE_CHECKING:
2121
import indexed_gzip # type: ignore[import]
2222
import pyzstd
2323

nibabel/arrayproxy.py

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
KEEP_FILE_OPEN_DEFAULT = False
5858

5959

60-
if ty.TYPE_CHECKING: # pragma: no cover
60+
if ty.TYPE_CHECKING:
6161
import numpy.typing as npt
6262
from typing_extensions import Self # PY310
6363

@@ -75,19 +75,17 @@ class ArrayLike(ty.Protocol):
7575
shape: tuple[int, ...]
7676

7777
@property
78-
def ndim(self) -> int: ... # pragma: no cover
78+
def ndim(self) -> int: ...
7979

8080
# If no dtype is passed, any dtype might be returned, depending on the array-like
8181
@ty.overload
82-
def __array__(
83-
self, dtype: None = ..., /
84-
) -> np.ndarray[ty.Any, np.dtype[ty.Any]]: ... # pragma: no cover
82+
def __array__(self, dtype: None = ..., /) -> np.ndarray[ty.Any, np.dtype[ty.Any]]: ...
8583

8684
# Any dtype might be passed, and *that* dtype must be returned
8785
@ty.overload
88-
def __array__(self, dtype: _DType, /) -> np.ndarray[ty.Any, _DType]: ... # pragma: no cover
86+
def __array__(self, dtype: _DType, /) -> np.ndarray[ty.Any, _DType]: ...
8987

90-
def __getitem__(self, key, /) -> npt.NDArray: ... # pragma: no cover
88+
def __getitem__(self, key, /) -> npt.NDArray: ...
9189

9290

9391
class ArrayProxy(ArrayLike):

nibabel/brikhead.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def get_affine(self):
391391
# AFNI default is RAI- == LPS+ == DICOM order. We need to flip RA sign
392392
# to align with nibabel RAS+ system
393393
affine = np.asarray(self.info['IJK_TO_DICOM_REAL']).reshape(3, 4)
394-
affine = np.row_stack((affine * [[-1], [-1], [1]], [0, 0, 0, 1]))
394+
affine = np.vstack((affine * [[-1], [-1], [1]], [0, 0, 0, 1]))
395395
return affine
396396

397397
def get_data_scaling(self):

nibabel/cmdline/dicomfs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ class dummy_fuse:
3737
import nibabel as nib
3838
import nibabel.dft as dft
3939

40-
encoding = locale.getdefaultlocale()[1]
40+
encoding = locale.getlocale()[1]
4141

4242
fuse.fuse_python_api = (0, 2)
4343

0 commit comments

Comments
 (0)