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
@@ -8,52 +8,47 @@
8
8
 
9
9
  from pathlib import Path
10
10
 
11
- from nilearn import image
12
11
  from nilearn.maskers import NiftiLabelsMasker
13
12
 
14
- from junifer.data import load_parcellation
13
+ from junifer.data import get_parcellation
14
+ from junifer.datareader import DefaultDataReader
15
15
  from junifer.markers.ets_rss import RSSETSMarker
16
16
  from junifer.storage import SQLiteFeatureStorage
17
- from junifer.testing.datagrabbers import SPMAuditoryTestingDataGrabber
17
+ from junifer.testing.datagrabbers import PartlyCloudyTestingDataGrabber
18
18
 
19
19
 
20
20
  # Set parcellation
21
- PARCELLATION = "Schaefer100x17"
21
+ PARCELLATION = "TianxS1x3TxMNInonlinear2009cAsym"
22
22
 
23
23
 
24
24
  def test_compute() -> None:
25
25
  """Test RSS ETS compute()."""
26
- with SPMAuditoryTestingDataGrabber() as dg:
27
- # Fetch element
28
- out = dg["sub001"]
29
- # Load BOLD image
30
- niimg = image.load_img(str(out["BOLD"]["path"].absolute()))
31
- # Create input data
32
- input_dict = {
33
- "data": niimg,
34
- "path": out["BOLD"]["path"],
35
- "space": "MNI",
36
- }
26
+ with PartlyCloudyTestingDataGrabber() as dg:
27
+ element_data = DefaultDataReader().fit_transform(dg["sub-01"])
37
28
  # Compute the RSSETSMarker
38
- ets_rss_marker = RSSETSMarker(parcellation=PARCELLATION)
39
- new_out = ets_rss_marker.compute(input_dict)
40
-
41
- # Load parcellation
42
- test_parcellation, _, _, _ = load_parcellation(PARCELLATION)
43
- # Compute the NiftiLabelsMasker
44
- test_masker = NiftiLabelsMasker(test_parcellation)
45
- test_ts = test_masker.fit_transform(niimg)
29
+ marker = RSSETSMarker(parcellation=PARCELLATION)
30
+ rss_ets = marker.compute(element_data["BOLD"])
31
+
32
+ # Compare with nilearn
33
+ # Load testing parcellation
34
+ test_parcellation, _ = get_parcellation(
35
+ parcellation=[PARCELLATION],
36
+ target_data=element_data["BOLD"],
37
+ )
38
+ # Extract timeseries
39
+ nifti_labels_masker = NiftiLabelsMasker(labels_img=test_parcellation)
40
+ extacted_timeseries = nifti_labels_masker.fit_transform(
41
+ element_data["BOLD"]["data"]
42
+ )
46
43
  # Assert the dimension of timeseries
47
- n_time, _ = test_ts.shape
48
- assert n_time == len(new_out["data"])
44
+ assert extacted_timeseries.shape[0] == len(rss_ets["data"])
49
45
 
50
46
 
51
47
  def test_get_output_type() -> None:
52
48
  """Test RSS ETS get_output_type()."""
53
- ets_rss_marker = RSSETSMarker(parcellation=PARCELLATION)
54
- input_ = "BOLD"
55
- output = ets_rss_marker.get_output_type(input_)
56
- assert output == "timeseries"
49
+ assert "timeseries" == RSSETSMarker(
50
+ parcellation=PARCELLATION
51
+ ).get_output_type("BOLD")
57
52
 
58
53
 
59
54
  def test_store(tmp_path: Path) -> None:
@@ -65,20 +60,13 @@ def test_store(tmp_path: Path) -> None:
65
60
  The path to the test directory.
66
61
 
67
62
  """
68
- with SPMAuditoryTestingDataGrabber() as dg:
69
- # Fetch element
70
- elem = dg["sub001"]
71
- # Load BOLD image
72
- niimg = image.load_img(str(elem["BOLD"]["path"].absolute()))
73
- elem["BOLD"]["data"] = niimg
63
+ with PartlyCloudyTestingDataGrabber() as dg:
64
+ element_data = DefaultDataReader().fit_transform(dg["sub-01"])
74
65
  # Compute the RSSETSMarker
75
- ets_rss_marker = RSSETSMarker(parcellation=PARCELLATION)
66
+ marker = RSSETSMarker(parcellation=PARCELLATION)
76
67
  # Create storage
77
- storage = SQLiteFeatureStorage(
78
- uri=str((tmp_path / "test.sqlite").absolute())
79
- )
68
+ storage = SQLiteFeatureStorage(tmp_path / "test_rss_ets.sqlite")
80
69
  # Store
81
- ets_rss_marker.fit_transform(input=elem, storage=storage)
82
-
70
+ marker.fit_transform(input=element_data, storage=storage)
83
71
  features = storage.list_features()
84
72
  assert any(x["name"] == "BOLD_RSSETSMarker" for x in features.values())