Skip to content
Open
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
4 changes: 2 additions & 2 deletions clinica/pipelines/t1_volume/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
"type": "software",
"name": "spm",
"version": ">=12"
"version": ">=25"
}
]
}
}
4 changes: 2 additions & 2 deletions clinica/pipelines/t1_volume_create_dartel/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
"type": "software",
"name": "spm",
"version": ">=12"
"version": ">=25"
}
]
}
}
4 changes: 2 additions & 2 deletions clinica/pipelines/t1_volume_dartel2mni/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
"type": "software",
"name": "spm",
"version": ">=12"
"version": ">=25"
}
]
}
}
4 changes: 2 additions & 2 deletions clinica/pipelines/t1_volume_existing_template/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
"type": "software",
"name": "spm",
"version": ">=12"
"version": ">=25"
}
]
}
}
4 changes: 2 additions & 2 deletions clinica/pipelines/t1_volume_register_dartel/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{
"type": "software",
"name": "spm",
"version": ">=12"
"version": ">=25"
}
]
}
}
4 changes: 2 additions & 2 deletions clinica/pipelines/t1_volume_tissue_segmentation/info.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
{
"type": "software",
"name": "spm",
"version": ">=12"
"version": ">=25"
}
]
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,15 @@ def _build_output_node(self):
def _build_core_nodes(self):
"""Build and connect the core nodes of the pipeline."""
import nipype.interfaces.io as nio
import nipype.interfaces.spm as spm
import nipype.interfaces.utility as nutil
import nipype.pipeline.engine as npe

from clinica.utils.filemanip import unzip_nii, zip_nii
from clinica.utils.nipype import container_from_filename, fix_join
from clinica.utils.spm import use_spm_standalone_if_available

from .t1_volume_tissue_segmentation_utils import (
ApplySegmentationDeformation,
ComputeNewSegment,
get_tissue_tuples,
init_input_node,
print_end_pipeline,
Expand Down Expand Up @@ -229,7 +228,7 @@ def _build_core_nodes(self):

# Unified Segmentation
# ====================
new_segment = npe.Node(spm.NewSegment(), name="2-SpmSegmentation")
new_segment = npe.Node(ComputeNewSegment(), name="2-SpmSegmentation")
new_segment.inputs.write_deformation_fields = [True, True]
new_segment.inputs.tissues = get_tissue_tuples(
self.parameters["tissue_probability_maps"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
traits,
)
from nipype.interfaces.spm.base import SPMCommand, SPMCommandInputSpec
from nipype.interfaces.spm.preprocess import NewSegment
from nipype.utils.filemanip import filename_to_list, list_to_filename


Expand Down Expand Up @@ -167,3 +168,14 @@ def _list_outputs(self):
_, fname = os.path.split(filename)
outputs["out_files"].append(os.path.realpath("w%s" % fname))
return outputs


class ComputeNewSegment(NewSegment):
"""Use spm_preproc (New Segment) to separate structural images into
different tissue classes. Supports multiple modalities.

Adapts Nipype NewSegment interface to SPM25 and drops SPM8. When Nipype's own interface is adapted this class can be removed.
"""

_jobtype = "spatial"
_jobname = "preproc"
2 changes: 1 addition & 1 deletion docs/Pipelines/T1_Volume.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The average gray matter density (also in MNI space) is then computed in each of

## Dependencies

If you only installed the core of Clinica, this pipeline needs the installation of either [SPM12](../Software/Third-party.md#spm12) and [Matlab](../Software/Third-party.md#matlab), or [SPM standalone](../Software/Third-party.md#spm12-standalone) on your computer.
If you only installed the core of Clinica, this pipeline needs the installation of [SPM standalone](../Software/Third-party.md#spm12-standalone) on your computer.

## Running the pipeline

Expand Down
2 changes: 1 addition & 1 deletion docs/Software/Third-party.md
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ If you want to install `SPM12` without installing [Matlab](#matlab), you will ne

!!! danger "Which version to use ?"
SPM has recently released a version `SPM25` on Github for which the installation is described [here](https://www.fil.ion.ucl.ac.uk/spm/docs/installation/standalone/).
Clinica does not support this version yet. If you want to use pipelines relying on SPM please use SPM12.
Clinica supports this version **only** for `t1-volume` as of now. If you want to use other pipelines relying on SPM please use `SPM12`.

!!! tip "Verify your environment variables"
If you followed the installation instructions, you should have set the environment variable `$LD_LIBRARY_PATH` on Linux, or `$DYLD_LIBRARY_PATH` on MacOS.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_t1_volume_create_dartel_info_loading(tmp_path):
"version": "0.1.0",
"space_caps": "130M",
"space_wd": "140M",
"dependencies": [{"type": "software", "name": "spm", "version": ">=12"}],
"dependencies": [{"type": "software", "name": "spm", "version": ">=25"}],
}


Expand All @@ -36,7 +36,7 @@ def test_t1_volume_create_dartel_dependencies(tmp_path, mocker):

mocker.patch(
"clinica.utils.check_dependency._get_spm_version",
return_value=Version("12.7219"),
return_value=Version("25.7219"),
)
caps = build_caps_directory(
tmp_path / "caps",
Expand All @@ -49,6 +49,6 @@ def test_t1_volume_create_dartel_dependencies(tmp_path, mocker):

assert pipeline.dependencies == [
SoftwareDependency(
ThirdPartySoftware.SPM, SpecifierSet(">=12"), Version("12.7219")
ThirdPartySoftware.SPM, SpecifierSet(">=25"), Version("25.7219")
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_t1_volume_dartel2mni_info_loading(tmp_path):
"version": "0.1.0",
"space_caps": "30M",
"space_wd": "150M",
"dependencies": [{"type": "software", "name": "spm", "version": ">=12"}],
"dependencies": [{"type": "software", "name": "spm", "version": ">=25"}],
}


Expand All @@ -36,7 +36,7 @@ def test_t1_volume_dartel2mni_dependencies(tmp_path, mocker):

mocker.patch(
"clinica.utils.check_dependency._get_spm_version",
return_value=Version("12.7219"),
return_value=Version("25.7219"),
)
caps = build_caps_directory(
tmp_path / "caps",
Expand All @@ -49,6 +49,6 @@ def test_t1_volume_dartel2mni_dependencies(tmp_path, mocker):

assert pipeline.dependencies == [
SoftwareDependency(
ThirdPartySoftware.SPM, SpecifierSet(">=12"), Version("12.7219")
ThirdPartySoftware.SPM, SpecifierSet(">=25"), Version("25.7219")
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def test_t1_volume_register_dartel_info_loading(tmp_path):
"version": "0.1.0",
"space_caps": "30M",
"space_wd": "110M",
"dependencies": [{"type": "software", "name": "spm", "version": ">=12"}],
"dependencies": [{"type": "software", "name": "spm", "version": ">=25"}],
}


Expand All @@ -36,7 +36,7 @@ def test_t1_volume_register_dartel_dependencies(tmp_path, mocker):

mocker.patch(
"clinica.utils.check_dependency._get_spm_version",
return_value=Version("12.7219"),
return_value=Version("25.7219"),
)
caps = build_caps_directory(
tmp_path / "caps",
Expand All @@ -49,6 +49,6 @@ def test_t1_volume_register_dartel_dependencies(tmp_path, mocker):

assert pipeline.dependencies == [
SoftwareDependency(
ThirdPartySoftware.SPM, SpecifierSet(">=12"), Version("12.7219")
ThirdPartySoftware.SPM, SpecifierSet(">=25"), Version("25.7219")
),
]
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def test_t1_volume_tissue_segmentation_info_loading(tmp_path):
"space_caps": "35M",
"space_wd": "147M",
"version": "0.1.0",
"dependencies": [{"type": "software", "name": "spm", "version": ">=12"}],
"dependencies": [{"type": "software", "name": "spm", "version": ">=25"}],
}


Expand All @@ -41,7 +41,7 @@ def test_t1_volume_tissue_segmentation_dependencies(tmp_path, mocker):

mocker.patch(
"clinica.utils.check_dependency._get_spm_version",
return_value=Version("12.7219"),
return_value=Version("25.7219"),
)
caps = build_caps_directory(
tmp_path / "caps",
Expand All @@ -54,7 +54,7 @@ def test_t1_volume_tissue_segmentation_dependencies(tmp_path, mocker):

assert pipeline.dependencies == [
SoftwareDependency(
ThirdPartySoftware.SPM, SpecifierSet(">=12"), Version("12.7219")
ThirdPartySoftware.SPM, SpecifierSet(">=25"), Version("25.7219")
),
]

Expand All @@ -66,7 +66,7 @@ def test_t1_volume_tissue_segmentation_get_processed_visits_empty(tmp_path, mock

mocker.patch(
"clinica.utils.check_dependency._get_spm_version",
return_value=Version("12.7219"),
return_value=Version("25.7219"),
)
bids = build_bids_directory(
tmp_path / "bids", {"sub-01": ["ses-M000", "ses-M006"], "sub-02": ["ses-M000"]}
Expand Down Expand Up @@ -119,7 +119,7 @@ def test_t1_volume_tissue_segmentation_get_processed_visits(tmp_path, mocker):

mocker.patch(
"clinica.utils.check_dependency._get_spm_version",
return_value=Version("12.7219"),
return_value=Version("25.7219"),
)
bids = build_bids_directory(
tmp_path / "bids",
Expand Down
Loading