Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
python-version: ['3.9', '3.10', '3.11', '3.12']
python-version: ['3.10', '3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v6
- uses: snok/install-poetry@v1
Expand Down
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ repos:
rev: v2.3.0
hooks:
- id: codespell
args: ["--ignore-words-list=ALS"]
additional_dependencies:
- tomli
- repo: https://github.com/python-poetry/poetry
Expand Down
8 changes: 4 additions & 4 deletions clinica/pipelines/statistics_surface/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ def build_design_matrix(contrast: str, covariates: Optional[str] = None) -> str:
Example
-------
>>> from clinica.pipelines.statistics_surface.statistics_surface_utils import _build_design_matrix
>>> _build_design_matrix('group', 'age sex group')
>>> from clinica.pipelines.statistics_surface._utils import build_design_matrix
>>> build_design_matrix('group', 'age sex group')
1 + group + age + sex
>>> _build_design_matrix('group', 'age')
>>> build_design_matrix('group', 'age')
1 + group + age
>>> _build_design_matrix('group', None)
>>> build_design_matrix('group', None)
1 + group
"""
if covariates:
Expand Down
26 changes: 0 additions & 26 deletions clinica/utils/image.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
"compute_aggregated_volume",
"get_new_image_like",
"merge_nifti_images_in_time_dimension",
"remove_dummy_dimension_from_image",
"crop_nifti",
"clip_nifti",
"crop_nifti_using_t1_mni_template",
Expand Down Expand Up @@ -220,31 +219,6 @@ def _check_volumes_from_images(images: Tuple[Path, ...]) -> Tuple[np.ndarray, ..
return tuple(four_dimensional_volumes)


def remove_dummy_dimension_from_image(image: str, output: str) -> str:
"""Remove all dummy dimensions (i.e. equal to 1) from an image.
Parameters
----------
image : str
Path to the input image.
output : str
Path to the desired output image.
Returns
-------
str :
The path to the output image.
"""
import nibabel as nib
from nilearn.image import new_img_like

img = new_img_like(image, nib.load(image).get_fdata().squeeze())
nib.save(img, output)

return output


@dataclass
class Slice:
"""Interval composed of a starting point and ending point."""
Expand Down
1 change: 1 addition & 0 deletions ignore_words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ nd
siz
te
vox
ALS
4,831 changes: 2,248 additions & 2,583 deletions poetry.lock

Large diffs are not rendered by default.

12 changes: 5 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ maintainers = [
{ name = "Clinica developers", email = "clinica.run@gmail.com>" },
]
readme = "README.md"
requires-python = ">=3.9,<3.13"
requires-python = ">=3.10,<3.14"
keywords = [
"bids",
"image processing",
Expand All @@ -33,7 +33,7 @@ classifiers = [
]
dependencies = [
"nibabel (>=5)",
"nipype (>=1.8.6)",
"nipype (>=1.10.0)",
"argcomplete (>=1.9.4,<2)",
"pandas (>=2,<3)",
"jinja2 (>=3,<4)",
Expand All @@ -43,7 +43,7 @@ dependencies = [
"nilearn (>=0.10.3,<1.0)",
"colorlog (>=5,<6)",
"xgboost",
"scipy (>=1.12,<2)",
"scipy (>=1.14,<2)",
"matplotlib",
"scikit-image",
"pydicom",
Expand All @@ -63,8 +63,9 @@ dependencies = [
"pydra-freesurfer (>=0.0.9)",
"pydra-petpvc (>=0.0.4)",
"pydra-fsl (>=0.0.22)",
"antspyx (>=0.4.2)",
"antspyx (>=0.5.4)",
"rich (>=13.8.0)",
"brainstat (>=0.5.2)",
]

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

[tool.poetry.group.optional.dependencies]
brainstat = "^0.4.2"

[project.scripts]
clinica = "clinica.cmdline:main"

Expand Down
18 changes: 0 additions & 18 deletions test/unittests/utils/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,24 +153,6 @@ def test_merge_nifti_images_in_time_dimension_3d_and_4d(
assert_array_equal(out_img.get_fdata(), expected_data)


def test_remove_dummy_dimension_from_image(tmp_path):
from clinica.utils.image import remove_dummy_dimension_from_image

input_data = np.random.randint(low=0, high=10, size=(16, 10, 6, 3))
input_image = nib.Nifti1Image(input_data.astype(np.int32), affine=np.eye(4))
nib.save(input_image, tmp_path / "input_image.nii.gz")

result = remove_dummy_dimension_from_image(
str(tmp_path / "input_image.nii.gz"),
str(tmp_path / "output_image.nii.gz"),
)
result_image = nib.load(result)

assert result == str(tmp_path / "output_image.nii.gz")
assert_array_equal(result_image.affine, np.eye(4))
assert_array_equal(result_image.get_fdata(), input_data)


def test_slice_error():
from clinica.utils.image import Slice # noqa

Expand Down
Loading