junifer 0.0.4.dev733__py3-none-any.whl → 0.0.4.dev782__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. junifer/_version.py +2 -2
  2. junifer/api/tests/data/partly_cloudy_agg_mean_tian.yml +16 -0
  3. junifer/api/tests/test_cli.py +7 -13
  4. junifer/api/tests/test_functions.py +156 -102
  5. junifer/data/coordinates.py +1 -1
  6. junifer/data/masks.py +213 -54
  7. junifer/data/parcellations.py +91 -42
  8. junifer/data/template_spaces.py +33 -6
  9. junifer/data/tests/test_masks.py +127 -62
  10. junifer/data/tests/test_parcellations.py +66 -49
  11. junifer/data/tests/test_template_spaces.py +42 -7
  12. junifer/datagrabber/aomic/id1000.py +3 -0
  13. junifer/datagrabber/aomic/piop1.py +3 -0
  14. junifer/datagrabber/aomic/piop2.py +3 -0
  15. junifer/datagrabber/dmcc13_benchmark.py +3 -0
  16. junifer/datagrabber/hcp1200/hcp1200.py +3 -0
  17. junifer/markers/falff/tests/test_falff_parcels.py +3 -3
  18. junifer/markers/falff/tests/test_falff_spheres.py +3 -3
  19. junifer/markers/functional_connectivity/tests/test_crossparcellation_functional_connectivity.py +46 -45
  20. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +34 -41
  21. junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +40 -56
  22. junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +62 -74
  23. junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +99 -89
  24. junifer/markers/reho/tests/test_reho_parcels.py +17 -11
  25. junifer/markers/temporal_snr/tests/test_temporal_snr_parcels.py +38 -37
  26. junifer/markers/temporal_snr/tests/test_temporal_snr_spheres.py +34 -38
  27. junifer/markers/tests/test_collection.py +38 -37
  28. junifer/markers/tests/test_ets_rss.py +29 -41
  29. junifer/markers/tests/test_parcel_aggregation.py +600 -511
  30. junifer/markers/tests/test_sphere_aggregation.py +209 -163
  31. {junifer-0.0.4.dev733.dist-info → junifer-0.0.4.dev782.dist-info}/METADATA +1 -1
  32. {junifer-0.0.4.dev733.dist-info → junifer-0.0.4.dev782.dist-info}/RECORD +37 -36
  33. {junifer-0.0.4.dev733.dist-info → junifer-0.0.4.dev782.dist-info}/AUTHORS.rst +0 -0
  34. {junifer-0.0.4.dev733.dist-info → junifer-0.0.4.dev782.dist-info}/LICENSE.md +0 -0
  35. {junifer-0.0.4.dev733.dist-info → junifer-0.0.4.dev782.dist-info}/WHEEL +0 -0
  36. {junifer-0.0.4.dev733.dist-info → junifer-0.0.4.dev782.dist-info}/entry_points.txt +0 -0
  37. {junifer-0.0.4.dev733.dist-info → junifer-0.0.4.dev782.dist-info}/top_level.txt +0 -0
@@ -3,21 +3,24 @@
3
3
  # Authors: Amir Omidvarnia <a.omidvarnia@fz-juelich.de>
4
4
  # Kaustubh R. Patil <k.patil@fz-juelich.de>
5
5
  # Federico Raimondo <f.raimondo@fz-juelich.de>
6
+ # Synchon Mandal <s.mandal@fz-juelich.de>
6
7
  # License: AGPL
7
8
 
8
9
  from pathlib import Path
9
10
 
10
11
  import pytest
11
- from nilearn import datasets, image
12
12
  from nilearn.connectome import ConnectivityMeasure
13
+ from nilearn.maskers import NiftiSpheresMasker
13
14
  from numpy.testing import assert_array_almost_equal
14
15
  from sklearn.covariance import EmpiricalCovariance
15
16
 
17
+ from junifer.data import get_coordinates
18
+ from junifer.datareader import DefaultDataReader
16
19
  from junifer.markers.functional_connectivity import (
17
20
  FunctionalConnectivitySpheres,
18
21
  )
19
- from junifer.markers.sphere_aggregation import SphereAggregation
20
22
  from junifer.storage import SQLiteFeatureStorage
23
+ from junifer.testing.datagrabbers import SPMAuditoryTestingDataGrabber
21
24
 
22
25
 
23
26
  def test_FunctionalConnectivitySpheres(tmp_path: Path) -> None:
@@ -29,56 +32,57 @@ def test_FunctionalConnectivitySpheres(tmp_path: Path) -> None:
29
32
  The path to the test directory.
30
33
 
31
34
  """
32
- # get a dataset
33
- ni_data = datasets.fetch_spm_auditory(subject_id="sub001")
34
- fmri_img = image.concat_imgs(ni_data.func) # type: ignore
35
-
36
- fc = FunctionalConnectivitySpheres(
37
- coords="DMNBuckner", radius=5.0, cor_method="correlation"
38
- )
39
- all_out = fc.fit_transform(
40
- {"BOLD": {"data": fmri_img, "meta": {}, "space": "MNI"}}
41
- )
42
-
43
- out = all_out["BOLD"]
44
-
45
- assert "data" in out
46
- assert "row_names" in out
47
- assert "col_names" in out
48
- assert out["data"].shape[0] == 6
49
- assert out["data"].shape[1] == 6
50
- assert len(set(out["row_names"])) == 6
51
- assert len(set(out["col_names"])) == 6
52
-
53
- # get the timeseries using sa
54
- sa = SphereAggregation(
55
- coords="DMNBuckner", radius=5.0, method="mean", on="BOLD"
56
- )
57
- ts = sa.compute({"data": fmri_img, "meta": {}, "space": "MNI"})
58
-
59
- # Check that FC are almost equal when using nileran
60
- cm = ConnectivityMeasure(kind="correlation")
61
- out_ni = cm.fit_transform([ts["data"]])[0]
62
- assert_array_almost_equal(out_ni, out["data"], decimal=3)
63
-
64
- # check correct output
65
- assert fc.get_output_type("BOLD") == "matrix"
66
-
67
- uri = tmp_path / "test_fc_parcel.sqlite"
68
- # Single storage, must be the uri
69
- storage = SQLiteFeatureStorage(uri=uri, upsert="ignore")
70
- meta = {
71
- "element": {"subject": "test"},
72
- "dependencies": {"numpy", "nilearn"},
73
- }
74
- input = {"BOLD": {"data": fmri_img, "meta": meta, "space": "MNI"}}
75
- all_out = fc.fit_transform(input, storage=storage)
76
-
77
- features = storage.list_features()
78
- assert any(
79
- x["name"] == "BOLD_FunctionalConnectivitySpheres"
80
- for x in features.values()
81
- )
35
+ with SPMAuditoryTestingDataGrabber() as dg:
36
+ element_data = DefaultDataReader().fit_transform(dg["sub001"])
37
+ marker = FunctionalConnectivitySpheres(
38
+ coords="DMNBuckner", radius=5.0, cor_method="correlation"
39
+ )
40
+ # Check correct output
41
+ assert marker.get_output_type("BOLD") == "matrix"
42
+
43
+ # Fit-transform the data
44
+ fc = marker.fit_transform(element_data)
45
+ fc_bold = fc["BOLD"]
46
+
47
+ assert "data" in fc_bold
48
+ assert "row_names" in fc_bold
49
+ assert "col_names" in fc_bold
50
+ assert fc_bold["data"].shape == (6, 6)
51
+ assert len(set(fc_bold["row_names"])) == 6
52
+ assert len(set(fc_bold["col_names"])) == 6
53
+
54
+ # Compare with nilearn
55
+ # Load testing coordinates for the target data
56
+ testing_coords, _ = get_coordinates(
57
+ coords="DMNBuckner", target_data=element_data["BOLD"]
58
+ )
59
+ # Extract timeseries
60
+ nifti_spheres_masker = NiftiSpheresMasker(
61
+ seeds=testing_coords, radius=5.0
62
+ )
63
+ extracted_timeseries = nifti_spheres_masker.fit_transform(
64
+ element_data["BOLD"]["data"]
65
+ )
66
+ # Compute the connectivity measure
67
+ connectivity_measure = ConnectivityMeasure(
68
+ kind="correlation"
69
+ ).fit_transform([extracted_timeseries])[0]
70
+
71
+ # Check that FC are almost equal
72
+ assert_array_almost_equal(
73
+ connectivity_measure, fc_bold["data"], decimal=3
74
+ )
75
+
76
+ # Store
77
+ storage = SQLiteFeatureStorage(
78
+ uri=tmp_path / "test_fc_spheres.sqlite", upsert="ignore"
79
+ )
80
+ marker.fit_transform(input=element_data, storage=storage)
81
+ features = storage.list_features()
82
+ assert any(
83
+ x["name"] == "BOLD_FunctionalConnectivitySpheres"
84
+ for x in features.values()
85
+ )
82
86
 
83
87
 
84
88
  def test_FunctionalConnectivitySpheres_empirical(tmp_path: Path) -> None:
@@ -90,43 +94,49 @@ def test_FunctionalConnectivitySpheres_empirical(tmp_path: Path) -> None:
90
94
  The path to the test directory.
91
95
 
92
96
  """
93
-
94
- # get a dataset
95
- ni_data = datasets.fetch_spm_auditory(subject_id="sub001")
96
- fmri_img = image.concat_imgs(ni_data.func) # type: ignore
97
-
98
- fc = FunctionalConnectivitySpheres(
99
- coords="DMNBuckner",
100
- radius=5.0,
101
- cor_method="correlation",
102
- cor_method_params={"empirical": True},
103
- )
104
- all_out = fc.fit_transform(
105
- {"BOLD": {"data": fmri_img, "meta": {}, "space": "MNI"}}
106
- )
107
-
108
- out = all_out["BOLD"]
109
-
110
- assert "data" in out
111
- assert "row_names" in out
112
- assert "col_names" in out
113
- assert out["data"].shape[0] == 6
114
- assert out["data"].shape[1] == 6
115
- assert len(set(out["row_names"])) == 6
116
- assert len(set(out["col_names"])) == 6
117
-
118
- # get the timeseries using sa
119
- sa = SphereAggregation(
120
- coords="DMNBuckner", radius=5.0, method="mean", on="BOLD"
121
- )
122
- ts = sa.compute({"data": fmri_img, "space": "MNI"})
123
-
124
- # Check that FC are almost equal when using nileran
125
- cm = ConnectivityMeasure(
126
- cov_estimator=EmpiricalCovariance(), kind="correlation" # type: ignore
127
- )
128
- out_ni = cm.fit_transform([ts["data"]])[0]
129
- assert_array_almost_equal(out_ni, out["data"], decimal=3)
97
+ with SPMAuditoryTestingDataGrabber() as dg:
98
+ element_data = DefaultDataReader().fit_transform(dg["sub001"])
99
+ marker = FunctionalConnectivitySpheres(
100
+ coords="DMNBuckner",
101
+ radius=5.0,
102
+ cor_method="correlation",
103
+ cor_method_params={"empirical": True},
104
+ )
105
+ # Check correct output
106
+ assert marker.get_output_type("BOLD") == "matrix"
107
+
108
+ # Fit-transform the data
109
+ fc = marker.fit_transform(element_data)
110
+ fc_bold = fc["BOLD"]
111
+
112
+ assert "data" in fc_bold
113
+ assert "row_names" in fc_bold
114
+ assert "col_names" in fc_bold
115
+ assert fc_bold["data"].shape == (6, 6)
116
+ assert len(set(fc_bold["row_names"])) == 6
117
+ assert len(set(fc_bold["col_names"])) == 6
118
+
119
+ # Compare with nilearn
120
+ # Load testing coordinates for the target data
121
+ testing_coords, _ = get_coordinates(
122
+ coords="DMNBuckner", target_data=element_data["BOLD"]
123
+ )
124
+ # Extract timeseries
125
+ nifti_spheres_masker = NiftiSpheresMasker(
126
+ seeds=testing_coords, radius=5.0
127
+ )
128
+ extracted_timeseries = nifti_spheres_masker.fit_transform(
129
+ element_data["BOLD"]["data"]
130
+ )
131
+ # Compute the connectivity measure
132
+ connectivity_measure = ConnectivityMeasure(
133
+ cov_estimator=EmpiricalCovariance(), kind="correlation" # type: ignore
134
+ ).fit_transform([extracted_timeseries])[0]
135
+
136
+ # Check that FC are almost equal
137
+ assert_array_almost_equal(
138
+ connectivity_measure, fc_bold["data"], decimal=3
139
+ )
130
140
 
131
141
 
132
142
  def test_FunctionalConnectivitySpheres_error() -> None:
@@ -12,12 +12,12 @@ import scipy as sp
12
12
  from junifer.datareader import DefaultDataReader
13
13
  from junifer.markers import ReHoParcels
14
14
  from junifer.pipeline import WorkDirManager
15
- from junifer.pipeline.utils import _check_afni
15
+ from junifer.pipeline.utils import _check_afni, _check_ants
16
16
  from junifer.storage import SQLiteFeatureStorage
17
- from junifer.testing.datagrabbers import SPMAuditoryTestingDataGrabber
18
-
19
-
20
- PARCELLATION = "Schaefer100x7"
17
+ from junifer.testing.datagrabbers import (
18
+ PartlyCloudyTestingDataGrabber,
19
+ SPMAuditoryTestingDataGrabber,
20
+ )
21
21
 
22
22
 
23
23
  def test_ReHoParcels(caplog: pytest.LogCaptureFixture, tmp_path: Path) -> None:
@@ -32,13 +32,16 @@ def test_ReHoParcels(caplog: pytest.LogCaptureFixture, tmp_path: Path) -> None:
32
32
 
33
33
  """
34
34
  with caplog.at_level(logging.DEBUG):
35
- with SPMAuditoryTestingDataGrabber() as dg:
36
- element_data = DefaultDataReader().fit_transform(dg["sub001"])
35
+ with PartlyCloudyTestingDataGrabber() as dg:
36
+ element_data = DefaultDataReader().fit_transform(dg["sub-01"])
37
37
  # Update workdir to current test's tmp_path
38
38
  WorkDirManager().workdir = tmp_path
39
39
 
40
40
  # Initialize marker
41
- marker = ReHoParcels(parcellation=PARCELLATION, using="junifer")
41
+ marker = ReHoParcels(
42
+ parcellation="TianxS1x3TxMNInonlinear2009cAsym",
43
+ using="junifer",
44
+ )
42
45
  # Fit transform marker on data
43
46
  output = marker.fit_transform(element_data)
44
47
 
@@ -72,6 +75,9 @@ def test_ReHoParcels(caplog: pytest.LogCaptureFixture, tmp_path: Path) -> None:
72
75
  assert "Creating cache" not in caplog.text
73
76
 
74
77
 
78
+ @pytest.mark.skipif(
79
+ _check_ants() is False, reason="requires ANTs to be in PATH"
80
+ )
75
81
  @pytest.mark.skipif(
76
82
  _check_afni() is False, reason="requires AFNI to be in PATH"
77
83
  )
@@ -91,7 +97,7 @@ def test_ReHoParcels_comparison(tmp_path: Path) -> None:
91
97
 
92
98
  # Initialize marker
93
99
  junifer_marker = ReHoParcels(
94
- parcellation=PARCELLATION, using="junifer"
100
+ parcellation="Schaefer100x7", using="junifer"
95
101
  )
96
102
  # Fit transform marker on data
97
103
  junifer_output = junifer_marker.fit_transform(element_data)
@@ -99,7 +105,7 @@ def test_ReHoParcels_comparison(tmp_path: Path) -> None:
99
105
  junifer_output_bold = junifer_output["BOLD"]
100
106
 
101
107
  # Initialize marker
102
- afni_marker = ReHoParcels(parcellation=PARCELLATION, using="afni")
108
+ afni_marker = ReHoParcels(parcellation="Schaefer100x7", using="afni")
103
109
  # Fit transform marker on data
104
110
  afni_output = afni_marker.fit_transform(element_data)
105
111
  # Get BOLD output
@@ -110,4 +116,4 @@ def test_ReHoParcels_comparison(tmp_path: Path) -> None:
110
116
  junifer_output_bold["data"].flatten(),
111
117
  afni_output_bold["data"].flatten(),
112
118
  )
113
- assert r >= 0.3 # this is very bad, but they differ...
119
+ assert r >= 0.2 # this is very bad, but they differ...
@@ -1,18 +1,39 @@
1
1
  """Provide tests for temporal signal-to-noise ratio using parcellation."""
2
2
 
3
3
  # Authors: Leonard Sasse <l.sasse@fz-juelich.de>
4
+ # Synchon Mandal <s.mandal@fz-juelich.de>
4
5
  # License: AGPL
5
6
 
6
7
  from pathlib import Path
7
8
 
8
- from nilearn import datasets, image
9
-
9
+ from junifer.datareader import DefaultDataReader
10
10
  from junifer.markers.temporal_snr import TemporalSNRParcels
11
- from junifer.storage import SQLiteFeatureStorage
11
+ from junifer.storage import HDF5FeatureStorage
12
+ from junifer.testing.datagrabbers import PartlyCloudyTestingDataGrabber
13
+
14
+
15
+ def test_TemporalSNRParcels_computation() -> None:
16
+ """Test TemporalSNRParcels fit-transform."""
17
+ with PartlyCloudyTestingDataGrabber() as dg:
18
+ element_data = DefaultDataReader().fit_transform(dg["sub-01"])
19
+ marker = TemporalSNRParcels(
20
+ parcellation="TianxS1x3TxMNInonlinear2009cAsym"
21
+ )
22
+ # Check correct output
23
+ assert marker.get_output_type("BOLD") == "vector"
24
+
25
+ # Fit-transform the data
26
+ tsnr_parcels = marker.fit_transform(element_data)
27
+ tsnr_parcels_bold = tsnr_parcels["BOLD"]
28
+
29
+ assert "data" in tsnr_parcels_bold
30
+ assert "col_names" in tsnr_parcels_bold
31
+ assert tsnr_parcels_bold["data"].shape == (1, 16)
32
+ assert len(set(tsnr_parcels_bold["col_names"])) == 16
12
33
 
13
34
 
14
- def test_TemporalSNRParcels(tmp_path: Path) -> None:
15
- """Test TemporalSNRParcels.
35
+ def test_TemporalSNRParcels_storage(tmp_path: Path) -> None:
36
+ """Test TemporalSNRParcels store.
16
37
 
17
38
  Parameters
18
39
  ----------
@@ -20,35 +41,15 @@ def test_TemporalSNRParcels(tmp_path: Path) -> None:
20
41
  The path to the test directory.
21
42
 
22
43
  """
23
- # get a dataset
24
- ni_data = datasets.fetch_spm_auditory(subject_id="sub001")
25
- fmri_img = image.concat_imgs(ni_data.func) # type: ignore
26
-
27
- tsnr_parcels = TemporalSNRParcels(parcellation="Schaefer100x7")
28
- all_out = tsnr_parcels.fit_transform(
29
- {"BOLD": {"data": fmri_img, "meta": {}, "space": "MNI"}}
30
- )
31
-
32
- out = all_out["BOLD"]
33
-
34
- assert "data" in out
35
- assert "col_names" in out
36
-
37
- assert out["data"].shape[0] == 1
38
- assert out["data"].shape[1] == 100
39
- assert len(set(out["col_names"])) == 100
40
-
41
- # check correct output
42
- assert tsnr_parcels.get_output_type("BOLD") == "vector"
43
-
44
- uri = tmp_path / "test_tsnr_parcellation.sqlite"
45
- # Single storage, must be the uri
46
- storage = SQLiteFeatureStorage(uri=uri, upsert="ignore")
47
- meta = {"element": {"subject": "test"}, "dependencies": {"numpy"}}
48
- input = {"BOLD": {"data": fmri_img, "meta": meta, "space": "MNI"}}
49
- all_out = tsnr_parcels.fit_transform(input, storage=storage)
50
-
51
- features = storage.list_features()
52
- assert any(
53
- x["name"] == "BOLD_TemporalSNRParcels" for x in features.values()
54
- )
44
+ with PartlyCloudyTestingDataGrabber() as dg:
45
+ element_data = DefaultDataReader().fit_transform(dg["sub-01"])
46
+ marker = TemporalSNRParcels(
47
+ parcellation="TianxS1x3TxMNInonlinear2009cAsym"
48
+ )
49
+ # Store
50
+ storage = HDF5FeatureStorage(tmp_path / "test_tsnr_parcels.hdf5")
51
+ marker.fit_transform(input=element_data, storage=storage)
52
+ features = storage.list_features()
53
+ assert any(
54
+ x["name"] == "BOLD_TemporalSNRParcels" for x in features.values()
55
+ )
@@ -1,19 +1,39 @@
1
1
  """Provide tests for temporal signal-to-noise spheres."""
2
2
 
3
3
  # Authors: Leonard Sasse <l.sasse@fz-juelich.de>
4
+ # Synchon Mandal <s.mandal@fz-juelich.de>
4
5
  # License: AGPL
5
6
 
6
7
  from pathlib import Path
7
8
 
8
9
  import pytest
9
- from nilearn import datasets, image
10
10
 
11
+ from junifer.datareader import DefaultDataReader
11
12
  from junifer.markers.temporal_snr import TemporalSNRSpheres
12
- from junifer.storage import SQLiteFeatureStorage
13
+ from junifer.storage import HDF5FeatureStorage
14
+ from junifer.testing.datagrabbers import SPMAuditoryTestingDataGrabber
13
15
 
14
16
 
15
- def test_TemporalSNRSpheres(tmp_path: Path) -> None:
16
- """Test TemporalSNRSpheres.
17
+ def test_TemporalSNRSpheres_computation() -> None:
18
+ """Test TemporalSNRSpheres fit-transform."""
19
+ with SPMAuditoryTestingDataGrabber() as dg:
20
+ element_data = DefaultDataReader().fit_transform(dg["sub001"])
21
+ marker = TemporalSNRSpheres(coords="DMNBuckner", radius=5.0)
22
+ # Check correct output
23
+ assert marker.get_output_type("BOLD") == "vector"
24
+
25
+ # Fit-transform the data
26
+ tsnr_spheres = marker.fit_transform(element_data)
27
+ tsnr_spheres_bold = tsnr_spheres["BOLD"]
28
+
29
+ assert "data" in tsnr_spheres_bold
30
+ assert "col_names" in tsnr_spheres_bold
31
+ assert tsnr_spheres_bold["data"].shape == (1, 6)
32
+ assert len(set(tsnr_spheres_bold["col_names"])) == 6
33
+
34
+
35
+ def test_TemporalSNRSpheres_storage(tmp_path: Path) -> None:
36
+ """Test TemporalSNRSpheres store.
17
37
 
18
38
  Parameters
19
39
  ----------
@@ -21,40 +41,16 @@ def test_TemporalSNRSpheres(tmp_path: Path) -> None:
21
41
  The path to the test directory.
22
42
 
23
43
  """
24
- # get a dataset
25
- ni_data = datasets.fetch_spm_auditory(subject_id="sub001")
26
- fmri_img = image.concat_imgs(ni_data.func) # type: ignore
27
-
28
- tsnr_spheres = TemporalSNRSpheres(coords="DMNBuckner", radius=5.0)
29
- all_out = tsnr_spheres.fit_transform(
30
- {"BOLD": {"data": fmri_img, "meta": {}, "space": "MNI"}}
31
- )
32
-
33
- out = all_out["BOLD"]
34
-
35
- assert "data" in out
36
- assert "col_names" in out
37
- assert out["data"].shape[0] == 1
38
- assert out["data"].shape[1] == 6
39
- assert len(set(out["col_names"])) == 6
40
-
41
- # check correct output
42
- assert tsnr_spheres.get_output_type("BOLD") == "vector"
43
-
44
- uri = tmp_path / "test_tsnr_coords.sqlite"
45
- # Single storage, must be the uri
46
- storage = SQLiteFeatureStorage(uri=uri, upsert="ignore")
47
- meta = {
48
- "element": {"subject": "test"},
49
- "dependencies": {"numpy", "nilearn"},
50
- }
51
- input = {"BOLD": {"data": fmri_img, "meta": meta, "space": "MNI"}}
52
- all_out = tsnr_spheres.fit_transform(input, storage=storage)
53
-
54
- features = storage.list_features()
55
- assert any(
56
- x["name"] == "BOLD_TemporalSNRSpheres" for x in features.values()
57
- )
44
+ with SPMAuditoryTestingDataGrabber() as dg:
45
+ element_data = DefaultDataReader().fit_transform(dg["sub001"])
46
+ marker = TemporalSNRSpheres(coords="DMNBuckner", radius=5.0)
47
+ # Store
48
+ storage = HDF5FeatureStorage(tmp_path / "test_tsnr_spheres.hdf5")
49
+ marker.fit_transform(input=element_data, storage=storage)
50
+ features = storage.list_features()
51
+ assert any(
52
+ x["name"] == "BOLD_TemporalSNRSpheres" for x in features.values()
53
+ )
58
54
 
59
55
 
60
56
  def test_TemporalSNRSpheres_error() -> None:
@@ -19,7 +19,6 @@ from junifer.pipeline import PipelineStepMixin
19
19
  from junifer.preprocess import fMRIPrepConfoundRemover
20
20
  from junifer.storage import SQLiteFeatureStorage
21
21
  from junifer.testing.datagrabbers import (
22
- OasisVBMTestingDataGrabber,
23
22
  PartlyCloudyTestingDataGrabber,
24
23
  )
25
24
 
@@ -46,20 +45,20 @@ def test_marker_collection() -> None:
46
45
  """Test MarkerCollection."""
47
46
  markers = [
48
47
  ParcelAggregation(
49
- parcellation="Schaefer100x7",
48
+ parcellation="TianxS2x3TxMNInonlinear2009cAsym",
50
49
  method="mean",
51
- name="gmd_schaefer100x7_mean",
50
+ name="tian_mean",
52
51
  ),
53
52
  ParcelAggregation(
54
- parcellation="Schaefer100x7",
53
+ parcellation="TianxS2x3TxMNInonlinear2009cAsym",
55
54
  method="std",
56
- name="gmd_schaefer100x7_std",
55
+ name="tian_std",
57
56
  ),
58
57
  ParcelAggregation(
59
- parcellation="Schaefer100x7",
58
+ parcellation="TianxS2x3TxMNInonlinear2009cAsym",
60
59
  method="trim_mean",
61
60
  method_params={"proportiontocut": 0.1},
62
- name="gmd_schaefer100x7_trim_mean90",
61
+ name="tian_trim_mean90",
63
62
  ),
64
63
  ]
65
64
  mc = MarkerCollection(markers=markers) # type: ignore
@@ -69,7 +68,7 @@ def test_marker_collection() -> None:
69
68
  assert isinstance(mc._datareader, DefaultDataReader)
70
69
 
71
70
  # Create testing datagrabber
72
- dg = OasisVBMTestingDataGrabber()
71
+ dg = PartlyCloudyTestingDataGrabber()
73
72
  mc.validate(dg)
74
73
 
75
74
  with dg:
@@ -78,17 +77,17 @@ def test_marker_collection() -> None:
78
77
  assert out is not None
79
78
  assert isinstance(out, dict)
80
79
  assert len(out) == 3
81
- assert "gmd_schaefer100x7_mean" in out
82
- assert "gmd_schaefer100x7_std" in out
83
- assert "gmd_schaefer100x7_trim_mean90" in out
80
+ assert "tian_mean" in out
81
+ assert "tian_std" in out
82
+ assert "tian_trim_mean90" in out
84
83
 
85
84
  for t_marker in markers:
86
85
  t_name = t_marker.name
87
- assert "VBM_GM" in out[t_name]
88
- t_vbm = out[t_name]["VBM_GM"]
89
- assert "data" in t_vbm
90
- assert "col_names" in t_vbm
91
- assert "meta" in t_vbm
86
+ assert "BOLD" in out[t_name]
87
+ t_bold = out[t_name]["BOLD"]
88
+ assert "data" in t_bold
89
+ assert "col_names" in t_bold
90
+ assert "meta" in t_bold
92
91
 
93
92
  # Test preprocessing
94
93
  class BypassPreprocessing(PipelineStepMixin):
@@ -108,7 +107,7 @@ def test_marker_collection() -> None:
108
107
  for t_marker in markers:
109
108
  t_name = t_marker.name
110
109
  assert_array_equal(
111
- out[t_name]["VBM_GM"]["data"], out2[t_name]["VBM_GM"]["data"]
110
+ out[t_name]["BOLD"]["data"], out2[t_name]["BOLD"]["data"]
112
111
  )
113
112
 
114
113
 
@@ -151,27 +150,28 @@ def test_marker_collection_storage(tmp_path: Path) -> None:
151
150
  """
152
151
  markers = [
153
152
  ParcelAggregation(
154
- parcellation="Schaefer100x7",
153
+ parcellation="TianxS2x3TxMNInonlinear2009cAsym",
155
154
  method="mean",
156
- name="gmd_schaefer100x7_mean",
155
+ name="tian_mean",
157
156
  ),
158
157
  ParcelAggregation(
159
- parcellation="Schaefer100x7",
158
+ parcellation="TianxS2x3TxMNInonlinear2009cAsym",
160
159
  method="std",
161
- name="gmd_schaefer100x7_std",
160
+ name="tian_std",
162
161
  ),
163
162
  ParcelAggregation(
164
- parcellation="Schaefer100x7",
163
+ parcellation="TianxS2x3TxMNInonlinear2009cAsym",
165
164
  method="trim_mean",
166
165
  method_params={"proportiontocut": 0.1},
167
- name="gmd_schaefer100x7_trim_mean90",
166
+ name="tian_trim_mean90",
168
167
  ),
169
168
  ]
170
- # Test storage
171
- dg = OasisVBMTestingDataGrabber()
172
-
173
- uri = tmp_path / "test_marker_collection_storage.sqlite"
174
- storage = SQLiteFeatureStorage(uri=uri)
169
+ # Setup datagrabber
170
+ dg = PartlyCloudyTestingDataGrabber()
171
+ # Setup storage
172
+ storage = SQLiteFeatureStorage(
173
+ tmp_path / "test_marker_collection_storage.sqlite"
174
+ )
175
175
  mc = MarkerCollection(
176
176
  markers=markers, # type: ignore
177
177
  storage=storage,
@@ -197,23 +197,24 @@ def test_marker_collection_storage(tmp_path: Path) -> None:
197
197
 
198
198
  features = storage.list_features()
199
199
  assert len(features) == 3
200
+
200
201
  feature_md5 = next(iter(features.keys()))
201
202
  t_feature = storage.read_df(feature_md5=feature_md5)
202
- fname = "gmd_schaefer100x7_mean"
203
- t_data = out[fname]["VBM_GM"]["data"] # type: ignore
204
- cols = out[fname]["VBM_GM"]["col_names"] # type: ignore
203
+ fname = "tian_mean"
204
+ t_data = out[fname]["BOLD"]["data"] # type: ignore
205
+ cols = out[fname]["BOLD"]["col_names"] # type: ignore
205
206
  assert_array_equal(t_feature[cols].values, t_data) # type: ignore
206
207
 
207
208
  feature_md5 = list(features.keys())[1]
208
209
  t_feature = storage.read_df(feature_md5=feature_md5)
209
- fname = "gmd_schaefer100x7_std"
210
- t_data = out[fname]["VBM_GM"]["data"] # type: ignore
211
- cols = out[fname]["VBM_GM"]["col_names"] # type: ignore
210
+ fname = "tian_std"
211
+ t_data = out[fname]["BOLD"]["data"] # type: ignore
212
+ cols = out[fname]["BOLD"]["col_names"] # type: ignore
212
213
  assert_array_equal(t_feature[cols].values, t_data) # type: ignore
213
214
 
214
215
  feature_md5 = list(features.keys())[2]
215
216
  t_feature = storage.read_df(feature_md5=feature_md5)
216
- fname = "gmd_schaefer100x7_trim_mean90"
217
- t_data = out[fname]["VBM_GM"]["data"] # type: ignore
218
- cols = out[fname]["VBM_GM"]["col_names"] # type: ignore
217
+ fname = "tian_trim_mean90"
218
+ t_data = out[fname]["BOLD"]["data"] # type: ignore
219
+ cols = out[fname]["BOLD"]["col_names"] # type: ignore
219
220
  assert_array_equal(t_feature[cols].values, t_data) # type: ignore