[FIX]: Change all probseg_ appearances with VBM_ for consistency #320

Merged
fraimondo merged 6 commits from fix/probseg into main 2024-04-05 13:33:24 +00:00
17 changed files with 166 additions and 126 deletions

View file

@ -0,0 +1 @@
Change all ``probseg_`` types to ``VBM_`` types by `Fede Raimondo`_
synchon commented 2024-04-05 07:25:57 +00:00 (Migrated from github.com)

Needs to be double-ticked:

``probseg_``
``VBM_``
Needs to be double-ticked: ``` ``probseg_`` ``VBM_`` ```

View file

@ -0,0 +1 @@
Add a validation step on the :func:`.run` function to validate the marker collection by `Fede Raimondo`_
synchon commented 2024-04-05 07:42:42 +00:00 (Migrated from github.com)

run function can be referred by:

:func:`.run`

?

``run`` function can be referred by: ``` :func:`.run` ``` ?

View file

@ -165,6 +165,8 @@ def run(
preprocessors=built_preprocessors,
storage=storage_object,
)
mc.validate(datagrabber_object)
# Fit elements
with datagrabber_object:
if elements is not None:

View file

@ -29,9 +29,9 @@ def test_JuselessUCLA() -> None:
"BOLD",
"BOLD_confounds",
"T1w",
"probseg_CSF",
"probseg_GM",
"probseg_WM",
"VBM_CSF",
"VBM_GM",
"VBM_WM",
]
for t in types:
@ -45,12 +45,12 @@ def test_JuselessUCLA() -> None:
"BOLD",
"BOLD_confounds",
"T1w",
"probseg_CSF",
"probseg_GM",
"probseg_WM",
"VBM_CSF",
"VBM_GM",
"VBM_WM",
["BOLD", "BOLD_confounds"],
["T1w", "probseg_CSF"],
["probseg_GM", "probseg_WM"],
["T1w", "VBM_CSF"],
["VBM_GM", "VBM_WM"],
["BOLD", "T1w"],
],
)

View file

@ -23,8 +23,8 @@ class JuselessUCLA(PatternDataGrabber):
datadir : str or Path, optional
The directory where the dataset is stored.
(default "/data/project/psychosis_thalamus/data/fmriprep").
types: {"BOLD", "BOLD_confounds", "T1w", "probseg_CSF", "probseg_GM", \
"probseg_WM"} or a list of the options, optional
types: {"BOLD", "BOLD_confounds", "T1w", "VBM_CSF", "VBM_GM", \
"VBM_WM"} or a list of the options, optional
UCLA data types. If None, all available data types are selected.
(default None).
tasks : {"rest", "bart", "bht", "pamenc", "pamret", \
@ -91,21 +91,21 @@ class JuselessUCLA(PatternDataGrabber):
),
"space": "MNI152NLin2009cAsym",
},
"probseg_CSF": {
"VBM_CSF": {
"pattern": (
"sub-{subject}/anat/sub-{subject}_T1w_space-"
"MNI152NLin2009cAsym_class-CSF_probtissue.nii.gz"
),
"space": "MNI152NLin2009cAsym",
},
"probseg_GM": {
"VBM_GM": {
"pattern": (
"sub-{subject}/anat/sub-{subject}_T1w_space-"
"MNI152NLin2009cAsym_class-GM_probtissue.nii.gz"
),
"space": "MNI152NLin2009cAsym",
},
"probseg_WM": {
"VBM_WM": {
"pattern": (
"sub-{subject}/anat/sub-{subject}_T1w_space"
"-MNI152NLin2009cAsym_class-WM_probtissue.nii.gz"

View file

@ -24,8 +24,8 @@ class DataladAOMICID1000(PatternDataladDataGrabber):
The directory where the datalad dataset will be cloned. If None,
the datalad dataset will be cloned into a temporary directory
(default None).
types: {"BOLD", "BOLD_confounds", "T1w", "probseg_CSF", "probseg_GM", \
"probseg_WM", "DWI"} or a list of the options, optional
types: {"BOLD", "BOLD_confounds", "T1w", "VBM_CSF", "VBM_GM", \
"VBM_WM", "DWI"} or a list of the options, optional
AOMIC data types. If None, all available data types are selected.
(default None).
native_t1w : bool, optional
@ -84,7 +84,7 @@ class DataladAOMICID1000(PatternDataladDataGrabber):
),
"space": "MNI152NLin2009cAsym",
},
"probseg_CSF": {
"VBM_CSF": {
"pattern": (
"derivatives/fmriprep/sub-{subject}/anat/"
"sub-{subject}_space-MNI152NLin2009cAsym_label-"
@ -92,7 +92,7 @@ class DataladAOMICID1000(PatternDataladDataGrabber):
),
"space": "MNI152NLin2009cAsym",
},
"probseg_GM": {
"VBM_GM": {
"pattern": (
"derivatives/fmriprep/sub-{subject}/anat/"
"sub-{subject}_space-MNI152NLin2009cAsym_label-"
@ -100,7 +100,7 @@ class DataladAOMICID1000(PatternDataladDataGrabber):
),
"space": "MNI152NLin2009cAsym",
},
"probseg_WM": {
"VBM_WM": {
"pattern": (
"derivatives/fmriprep/sub-{subject}/anat/"
"sub-{subject}_space-MNI152NLin2009cAsym_label-"

View file

@ -26,8 +26,8 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
The directory where the datalad dataset will be cloned. If None,
the datalad dataset will be cloned into a temporary directory
(default None).
types: {"BOLD", "BOLD_confounds", "T1w", "probseg_CSF", "probseg_GM", \
"probseg_WM", "DWI"} or a list of the options, optional
types: {"BOLD", "BOLD_confounds", "T1w", "VBM_CSF", "VBM_GM", \
"VBM_WM", "DWI"} or a list of the options, optional
AOMIC data types. If None, all available data types are selected.
(default None).
tasks : {"restingstate", "anticipation", "emomatching", "faces", \
@ -119,7 +119,7 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
),
"space": "MNI152NLin2009cAsym",
},
"probseg_CSF": {
"VBM_CSF": {
"pattern": (
"derivatives/fmriprep/sub-{subject}/anat/"
"sub-{subject}_space-MNI152NLin2009cAsym_label-"
@ -127,7 +127,7 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
),
"space": "MNI152NLin2009cAsym",
},
"probseg_GM": {
"VBM_GM": {
"pattern": (
"derivatives/fmriprep/sub-{subject}/anat/"
"sub-{subject}_space-MNI152NLin2009cAsym_label-"
@ -135,7 +135,7 @@ class DataladAOMICPIOP1(PatternDataladDataGrabber):
),
"space": "MNI152NLin2009cAsym",
},
"probseg_WM": {
"VBM_WM": {
"pattern": (
"derivatives/fmriprep/sub-{subject}/anat/"
"sub-{subject}_space-MNI152NLin2009cAsym_label-"

View file

@ -26,8 +26,8 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
The directory where the datalad dataset will be cloned. If None,
the datalad dataset will be cloned into a temporary directory
(default None).
types: {"BOLD", "BOLD_confounds", "T1w", "probseg_CSF", "probseg_GM", \
"probseg_WM", "DWI"} or a list of the options, optional
types: {"BOLD", "BOLD_confounds", "T1w", "VBM_CSF", "VBM_GM", \
"VBM_WM", "DWI"} or a list of the options, optional
AOMIC data types. If None, all available data types are selected.
(default None).
tasks : {"restingstate", "stopsignal", "workingmemory"} \
@ -116,7 +116,7 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
),
"space": "MNI152NLin2009cAsym",
},
"probseg_CSF": {
"VBM_CSF": {
"pattern": (
"derivatives/fmriprep/sub-{subject}/anat/"
"sub-{subject}_space-MNI152NLin2009cAsym_label-"
@ -124,7 +124,7 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
),
"space": "MNI152NLin2009cAsym",
},
"probseg_GM": {
"VBM_GM": {
"pattern": (
"derivatives/fmriprep/sub-{subject}/anat/"
"sub-{subject}_space-MNI152NLin2009cAsym_label-"
@ -132,7 +132,7 @@ class DataladAOMICPIOP2(PatternDataladDataGrabber):
),
"space": "MNI152NLin2009cAsym",
},
"probseg_WM": {
"VBM_WM": {
"pattern": (
"derivatives/fmriprep/sub-{subject}/anat/"
"sub-{subject}_space-MNI152NLin2009cAsym_label-"

View file

@ -71,41 +71,41 @@ def test_DataladAOMICID1000() -> None:
# asserts T1w_mask
assert out["T1w_mask"]["path"].exists()
# asserts type "probseg_CSF"
assert "probseg_CSF" in out
# asserts type "VBM_CSF"
assert "VBM_CSF" in out
assert (
out["probseg_CSF"]["path"].name
out["VBM_CSF"]["path"].name
== f"sub-{test_element}_space-MNI152NLin2009cAsym_label-"
"CSF_probseg.nii.gz"
)
assert out["probseg_CSF"]["path"].exists()
assert out["probseg_CSF"]["path"].is_file()
assert out["VBM_CSF"]["path"].exists()
assert out["VBM_CSF"]["path"].is_file()
# asserts type "probseg_GM"
assert "probseg_GM" in out
# asserts type "VBM_GM"
assert "VBM_GM" in out
assert (
out["probseg_GM"]["path"].name
out["VBM_GM"]["path"].name
== f"sub-{test_element}_space-MNI152NLin2009cAsym_label-"
"GM_probseg.nii.gz"
)
assert out["probseg_GM"]["path"].exists()
assert out["probseg_GM"]["path"].is_file()
assert out["VBM_GM"]["path"].exists()
assert out["VBM_GM"]["path"].is_file()
# asserts type "probseg_WM"
assert "probseg_WM" in out
# asserts type "VBM_WM"
assert "VBM_WM" in out
assert (
out["probseg_WM"]["path"].name
out["VBM_WM"]["path"].name
== f"sub-{test_element}_space-MNI152NLin2009cAsym_label-"
"WM_probseg.nii.gz"
)
assert out["probseg_WM"]["path"].exists()
assert out["probseg_WM"]["path"].is_file()
assert out["VBM_WM"]["path"].exists()
assert out["VBM_WM"]["path"].is_file()
# asserts type "DWI"
assert "DWI" in out
@ -132,13 +132,13 @@ def test_DataladAOMICID1000() -> None:
"BOLD",
"BOLD_confounds",
"T1w",
"probseg_CSF",
"probseg_GM",
"probseg_WM",
"VBM_CSF",
"VBM_GM",
"VBM_WM",
"DWI",
["BOLD", "BOLD_confounds"],
["T1w", "probseg_CSF"],
["probseg_GM", "probseg_WM"],
["T1w", "VBM_CSF"],
["VBM_GM", "VBM_WM"],
["DWI", "BOLD"],
],
)

View file

@ -91,41 +91,41 @@ def test_DataladAOMICPIOP1(tasks: Optional[str]) -> None:
# asserts T1w_mask
assert out["T1w_mask"]["path"].exists()
# asserts type "probseg_CSF"
assert "probseg_CSF" in out
# asserts type "VBM_CSF"
assert "VBM_CSF" in out
assert (
out["probseg_CSF"]["path"].name
out["VBM_CSF"]["path"].name
== f"sub-{sub}_space-MNI152NLin2009cAsym_label-"
"CSF_probseg.nii.gz"
)
assert out["probseg_CSF"]["path"].exists()
assert out["probseg_CSF"]["path"].is_file()
assert out["VBM_CSF"]["path"].exists()
assert out["VBM_CSF"]["path"].is_file()
# asserts type "probseg_GM"
assert "probseg_GM" in out
# asserts type "VBM_GM"
assert "VBM_GM" in out
assert (
out["probseg_GM"]["path"].name
out["VBM_GM"]["path"].name
== f"sub-{sub}_space-MNI152NLin2009cAsym_label-"
"GM_probseg.nii.gz"
)
assert out["probseg_GM"]["path"].exists()
assert out["probseg_GM"]["path"].is_file()
assert out["VBM_GM"]["path"].exists()
assert out["VBM_GM"]["path"].is_file()
# asserts type "probseg_WM"
assert "probseg_WM" in out
# asserts type "VBM_WM"
assert "VBM_WM" in out
assert (
out["probseg_WM"]["path"].name
out["VBM_WM"]["path"].name
== f"sub-{sub}_space-MNI152NLin2009cAsym_label-"
"WM_probseg.nii.gz"
)
assert out["probseg_WM"]["path"].exists()
assert out["probseg_WM"]["path"].is_file()
assert out["VBM_WM"]["path"].exists()
assert out["VBM_WM"]["path"].is_file()
# asserts type "DWI"
assert "DWI" in out
@ -149,13 +149,13 @@ def test_DataladAOMICPIOP1(tasks: Optional[str]) -> None:
"BOLD",
"BOLD_confounds",
"T1w",
"probseg_CSF",
"probseg_GM",
"probseg_WM",
"VBM_CSF",
"VBM_GM",
"VBM_WM",
"DWI",
["BOLD", "BOLD_confounds"],
["T1w", "probseg_CSF"],
["probseg_GM", "probseg_WM"],
["T1w", "VBM_CSF"],
["VBM_GM", "VBM_WM"],
["DWI", "BOLD"],
],
)

View file

@ -85,41 +85,41 @@ def test_DataladAOMICPIOP2(tasks: Optional[str]) -> None:
# asserts T1w_mask
assert out["T1w_mask"]["path"].exists()
# asserts type "probseg_CSF"
assert "probseg_CSF" in out
# asserts type "VBM_CSF"
assert "VBM_CSF" in out
assert (
out["probseg_CSF"]["path"].name
out["VBM_CSF"]["path"].name
== f"sub-{sub}_space-MNI152NLin2009cAsym_label-"
"CSF_probseg.nii.gz"
)
assert out["probseg_CSF"]["path"].exists()
assert out["probseg_CSF"]["path"].is_file()
assert out["VBM_CSF"]["path"].exists()
assert out["VBM_CSF"]["path"].is_file()
# asserts type "probseg_GM"
assert "probseg_GM" in out
# asserts type "VBM_GM"
assert "VBM_GM" in out
assert (
out["probseg_GM"]["path"].name
out["VBM_GM"]["path"].name
== f"sub-{sub}_space-MNI152NLin2009cAsym_label-"
"GM_probseg.nii.gz"
)
assert out["probseg_GM"]["path"].exists()
assert out["probseg_GM"]["path"].is_file()
assert out["VBM_GM"]["path"].exists()
assert out["VBM_GM"]["path"].is_file()
# asserts type "probseg_WM"
assert "probseg_WM" in out
# asserts type "VBM_WM"
assert "VBM_WM" in out
assert (
out["probseg_WM"]["path"].name
out["VBM_WM"]["path"].name
== f"sub-{sub}_space-MNI152NLin2009cAsym_label-"
"WM_probseg.nii.gz"
)
assert out["probseg_WM"]["path"].exists()
assert out["probseg_WM"]["path"].is_file()
assert out["VBM_WM"]["path"].exists()
assert out["VBM_WM"]["path"].is_file()
# asserts type "DWI"
assert "DWI" in out
@ -143,13 +143,13 @@ def test_DataladAOMICPIOP2(tasks: Optional[str]) -> None:
"BOLD",
"BOLD_confounds",
"T1w",
"probseg_CSF",
"probseg_GM",
"probseg_WM",
"VBM_CSF",
"VBM_GM",
"VBM_WM",
"DWI",
["BOLD", "BOLD_confounds"],
["T1w", "probseg_CSF"],
["probseg_GM", "probseg_WM"],
["T1w", "VBM_CSF"],
["VBM_GM", "VBM_WM"],
["DWI", "BOLD"],
],
)

View file

@ -25,8 +25,8 @@ class DMCC13Benchmark(PatternDataladDataGrabber):
The directory where the datalad dataset will be cloned. If None,
the datalad dataset will be cloned into a temporary directory
(default None).
types: {"BOLD", "BOLD_confounds", "T1w", "probseg_CSF", "probseg_GM", \
"probseg_WM"} or a list of the options, optional
types: {"BOLD", "BOLD_confounds", "T1w", "VBM_CSF", "VBM_GM", \
"VBM_WM"} or a list of the options, optional
DMCC data types. If None, all available data types are selected.
(default None).
sessions: {"wave1bas", "wave1pro", "wave1rea"} or list of the options, \
@ -181,21 +181,21 @@ class DMCC13Benchmark(PatternDataladDataGrabber):
),
"space": "MNI152NLin2009cAsym",
},
"probseg_CSF": {
"VBM_CSF": {
"pattern": (
"derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
"sub-{subject}_space-MNI152NLin2009cAsym_label-CSF_probseg.nii.gz"
),
"space": "MNI152NLin2009cAsym",
},
"probseg_GM": {
"VBM_GM": {
"pattern": (
"derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
"sub-{subject}_space-MNI152NLin2009cAsym_label-GM_probseg.nii.gz"
),
"space": "MNI152NLin2009cAsym",
},
"probseg_WM": {
"VBM_WM": {
"pattern": (
"derivatives/fmriprep-1.3.2/sub-{subject}/anat/"
"sub-{subject}_space-MNI152NLin2009cAsym_label-WM_probseg.nii.gz"

View file

@ -95,9 +95,9 @@ def test_DMCC13Benchmark(
"BOLD",
"BOLD_confounds",
"BOLD_mask",
"probseg_CSF",
"probseg_GM",
"probseg_WM",
"VBM_CSF",
"VBM_GM",
"VBM_WM",
"T1w",
"T1w_mask",
]
@ -159,18 +159,18 @@ def test_DMCC13Benchmark(
("BOLD", False),
("T1w", True),
("T1w", False),
("probseg_CSF", True),
("probseg_CSF", False),
("probseg_GM", True),
("probseg_GM", False),
("probseg_WM", True),
("probseg_WM", False),
("VBM_CSF", True),
("VBM_CSF", False),
("VBM_GM", True),
("VBM_GM", False),
("VBM_WM", True),
("VBM_WM", False),
(["BOLD", "BOLD_confounds"], True),
(["BOLD", "BOLD_confounds"], False),
(["T1w", "probseg_CSF"], True),
(["T1w", "probseg_CSF"], False),
(["probseg_GM", "probseg_WM"], True),
(["probseg_GM", "probseg_WM"], False),
(["T1w", "VBM_CSF"], True),
(["T1w", "VBM_CSF"], False),
(["VBM_GM", "VBM_WM"], True),
(["VBM_GM", "VBM_WM"], False),
],
)
def test_DMCC13Benchmark_partial_data_access(

View file

@ -51,15 +51,7 @@ PATTERNS_SCHEMA = {
"mandatory": ["pattern", "space"],
"optional": [],
},
"probseg_CSF": {
"mandatory": ["pattern", "space"],
"optional": [],
},
"probseg_GM": {
"mandatory": ["pattern", "space"],
"optional": [],
},
"probseg_WM": {
"VBM_CSF": {
"mandatory": ["pattern", "space"],
"optional": [],
},

View file

@ -42,8 +42,8 @@ class ParcelAggregation(BaseMarker):
The specification of the masks to apply to regions before extracting
signals. Check :ref:`Using Masks <using_masks>` for more details.
If None, will not apply any mask (default None).
on : {"T1w", "BOLD", "VBM_GM", "VBM_WM", "fALFF", "GCOR", "LCOR"} \
or list of the options, optional
on : {"T1w", "T2w", "BOLD", "VBM_GM", "VBM_WM", "VBM_CSF", "fALFF", \
"GCOR", "LCOR"} or list of the options, optional
The data types to apply the marker to. If None, will work on all
available data (default None).
name : str, optional
@ -102,7 +102,17 @@ class ParcelAggregation(BaseMarker):
The list of data types that can be used as input for this marker.
"""
return ["T1w", "BOLD", "VBM_GM", "VBM_WM", "fALFF", "GCOR", "LCOR"]
return [
"T1w",
"T2w",
"BOLD",
"VBM_GM",
"VBM_WM",
"VBM_CSF",
"fALFF",
"GCOR",
"LCOR",
]
def get_output_type(self, input_type: str) -> str:
"""Get output type.
synchon commented 2024-04-05 07:45:18 +00:00 (Migrated from github.com)

Worth it to include T2w?

Worth it to include ``T2w``?
fraimondo commented 2024-04-05 09:40:16 +00:00 (Migrated from github.com)

never header of it, but i'll do it.

never header of it, but i'll do it.
synchon commented 2024-04-05 09:58:46 +00:00 (Migrated from github.com)

It's the T2 weighted image.

It's the T2 weighted image.
@ -124,7 +134,14 @@ class ParcelAggregation(BaseMarker):
"""
if input_type in ["VBM_GM", "VBM_WM", "fALFF", "GCOR", "LCOR"]:
if input_type in [
"VBM_GM",
"VBM_WM",
"VBM_CSF",
"fALFF",
"GCOR",
"LCOR",
]:
return "vector"
elif input_type == "BOLD":
return "timeseries"

View file

@ -47,8 +47,8 @@ class SphereAggregation(BaseMarker):
The specification of the masks to apply to regions before extracting
signals. Check :ref:`Using Masks <using_masks>` for more details.
If None, will not apply any mask (default None).
on : {"T1w", "BOLD", "VBM_GM", "VBM_WM", "fALFF", "GCOR", "LCOR"} or \
list of the options, optional
on : {"T1w", "T2w", "BOLD", "VBM_GM", "VBM_WM", "VBM_CSF", "fALFF", \
"GCOR", "LCOR"} or list of the options, optional
The data types to apply the marker to. If None, will work on all
available data (default None).
name : str, optional
@ -109,7 +109,17 @@ class SphereAggregation(BaseMarker):
The list of data types that can be used as input for this marker.
"""
return ["T1w", "BOLD", "VBM_GM", "VBM_WM", "fALFF", "GCOR", "LCOR"]
return [
"T1w",
"T2w",
"BOLD",
"VBM_GM",
"VBM_WM",
"VBM_CSF",
"fALFF",
"GCOR",
"LCOR",
]
def get_output_type(self, input_type: str) -> str:
"""Get output type.
synchon commented 2024-04-05 07:45:46 +00:00 (Migrated from github.com)

Worth it to include T2w?

Worth it to include `T2w`?
@ -131,7 +141,14 @@ class SphereAggregation(BaseMarker):
"""
if input_type in ["VBM_GM", "VBM_WM", "fALFF", "GCOR", "LCOR"]:
if input_type in [
"VBM_GM",
"VBM_WM",
"VBM_CSF",
"fALFF",
"GCOR",
"LCOR",
]:
return "vector"
elif input_type == "BOLD":
return "timeseries"

View file

@ -34,8 +34,8 @@ class SpaceWarper(BasePreprocessor):
type like ``"T1w"`` or a template space like ``"MNI152NLin2009cAsym"``.
Use ``"T1w"`` for native space warping and named templates for
template space warping.
on : {"T1w", "BOLD", "VBM_GM", "VBM_WM", "fALFF", "GCOR", "LCOR"} or list \
of the options
on : {"T1w", "T2w", "BOLD", "VBM_GM", "VBM_WM", "VBM_CSF", "fALFF", \
"GCOR", "LCOR"} or list of the options
The data type to warp.
Raises
@ -98,7 +98,17 @@ class SpaceWarper(BasePreprocessor):
preprocessor.
"""
return ["T1w", "BOLD", "VBM_GM", "VBM_WM", "fALFF", "GCOR", "LCOR"]
return [
"T1w",
"T2w",
"BOLD",
"VBM_GM",
"VBM_WM",
"VBM_CSF",
"fALFF",
"GCOR",
"LCOR",
]
def get_output_type(self, input_type: str) -> str:
"""Get output type.
synchon commented 2024-04-05 07:46:36 +00:00 (Migrated from github.com)

Worth it to include T2w?

Worth it to include `T2w`?