Skip to content

Commit 73225f7

Browse files
authored
[MAINT] Support python 3.10 - 3.13 (#1643)
* Update poetry lock * Increase BrainStat version and get rid of python 3.9 * Test with dcm2niix version on ci * Remove unused function * Remove test line in converters test * Put back test on dcm2niix * Move brainstat from optional to dependencies * Update poetry lock * Test with f explicit * Move ignore words from precommit to txt * Revert to original * Adding python 3.13
1 parent 0c15916 commit 73225f7

File tree

8 files changed

+2259
-2640
lines changed

8 files changed

+2259
-2640
lines changed

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ jobs:
1717
fail-fast: false
1818
matrix:
1919
os: [ubuntu-latest, macos-latest]
20-
python-version: ['3.9', '3.10', '3.11', '3.12']
20+
python-version: ['3.10', '3.11', '3.12', '3.13']
2121
steps:
2222
- uses: actions/checkout@v6
2323
- uses: snok/install-poetry@v1

.pre-commit-config.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ repos:
1313
rev: v2.3.0
1414
hooks:
1515
- id: codespell
16-
args: ["--ignore-words-list=ALS"]
1716
additional_dependencies:
1817
- tomli
1918
- repo: https://github.com/python-poetry/poetry

clinica/pipelines/statistics_surface/_utils.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -158,12 +158,12 @@ def build_design_matrix(contrast: str, covariates: Optional[str] = None) -> str:
158158
159159
Example
160160
-------
161-
>>> from clinica.pipelines.statistics_surface.statistics_surface_utils import _build_design_matrix
162-
>>> _build_design_matrix('group', 'age sex group')
161+
>>> from clinica.pipelines.statistics_surface._utils import build_design_matrix
162+
>>> build_design_matrix('group', 'age sex group')
163163
1 + group + age + sex
164-
>>> _build_design_matrix('group', 'age')
164+
>>> build_design_matrix('group', 'age')
165165
1 + group + age
166-
>>> _build_design_matrix('group', None)
166+
>>> build_design_matrix('group', None)
167167
1 + group
168168
"""
169169
if covariates:

clinica/utils/image.py

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"compute_aggregated_volume",
1717
"get_new_image_like",
1818
"merge_nifti_images_in_time_dimension",
19-
"remove_dummy_dimension_from_image",
2019
"crop_nifti",
2120
"clip_nifti",
2221
"crop_nifti_using_t1_mni_template",
@@ -220,31 +219,6 @@ def _check_volumes_from_images(images: Tuple[Path, ...]) -> Tuple[np.ndarray, ..
220219
return tuple(four_dimensional_volumes)
221220

222221

223-
def remove_dummy_dimension_from_image(image: str, output: str) -> str:
224-
"""Remove all dummy dimensions (i.e. equal to 1) from an image.
225-
226-
Parameters
227-
----------
228-
image : str
229-
Path to the input image.
230-
231-
output : str
232-
Path to the desired output image.
233-
234-
Returns
235-
-------
236-
str :
237-
The path to the output image.
238-
"""
239-
import nibabel as nib
240-
from nilearn.image import new_img_like
241-
242-
img = new_img_like(image, nib.load(image).get_fdata().squeeze())
243-
nib.save(img, output)
244-
245-
return output
246-
247-
248222
@dataclass
249223
class Slice:
250224
"""Interval composed of a starting point and ending point."""

ignore_words.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ nd
66
siz
77
te
88
vox
9+
ALS

poetry.lock

Lines changed: 2248 additions & 2583 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ maintainers = [
1414
{ name = "Clinica developers", email = "clinica.run@gmail.com>" },
1515
]
1616
readme = "README.md"
17-
requires-python = ">=3.9,<3.13"
17+
requires-python = ">=3.10,<3.14"
1818
keywords = [
1919
"bids",
2020
"image processing",
@@ -33,7 +33,7 @@ classifiers = [
3333
]
3434
dependencies = [
3535
"nibabel (>=5)",
36-
"nipype (>=1.8.6)",
36+
"nipype (>=1.10.0)",
3737
"argcomplete (>=1.9.4,<2)",
3838
"pandas (>=2,<3)",
3939
"jinja2 (>=3,<4)",
@@ -43,7 +43,7 @@ dependencies = [
4343
"nilearn (>=0.10.3,<1.0)",
4444
"colorlog (>=5,<6)",
4545
"xgboost",
46-
"scipy (>=1.12,<2)",
46+
"scipy (>=1.14,<2)",
4747
"matplotlib",
4848
"scikit-image",
4949
"pydicom",
@@ -63,8 +63,9 @@ dependencies = [
6363
"pydra-freesurfer (>=0.0.9)",
6464
"pydra-petpvc (>=0.0.4)",
6565
"pydra-fsl (>=0.0.22)",
66-
"antspyx (>=0.4.2)",
66+
"antspyx (>=0.5.4)",
6767
"rich (>=13.8.0)",
68+
"brainstat (>=0.5.2)",
6869
]
6970

7071
[project.urls]
@@ -90,9 +91,6 @@ mkdocs = "^1.1"
9091
mkdocs-material = ">=7.1.8"
9192
pymdown-extensions = "*"
9293

93-
[tool.poetry.group.optional.dependencies]
94-
brainstat = "^0.4.2"
95-
9694
[project.scripts]
9795
clinica = "clinica.cmdline:main"
9896

test/unittests/utils/test_image.py

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -153,24 +153,6 @@ def test_merge_nifti_images_in_time_dimension_3d_and_4d(
153153
assert_array_equal(out_img.get_fdata(), expected_data)
154154

155155

156-
def test_remove_dummy_dimension_from_image(tmp_path):
157-
from clinica.utils.image import remove_dummy_dimension_from_image
158-
159-
input_data = np.random.randint(low=0, high=10, size=(16, 10, 6, 3))
160-
input_image = nib.Nifti1Image(input_data.astype(np.int32), affine=np.eye(4))
161-
nib.save(input_image, tmp_path / "input_image.nii.gz")
162-
163-
result = remove_dummy_dimension_from_image(
164-
str(tmp_path / "input_image.nii.gz"),
165-
str(tmp_path / "output_image.nii.gz"),
166-
)
167-
result_image = nib.load(result)
168-
169-
assert result == str(tmp_path / "output_image.nii.gz")
170-
assert_array_equal(result_image.affine, np.eye(4))
171-
assert_array_equal(result_image.get_fdata(), input_data)
172-
173-
174156
def test_slice_error():
175157
from clinica.utils.image import Slice # noqa
176158

0 commit comments

Comments
 (0)