junifer 0.0.2.dev138__py3-none-any.whl → 0.0.2.dev140__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 (38) hide show
  1. junifer/_version.py +2 -2
  2. junifer/data/masks.py +102 -30
  3. junifer/data/tests/test_masks.py +166 -8
  4. junifer/datagrabber/aomic/id1000.py +33 -1
  5. junifer/datagrabber/aomic/piop1.py +14 -0
  6. junifer/datagrabber/aomic/piop2.py +35 -1
  7. junifer/datagrabber/aomic/tests/test_id1000.py +6 -0
  8. junifer/datagrabber/aomic/tests/test_piop1.py +6 -0
  9. junifer/datagrabber/aomic/tests/test_piop2.py +6 -1
  10. junifer/markers/ets_rss.py +8 -8
  11. junifer/markers/falff/falff_parcels.py +7 -7
  12. junifer/markers/falff/falff_spheres.py +8 -8
  13. junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +8 -8
  14. junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +7 -7
  15. junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +8 -8
  16. junifer/markers/functional_connectivity/functional_connectivity_base.py +7 -7
  17. junifer/markers/functional_connectivity/functional_connectivity_parcels.py +7 -7
  18. junifer/markers/functional_connectivity/functional_connectivity_spheres.py +8 -8
  19. junifer/markers/functional_connectivity/tests/test_functional_connectivity_base.py +4 -2
  20. junifer/markers/parcel_aggregation.py +11 -9
  21. junifer/markers/reho/reho_parcels.py +8 -8
  22. junifer/markers/reho/reho_spheres.py +8 -8
  23. junifer/markers/sphere_aggregation.py +11 -9
  24. junifer/markers/tests/test_collection.py +8 -6
  25. junifer/markers/tests/test_marker_utils.py +2 -1
  26. junifer/markers/tests/test_parcel_aggregation.py +2 -2
  27. junifer/markers/tests/test_sphere_aggregation.py +1 -1
  28. junifer/markers/utils.py +10 -10
  29. junifer/preprocess/base.py +11 -1
  30. junifer/preprocess/confounds/fmriprep_confound_remover.py +31 -24
  31. junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +59 -3
  32. {junifer-0.0.2.dev138.dist-info → junifer-0.0.2.dev140.dist-info}/METADATA +1 -1
  33. {junifer-0.0.2.dev138.dist-info → junifer-0.0.2.dev140.dist-info}/RECORD +38 -38
  34. {junifer-0.0.2.dev138.dist-info → junifer-0.0.2.dev140.dist-info}/AUTHORS.rst +0 -0
  35. {junifer-0.0.2.dev138.dist-info → junifer-0.0.2.dev140.dist-info}/LICENSE.md +0 -0
  36. {junifer-0.0.2.dev138.dist-info → junifer-0.0.2.dev140.dist-info}/WHEEL +0 -0
  37. {junifer-0.0.2.dev138.dist-info → junifer-0.0.2.dev140.dist-info}/entry_points.txt +0 -0
  38. {junifer-0.0.2.dev138.dist-info → junifer-0.0.2.dev140.dist-info}/top_level.txt +0 -0
@@ -32,10 +32,10 @@ class RSSETSMarker(BaseMarker):
32
32
  agg_method_params : dict, optional
33
33
  Parameters to pass to the aggregation function. Check valid options in
34
34
  :func:`junifer.stats.get_aggfunc_by_name` (default None).
35
- mask : str, optional
36
- The name of the mask to apply to regions before extracting signals.
37
- Check valid options by calling :func:`junifer.data.masks.list_masks`
38
- (default None).
35
+ masks : str, dict or list of dict or str, optional
36
+ The specification of the masks to apply to regions before extracting
37
+ signals. Check :ref:`Using Masks <using_masks>` for more details.
38
+ If None, will not apply any mask (default None).
39
39
  name : str, optional
40
40
  The name of the marker. If None, will use the class name (default
41
41
  None).
@@ -49,13 +49,13 @@ class RSSETSMarker(BaseMarker):
49
49
  parcellation: Union[str, List[str]],
50
50
  agg_method: str = "mean",
51
51
  agg_method_params: Optional[Dict] = None,
52
- mask: Union[str, Dict, None] = None,
52
+ masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
53
53
  name: Optional[str] = None,
54
54
  ) -> None:
55
55
  self.parcellation = parcellation
56
56
  self.agg_method = agg_method
57
57
  self.agg_method_params = agg_method_params
58
- self.mask = mask
58
+ self.masks = masks
59
59
  super().__init__(name=name)
60
60
 
61
61
  def get_valid_inputs(self) -> List[str]:
@@ -126,11 +126,11 @@ class RSSETSMarker(BaseMarker):
126
126
  parcellation=self.parcellation,
127
127
  method=self.agg_method,
128
128
  method_params=self.agg_method_params,
129
- mask=self.mask,
129
+ masks=self.masks,
130
130
  )
131
131
  # Compute the parcel aggregation
132
132
  out = parcel_aggregation.compute(input=input, extra_input=extra_input)
133
- edge_ts = _ets(out["data"])
133
+ edge_ts, _ = _ets(out["data"])
134
134
  # Compute the RSS
135
135
  out["data"] = np.sum(edge_ts**2, 1) ** 0.5
136
136
  # Set correct column label
@@ -35,10 +35,10 @@ class AmplitudeLowFrequencyFluctuationParcels(
35
35
  use_afni : bool, optional
36
36
  Whether to use AFNI for computing. If None, will use AFNI only
37
37
  if available (default None).
38
- mask : str, optional
39
- The name of the mask to apply to regions before extracting signals.
40
- Check valid options by calling :func:`junifer.data.masks.list_masks`
41
- (default None).
38
+ masks : str, dict or list of dict or str, optional
39
+ The specification of the masks to apply to regions before extracting
40
+ signals. Check :ref:`Using Masks <using_masks>` for more details.
41
+ If None, will not apply any mask (default None).
42
42
  method : str, optional
43
43
  The method to perform aggregation using. Check valid options in
44
44
  :func:`junifer.stats.get_aggfunc_by_name` (default "mean").
@@ -70,13 +70,13 @@ class AmplitudeLowFrequencyFluctuationParcels(
70
70
  lowpass: float = 0.1,
71
71
  tr: Optional[float] = None,
72
72
  use_afni: Optional[bool] = None,
73
- mask: Union[str, Dict, None] = None,
73
+ masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
74
74
  method: str = "mean",
75
75
  method_params: Optional[Dict] = None,
76
76
  name: Optional[str] = None,
77
77
  ) -> None:
78
78
  self.parcellation = parcellation
79
- self.mask = mask
79
+ self.masks = masks
80
80
  self.method = method
81
81
  self.method_params = method_params
82
82
  super().__init__(
@@ -116,7 +116,7 @@ class AmplitudeLowFrequencyFluctuationParcels(
116
116
  parcellation=self.parcellation,
117
117
  method=self.method,
118
118
  method_params=self.method_params,
119
- mask=self.mask,
119
+ masks=self.masks,
120
120
  on="fALFF",
121
121
  )
122
122
 
@@ -5,7 +5,7 @@
5
5
  # Kaustubh R. Patil <k.patil@fz-juelich.de>
6
6
  # License: AGPL
7
7
 
8
- from typing import Dict, Optional, Union
8
+ from typing import Dict, List, Optional, Union
9
9
 
10
10
  from ...api.decorators import register_marker
11
11
  from .. import SphereAggregation
@@ -39,10 +39,10 @@ class AmplitudeLowFrequencyFluctuationSpheres(
39
39
  use_afni : bool, optional
40
40
  Whether to use AFNI for computing. If None, will use AFNI only
41
41
  if available (default None).
42
- mask : str, optional
43
- The name of the mask to apply to regions before extracting signals.
44
- Check valid options by calling :func:`junifer.data.masks.list_masks`
45
- (default None).
42
+ masks : str, dict or list of dict or str, optional
43
+ The specification of the masks to apply to regions before extracting
44
+ signals. Check :ref:`Using Masks <using_masks>` for more details.
45
+ If None, will not apply any mask (default None).
46
46
  method : str, optional
47
47
  The method to perform aggregation using. Check valid options in
48
48
  :func:`junifer.stats.get_aggfunc_by_name` (default "mean").
@@ -75,14 +75,14 @@ class AmplitudeLowFrequencyFluctuationSpheres(
75
75
  lowpass: float = 0.1,
76
76
  tr: Optional[float] = None,
77
77
  use_afni: Optional[bool] = None,
78
- mask: Union[str, Dict, None] = None,
78
+ masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
79
79
  method: str = "mean",
80
80
  method_params: Optional[Dict] = None,
81
81
  name: Optional[str] = None,
82
82
  ) -> None:
83
83
  self.coords = coords
84
84
  self.radius = radius
85
- self.mask = mask
85
+ self.masks = masks
86
86
  self.method = method
87
87
  self.method_params = method_params
88
88
  super().__init__(
@@ -123,7 +123,7 @@ class AmplitudeLowFrequencyFluctuationSpheres(
123
123
  radius=self.radius,
124
124
  method=self.method,
125
125
  method_params=self.method_params,
126
- mask=self.mask,
126
+ masks=self.masks,
127
127
  on="fALFF",
128
128
  )
129
129
 
@@ -30,10 +30,10 @@ class CrossParcellationFC(BaseMarker):
30
30
  correlation_method : str, optional
31
31
  Any method that can be passed to
32
32
  :any:`pandas.DataFrame.corr` (default "pearson").
33
- mask : str, optional
34
- The name of the mask to apply to regions before extracting signals.
35
- Check valid options by calling :func:`junifer.data.masks.list_masks`
36
- (default None).
33
+ masks : str, dict or list of dict or str, optional
34
+ The specification of the masks to apply to regions before extracting
35
+ signals. Check :ref:`Using Masks <using_masks>` for more details.
36
+ If None, will not apply any mask (default None).
37
37
  name : str, optional
38
38
  The name of the marker. If None, will use the class name
39
39
  (default None).
@@ -47,7 +47,7 @@ class CrossParcellationFC(BaseMarker):
47
47
  parcellation_two: str,
48
48
  aggregation_method: str = "mean",
49
49
  correlation_method: str = "pearson",
50
- mask: Union[str, Dict, None] = None,
50
+ masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
51
51
  name: Optional[str] = None,
52
52
  ) -> None:
53
53
  if parcellation_one == parcellation_two:
@@ -58,7 +58,7 @@ class CrossParcellationFC(BaseMarker):
58
58
  self.parcellation_two = parcellation_two
59
59
  self.aggregation_method = aggregation_method
60
60
  self.correlation_method = correlation_method
61
- self.mask = mask
61
+ self.masks = masks
62
62
  super().__init__(on=["BOLD"], name=name)
63
63
 
64
64
  def get_valid_inputs(self) -> List[str]:
@@ -129,12 +129,12 @@ class CrossParcellationFC(BaseMarker):
129
129
  parcellation_one_dict = ParcelAggregation(
130
130
  parcellation=self.parcellation_one,
131
131
  method=self.aggregation_method,
132
- mask=self.mask,
132
+ masks=self.masks,
133
133
  ).compute(input)
134
134
  parcellation_two_dict = ParcelAggregation(
135
135
  parcellation=self.parcellation_two,
136
136
  method=self.aggregation_method,
137
- mask=self.mask,
137
+ masks=self.masks,
138
138
  ).compute(input)
139
139
 
140
140
  parcellated_ts_one = parcellation_one_dict["data"]
@@ -35,10 +35,10 @@ class EdgeCentricFCParcels(FunctionalConnectivityBase):
35
35
  cor_method_params : dict, optional
36
36
  Parameters to pass to the correlation function. Check valid options in
37
37
  :class:`nilearn.connectome.ConnectivityMeasure` (default None).
38
- mask : str, optional
39
- The name of the mask to apply to regions before extracting signals.
40
- Check valid options by calling :func:`junifer.data.masks.list_masks`
41
- (default None).
38
+ masks : str, dict or list of dict or str, optional
39
+ The specification of the masks to apply to regions before extracting
40
+ signals. Check :ref:`Using Masks <using_masks>` for more details.
41
+ If None, will not apply any mask (default None).
42
42
  name : str, optional
43
43
  The name of the marker. If None, will use the class name (default
44
44
  None).
@@ -59,7 +59,7 @@ class EdgeCentricFCParcels(FunctionalConnectivityBase):
59
59
  agg_method_params: Optional[Dict] = None,
60
60
  cor_method: str = "covariance",
61
61
  cor_method_params: Optional[Dict] = None,
62
- mask: Optional[str] = None,
62
+ masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
63
63
  name: Optional[str] = None,
64
64
  ) -> None:
65
65
  self.parcellation = parcellation
@@ -68,7 +68,7 @@ class EdgeCentricFCParcels(FunctionalConnectivityBase):
68
68
  agg_method_params=agg_method_params,
69
69
  cor_method=cor_method,
70
70
  cor_method_params=cor_method_params,
71
- mask=mask,
71
+ masks=masks,
72
72
  name=name,
73
73
  )
74
74
 
@@ -78,7 +78,7 @@ class EdgeCentricFCParcels(FunctionalConnectivityBase):
78
78
  parcellation=self.parcellation,
79
79
  method=self.agg_method,
80
80
  method_params=self.agg_method_params,
81
- mask=self.mask,
81
+ masks=self.masks,
82
82
  on="BOLD",
83
83
  )
84
84
 
@@ -4,7 +4,7 @@
4
4
  # Synchon Mandal <s.mandal@fz-juelich.de>
5
5
  # License: AGPL
6
6
 
7
- from typing import Any, Dict, Optional
7
+ from typing import Any, Dict, List, Optional, Union
8
8
 
9
9
  from ...api.decorators import register_marker
10
10
  from ..sphere_aggregation import SphereAggregation
@@ -37,10 +37,10 @@ class EdgeCentricFCSpheres(FunctionalConnectivityBase):
37
37
  cor_method_params : dict, optional
38
38
  Parameters to pass to the correlation function. Check valid options in
39
39
  :class:`nilearn.connectome.ConnectivityMeasure` (default None).
40
- mask : str, optional
41
- The name of the mask to apply to regions before extracting signals.
42
- Check valid options by calling :func:`junifer.data.masks.list_masks`
43
- (default None).
40
+ masks : str, dict or list of dict or str, optional
41
+ The specification of the masks to apply to regions before extracting
42
+ signals. Check :ref:`Using Masks <using_masks>` for more details.
43
+ If None, will not apply any mask (default None).
44
44
  name : str, optional
45
45
  The name of the marker. By default, it will use
46
46
  KIND_EdgeCentricFCSpheres where KIND is the kind of data it
@@ -63,7 +63,7 @@ class EdgeCentricFCSpheres(FunctionalConnectivityBase):
63
63
  agg_method_params: Optional[Dict] = None,
64
64
  cor_method: str = "covariance",
65
65
  cor_method_params: Optional[Dict] = None,
66
- mask: Optional[str] = None,
66
+ masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
67
67
  name: Optional[str] = None,
68
68
  ) -> None:
69
69
  self.coords = coords
@@ -75,7 +75,7 @@ class EdgeCentricFCSpheres(FunctionalConnectivityBase):
75
75
  agg_method_params=agg_method_params,
76
76
  cor_method=cor_method,
77
77
  cor_method_params=cor_method_params,
78
- mask=mask,
78
+ masks=masks,
79
79
  name=name,
80
80
  )
81
81
 
@@ -86,7 +86,7 @@ class EdgeCentricFCSpheres(FunctionalConnectivityBase):
86
86
  radius=self.radius,
87
87
  method=self.agg_method,
88
88
  method_params=self.agg_method_params,
89
- mask=self.mask,
89
+ masks=self.masks,
90
90
  on="BOLD",
91
91
  )
92
92
  bold_aggregated = sphere_aggregation.compute(input)
@@ -32,10 +32,10 @@ class FunctionalConnectivityBase(BaseMarker):
32
32
  cor_method_params : dict, optional
33
33
  Parameters to pass to the correlation function. Check valid options in
34
34
  :class:`nilearn.connectome.ConnectivityMeasure` (default None).
35
- mask : str, optional
36
- The name of the mask to apply to regions before extracting signals.
37
- Check valid options by calling :func:`junifer.data.masks.list_masks`
38
- (default None).
35
+ masks : str, dict or list of dict or str, optional
36
+ The specification of the masks to apply to regions before extracting
37
+ signals. Check :ref:`Using Masks <using_masks>` for more details.
38
+ If None, will not apply any mask (default None).
39
39
  name : str, optional
40
40
  The name of the marker. If None, will use the class name (default
41
41
  None).
@@ -50,7 +50,7 @@ class FunctionalConnectivityBase(BaseMarker):
50
50
  agg_method_params: Optional[Dict] = None,
51
51
  cor_method: str = "covariance",
52
52
  cor_method_params: Optional[Dict] = None,
53
- mask: Union[str, Dict, None] = None,
53
+ masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
54
54
  name: Optional[str] = None,
55
55
  ) -> None:
56
56
  self.agg_method = agg_method
@@ -62,7 +62,7 @@ class FunctionalConnectivityBase(BaseMarker):
62
62
  self.cor_method_params["empirical"] = self.cor_method_params.get(
63
63
  "empirical", False
64
64
  )
65
- self.mask = mask
65
+ self.masks = masks
66
66
  super().__init__(on="BOLD", name=name)
67
67
 
68
68
  @abstractmethod
@@ -134,7 +134,7 @@ class FunctionalConnectivityBase(BaseMarker):
134
134
  # Compute correlation
135
135
  if self.cor_method_params["empirical"]:
136
136
  connectivity = ConnectivityMeasure(
137
- cov_estimator=EmpiricalCovariance(),
137
+ cov_estimator=EmpiricalCovariance(), # type: ignore
138
138
  kind=self.cor_method,
139
139
  )
140
140
  else:
@@ -34,10 +34,10 @@ class FunctionalConnectivityParcels(FunctionalConnectivityBase):
34
34
  cor_method_params : dict, optional
35
35
  Parameters to pass to the correlation function. Check valid options in
36
36
  :class:`nilearn.connectome.ConnectivityMeasure` (default None).
37
- mask : str, optional
38
- The name of the mask to apply to regions before extracting signals.
39
- Check valid options by calling :func:`junifer.data.masks.list_masks`
40
- (default None).
37
+ masks : str, dict or list of dict or str, optional
38
+ The specification of the masks to apply to regions before extracting
39
+ signals. Check :ref:`Using Masks <using_masks>` for more details.
40
+ If None, will not apply any mask (default None).
41
41
  name : str, optional
42
42
  The name of the marker. If None, will use the class name (default
43
43
  None).
@@ -51,7 +51,7 @@ class FunctionalConnectivityParcels(FunctionalConnectivityBase):
51
51
  agg_method_params: Optional[Dict] = None,
52
52
  cor_method: str = "covariance",
53
53
  cor_method_params: Optional[Dict] = None,
54
- mask: Union[str, Dict, None] = None,
54
+ masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
55
55
  name: Optional[str] = None,
56
56
  ) -> None:
57
57
  self.parcellation = parcellation
@@ -60,7 +60,7 @@ class FunctionalConnectivityParcels(FunctionalConnectivityBase):
60
60
  agg_method_params=agg_method_params,
61
61
  cor_method=cor_method,
62
62
  cor_method_params=cor_method_params,
63
- mask=mask,
63
+ masks=masks,
64
64
  name=name,
65
65
  )
66
66
 
@@ -70,7 +70,7 @@ class FunctionalConnectivityParcels(FunctionalConnectivityBase):
70
70
  parcellation=self.parcellation,
71
71
  method=self.agg_method,
72
72
  method_params=self.agg_method_params,
73
- mask=self.mask,
73
+ masks=self.masks,
74
74
  on="BOLD",
75
75
  )
76
76
  # Return the 2D timeseries after parcel aggregation
@@ -5,7 +5,7 @@
5
5
  # Synchon Mandal <s.mandal@fz-juelich.de>
6
6
  # License: AGPL
7
7
 
8
- from typing import Any, Dict, Optional, Union
8
+ from typing import Any, Dict, List, Optional, Union
9
9
 
10
10
  from ...api.decorators import register_marker
11
11
  from ..sphere_aggregation import SphereAggregation
@@ -38,10 +38,10 @@ class FunctionalConnectivitySpheres(FunctionalConnectivityBase):
38
38
  cor_method_params : dict, optional
39
39
  Parameters to pass to the correlation function. Check valid options in
40
40
  :class:`nilearn.connectome.ConnectivityMeasure` (default None).
41
- mask : str, optional
42
- The name of the mask to apply to regions before extracting signals.
43
- Check valid options by calling :func:`junifer.data.masks.list_masks`
44
- (default None).
41
+ masks : str, dict or list of dict or str, optional
42
+ The specification of the masks to apply to regions before extracting
43
+ signals. Check :ref:`Using Masks <using_masks>` for more details.
44
+ If None, will not apply any mask (default None).
45
45
  name : str, optional
46
46
  The name of the marker. By default, it will use
47
47
  KIND_FunctionalConnectivitySpheres where KIND is the kind of data it
@@ -57,7 +57,7 @@ class FunctionalConnectivitySpheres(FunctionalConnectivityBase):
57
57
  agg_method_params: Optional[Dict] = None,
58
58
  cor_method: str = "covariance",
59
59
  cor_method_params: Optional[Dict] = None,
60
- mask: Union[str, Dict, None] = None,
60
+ masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
61
61
  name: Optional[str] = None,
62
62
  ) -> None:
63
63
  self.coords = coords
@@ -69,7 +69,7 @@ class FunctionalConnectivitySpheres(FunctionalConnectivityBase):
69
69
  agg_method_params=agg_method_params,
70
70
  cor_method=cor_method,
71
71
  cor_method_params=cor_method_params,
72
- mask=mask,
72
+ masks=masks,
73
73
  name=name,
74
74
  )
75
75
 
@@ -80,7 +80,7 @@ class FunctionalConnectivitySpheres(FunctionalConnectivityBase):
80
80
  radius=self.radius,
81
81
  method=self.agg_method,
82
82
  method_params=self.agg_method_params,
83
- mask=self.mask,
83
+ masks=self.masks,
84
84
  on="BOLD",
85
85
  )
86
86
  # Return the 2D timeseries after sphere aggregation
@@ -6,10 +6,12 @@
6
6
  import pytest
7
7
 
8
8
  # done to keep line length 79
9
- import junifer.markers.functional_connectivity as fc
9
+ from junifer.markers.functional_connectivity import (
10
+ functional_connectivity_base as fcb,
11
+ )
10
12
 
11
13
 
12
14
  def test_base_functional_connectivity_marker_abstractness() -> None:
13
15
  """Test FunctionalConnectivityBase is an abstract base class."""
14
16
  with pytest.raises(TypeError, match="abstract"):
15
- fc.functional_connectivity_base.FunctionalConnectivityBase()
17
+ fcb.FunctionalConnectivityBase() # type: ignore
@@ -32,10 +32,10 @@ class ParcelAggregation(BaseMarker):
32
32
  method_params : dict, optional
33
33
  Parameters to pass to the aggregation function. Check valid options in
34
34
  :func:`junifer.stats.get_aggfunc_by_name`.
35
- mask : str, optional
36
- The name of the mask to apply to regions before extracting signals.
37
- Check valid options by calling :func:`junifer.data.masks.list_masks`
38
- (default None).
35
+ masks : str, dict or list of dict or str, optional
36
+ The specification of the masks to apply to regions before extracting
37
+ signals. Check :ref:`Using Masks <using_masks>` for more details.
38
+ If None, will not apply any mask (default None).
39
39
  on : {"T1w", "BOLD", "VBM_GM", "VBM_WM", "fALFF", "GCOR", "LCOR"} \
40
40
  or list of the options, optional
41
41
  The data types to apply the marker to. If None, will work on all
@@ -52,7 +52,7 @@ class ParcelAggregation(BaseMarker):
52
52
  parcellation: Union[str, List[str]],
53
53
  method: str,
54
54
  method_params: Optional[Dict[str, Any]] = None,
55
- mask: Union[str, Dict, None] = None,
55
+ masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
56
56
  on: Union[List[str], str, None] = None,
57
57
  name: Optional[str] = None,
58
58
  ) -> None:
@@ -61,7 +61,7 @@ class ParcelAggregation(BaseMarker):
61
61
  self.parcellation = parcellation
62
62
  self.method = method
63
63
  self.method_params = method_params or {}
64
- self.mask = mask
64
+ self.masks = masks
65
65
  super().__init__(on=on, name=name)
66
66
 
67
67
  def get_valid_inputs(self) -> List[str]:
@@ -184,9 +184,11 @@ class ParcelAggregation(BaseMarker):
184
184
  img=parcellation_img_res,
185
185
  )
186
186
 
187
- if self.mask is not None:
188
- logger.debug(f"Masking with {self.mask}")
189
- mask_img = get_mask(mask=self.mask, target_data=input)
187
+ if self.masks is not None:
188
+ logger.debug(f"Masking with {self.masks}")
189
+ mask_img = get_mask(
190
+ masks=self.masks, target_data=input, extra_input=extra_input
191
+ )
190
192
 
191
193
  parcellation_bin = math_img(
192
194
  "np.logical_and(img, mask)",
@@ -4,7 +4,7 @@
4
4
  # License: AGPL
5
5
 
6
6
 
7
- from typing import Any, Dict, Optional, Union
7
+ from typing import Any, Dict, List, Optional, Union
8
8
 
9
9
  import numpy as np
10
10
 
@@ -74,10 +74,10 @@ class ReHoParcels(ReHoBase):
74
74
  agg_method_params : dict, optional
75
75
  Parameters to pass to the aggregation function. Check valid options in
76
76
  :func:`junifer.stats.get_aggfunc_by_name` (default None).
77
- mask : str, optional
78
- The name of the mask to apply to regions before extracting signals.
79
- Check valid options by calling :func:`junifer.data.masks.list_masks`
80
- (default None).
77
+ masks : str, dict or list of dict or str, optional
78
+ The specification of the masks to apply to regions before extracting
79
+ signals. Check :ref:`Using Masks <using_masks>` for more details.
80
+ If None, will not apply any mask (default None).
81
81
  name : str, optional
82
82
  The name of the marker. If None, it will use the class name
83
83
  (default None).
@@ -91,14 +91,14 @@ class ReHoParcels(ReHoBase):
91
91
  reho_params: Optional[Dict] = None,
92
92
  agg_method: str = "mean",
93
93
  agg_method_params: Optional[Dict] = None,
94
- mask: Union[str, Dict, None] = None,
94
+ masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
95
95
  name: Optional[str] = None,
96
96
  ) -> None:
97
97
  self.parcellation = parcellation
98
98
  self.reho_params = reho_params
99
99
  self.agg_method = agg_method
100
100
  self.agg_method_params = agg_method_params
101
- self.mask = mask
101
+ self.masks = masks
102
102
  super().__init__(use_afni=use_afni, name=name)
103
103
 
104
104
  def compute(
@@ -136,7 +136,7 @@ class ReHoParcels(ReHoBase):
136
136
  parcellation=self.parcellation,
137
137
  method=self.agg_method,
138
138
  method_params=self.agg_method_params,
139
- mask=self.mask,
139
+ masks=self.masks,
140
140
  on="BOLD",
141
141
  )
142
142
  # Perform aggregation on reho map
@@ -4,7 +4,7 @@
4
4
  # License: AGPL
5
5
 
6
6
 
7
- from typing import Any, Dict, Optional, Union
7
+ from typing import Any, Dict, List, Optional, Union
8
8
 
9
9
  import numpy as np
10
10
 
@@ -79,10 +79,10 @@ class ReHoSpheres(ReHoBase):
79
79
  (default None).
80
80
  agg_method_params : dict, optional
81
81
  The parameters to pass to the aggregation method (default None).
82
- mask : str, optional
83
- The name of the mask to apply to regions before extracting signals.
84
- Check valid options by calling :func:`junifer.data.masks.list_masks`
85
- (default None).
82
+ masks : str, dict or list of dict or str, optional
83
+ The specification of the masks to apply to regions before extracting
84
+ signals. Check :ref:`Using Masks <using_masks>` for more details.
85
+ If None, will not apply any mask (default None).
86
86
  name : str, optional
87
87
  The name of the marker. If None, it will use the class name
88
88
  (default None).
@@ -97,7 +97,7 @@ class ReHoSpheres(ReHoBase):
97
97
  reho_params: Optional[Dict] = None,
98
98
  agg_method: str = "mean",
99
99
  agg_method_params: Optional[Dict] = None,
100
- mask: Union[str, Dict, None] = None,
100
+ masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
101
101
  name: Optional[str] = None,
102
102
  ) -> None:
103
103
  self.coords = coords
@@ -105,7 +105,7 @@ class ReHoSpheres(ReHoBase):
105
105
  self.reho_params = reho_params
106
106
  self.agg_method = agg_method
107
107
  self.agg_method_params = agg_method_params
108
- self.mask = mask
108
+ self.masks = masks
109
109
  super().__init__(use_afni=use_afni, name=name)
110
110
 
111
111
  def compute(
@@ -144,7 +144,7 @@ class ReHoSpheres(ReHoBase):
144
144
  radius=self.radius,
145
145
  method=self.agg_method,
146
146
  method_params=self.agg_method_params,
147
- mask=self.mask,
147
+ masks=self.masks,
148
148
  on="BOLD",
149
149
  )
150
150
  # Perform aggregation on reho map
@@ -34,10 +34,10 @@ class SphereAggregation(BaseMarker):
34
34
  (default "mean").
35
35
  method_params : dict, optional
36
36
  The parameters to pass to the aggregation method (default None).
37
- mask : str, optional
38
- The name of the mask to apply to regions before extracting signals.
39
- Check valid options by calling :func:`junifer.data.masks.list_masks`
40
- (default None).
37
+ masks : str, dict or list of dict or str, optional
38
+ The specification of the masks to apply to regions before extracting
39
+ signals. Check :ref:`Using Masks <using_masks>` for more details.
40
+ If None, will not apply any mask (default None).
41
41
  on : {"T1w", "BOLD", "VBM_GM", "VBM_WM", "fALFF", "GCOR", "LCOR"} or \
42
42
  list of the options, optional
43
43
  The data types to apply the marker to. If None, will work on all
@@ -56,7 +56,7 @@ class SphereAggregation(BaseMarker):
56
56
  radius: Optional[float] = None,
57
57
  method: str = "mean",
58
58
  method_params: Optional[Dict[str, Any]] = None,
59
- mask: Union[str, Dict, None] = None,
59
+ masks: Union[str, Dict, List[Union[Dict, str]], None] = None,
60
60
  on: Union[List[str], str, None] = None,
61
61
  name: Optional[str] = None,
62
62
  ) -> None:
@@ -64,7 +64,7 @@ class SphereAggregation(BaseMarker):
64
64
  self.radius = radius
65
65
  self.method = method
66
66
  self.method_params = method_params or {}
67
- self.mask = mask
67
+ self.masks = masks
68
68
  super().__init__(on=on, name=name)
69
69
 
70
70
  def get_valid_inputs(self) -> List[str]:
@@ -137,9 +137,11 @@ class SphereAggregation(BaseMarker):
137
137
  )
138
138
  # Load mask
139
139
  mask_img = None
140
- if self.mask is not None:
141
- logger.debug(f"Masking with {self.mask}")
142
- mask_img = get_mask(mask=self.mask, target_data=input)
140
+ if self.masks is not None:
141
+ logger.debug(f"Masking with {self.masks}")
142
+ mask_img = get_mask(
143
+ masks=self.masks, target_data=input, extra_input=extra_input
144
+ )
143
145
  # Get seeds and labels
144
146
  coords, out_labels = load_coordinates(name=self.coords)
145
147
  masker = JuniferNiftiSpheresMasker(