junifer 0.0.6.dev227__py3-none-any.whl → 0.0.6.dev252__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.
- junifer/_version.py +2 -2
- junifer/api/decorators.py +1 -2
- junifer/api/functions.py +18 -18
- junifer/api/queue_context/gnu_parallel_local_adapter.py +4 -4
- junifer/api/queue_context/htcondor_adapter.py +4 -4
- junifer/api/queue_context/tests/test_gnu_parallel_local_adapter.py +3 -3
- junifer/api/queue_context/tests/test_htcondor_adapter.py +3 -3
- junifer/api/tests/test_functions.py +32 -32
- junifer/cli/cli.py +3 -3
- junifer/cli/parser.py +4 -4
- junifer/cli/tests/test_cli.py +5 -5
- junifer/cli/utils.py +5 -6
- junifer/configs/juseless/datagrabbers/ixi_vbm.py +2 -2
- junifer/configs/juseless/datagrabbers/tests/test_ucla.py +2 -2
- junifer/configs/juseless/datagrabbers/ucla.py +4 -4
- junifer/data/_dispatch.py +11 -14
- junifer/data/coordinates/_ants_coordinates_warper.py +6 -8
- junifer/data/coordinates/_coordinates.py +34 -21
- junifer/data/coordinates/_fsl_coordinates_warper.py +6 -8
- junifer/data/masks/_ants_mask_warper.py +18 -11
- junifer/data/masks/_fsl_mask_warper.py +6 -8
- junifer/data/masks/_masks.py +27 -34
- junifer/data/masks/tests/test_masks.py +4 -4
- junifer/data/parcellations/_ants_parcellation_warper.py +18 -11
- junifer/data/parcellations/_fsl_parcellation_warper.py +6 -8
- junifer/data/parcellations/_parcellations.py +39 -43
- junifer/data/parcellations/tests/test_parcellations.py +1 -2
- junifer/data/pipeline_data_registry_base.py +3 -2
- junifer/data/template_spaces.py +3 -3
- junifer/data/tests/test_data_utils.py +1 -2
- junifer/data/utils.py +69 -4
- junifer/datagrabber/aomic/id1000.py +24 -11
- junifer/datagrabber/aomic/piop1.py +27 -14
- junifer/datagrabber/aomic/piop2.py +27 -14
- junifer/datagrabber/aomic/tests/test_id1000.py +3 -3
- junifer/datagrabber/aomic/tests/test_piop1.py +4 -4
- junifer/datagrabber/aomic/tests/test_piop2.py +4 -4
- junifer/datagrabber/base.py +18 -12
- junifer/datagrabber/datalad_base.py +18 -11
- junifer/datagrabber/dmcc13_benchmark.py +31 -18
- junifer/datagrabber/hcp1200/datalad_hcp1200.py +3 -3
- junifer/datagrabber/hcp1200/hcp1200.py +26 -15
- junifer/datagrabber/hcp1200/tests/test_hcp1200.py +2 -1
- junifer/datagrabber/multiple.py +7 -7
- junifer/datagrabber/pattern.py +75 -45
- junifer/datagrabber/pattern_validation_mixin.py +204 -94
- junifer/datagrabber/tests/test_datalad_base.py +7 -8
- junifer/datagrabber/tests/test_dmcc13_benchmark.py +28 -11
- junifer/datagrabber/tests/test_pattern_validation_mixin.py +6 -6
- junifer/datareader/default.py +6 -6
- junifer/external/nilearn/junifer_connectivity_measure.py +2 -2
- junifer/external/nilearn/junifer_nifti_spheres_masker.py +4 -4
- junifer/external/nilearn/tests/test_junifer_connectivity_measure.py +15 -15
- junifer/external/nilearn/tests/test_junifer_nifti_spheres_masker.py +2 -3
- junifer/markers/base.py +8 -8
- junifer/markers/brainprint.py +7 -9
- junifer/markers/complexity/complexity_base.py +6 -8
- junifer/markers/complexity/hurst_exponent.py +5 -5
- junifer/markers/complexity/multiscale_entropy_auc.py +5 -5
- junifer/markers/complexity/perm_entropy.py +5 -5
- junifer/markers/complexity/range_entropy.py +5 -5
- junifer/markers/complexity/range_entropy_auc.py +5 -5
- junifer/markers/complexity/sample_entropy.py +5 -5
- junifer/markers/complexity/weighted_perm_entropy.py +5 -5
- junifer/markers/ets_rss.py +7 -7
- junifer/markers/falff/_afni_falff.py +1 -2
- junifer/markers/falff/_junifer_falff.py +1 -2
- junifer/markers/falff/falff_base.py +2 -4
- junifer/markers/falff/falff_parcels.py +7 -7
- junifer/markers/falff/falff_spheres.py +6 -6
- junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +6 -6
- junifer/markers/functional_connectivity/edge_functional_connectivity_parcels.py +7 -7
- junifer/markers/functional_connectivity/edge_functional_connectivity_spheres.py +6 -6
- junifer/markers/functional_connectivity/functional_connectivity_base.py +10 -10
- junifer/markers/functional_connectivity/functional_connectivity_parcels.py +7 -7
- junifer/markers/functional_connectivity/functional_connectivity_spheres.py +6 -6
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_parcels.py +1 -2
- junifer/markers/functional_connectivity/tests/test_edge_functional_connectivity_spheres.py +1 -2
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_parcels.py +3 -3
- junifer/markers/functional_connectivity/tests/test_functional_connectivity_spheres.py +3 -3
- junifer/markers/parcel_aggregation.py +8 -8
- junifer/markers/reho/_afni_reho.py +1 -2
- junifer/markers/reho/_junifer_reho.py +1 -2
- junifer/markers/reho/reho_base.py +2 -4
- junifer/markers/reho/reho_parcels.py +8 -8
- junifer/markers/reho/reho_spheres.py +7 -7
- junifer/markers/sphere_aggregation.py +8 -8
- junifer/markers/temporal_snr/temporal_snr_base.py +8 -8
- junifer/markers/temporal_snr/temporal_snr_parcels.py +6 -6
- junifer/markers/temporal_snr/temporal_snr_spheres.py +5 -5
- junifer/markers/utils.py +3 -3
- junifer/onthefly/_brainprint.py +2 -2
- junifer/onthefly/read_transform.py +3 -3
- junifer/pipeline/marker_collection.py +4 -4
- junifer/pipeline/pipeline_component_registry.py +5 -4
- junifer/pipeline/pipeline_step_mixin.py +15 -11
- junifer/pipeline/tests/test_pipeline_component_registry.py +2 -3
- junifer/pipeline/tests/test_pipeline_step_mixin.py +19 -19
- junifer/pipeline/tests/test_update_meta_mixin.py +4 -4
- junifer/pipeline/update_meta_mixin.py +21 -17
- junifer/pipeline/utils.py +5 -5
- junifer/preprocess/base.py +10 -10
- junifer/preprocess/confounds/fmriprep_confound_remover.py +11 -14
- junifer/preprocess/confounds/tests/test_fmriprep_confound_remover.py +1 -2
- junifer/preprocess/smoothing/smoothing.py +7 -7
- junifer/preprocess/warping/_ants_warper.py +26 -6
- junifer/preprocess/warping/_fsl_warper.py +22 -7
- junifer/preprocess/warping/space_warper.py +37 -10
- junifer/preprocess/warping/tests/test_space_warper.py +3 -4
- junifer/stats.py +4 -4
- junifer/storage/base.py +14 -13
- junifer/storage/hdf5.py +21 -20
- junifer/storage/pandas_base.py +12 -11
- junifer/storage/sqlite.py +11 -11
- junifer/storage/tests/test_hdf5.py +1 -2
- junifer/storage/tests/test_sqlite.py +2 -2
- junifer/storage/tests/test_utils.py +8 -7
- junifer/storage/utils.py +7 -7
- junifer/testing/datagrabbers.py +9 -10
- junifer/tests/test_stats.py +2 -2
- junifer/typing/_typing.py +6 -9
- junifer/utils/helpers.py +2 -3
- junifer/utils/logging.py +5 -5
- junifer/utils/singleton.py +3 -3
- {junifer-0.0.6.dev227.dist-info → junifer-0.0.6.dev252.dist-info}/METADATA +2 -2
- {junifer-0.0.6.dev227.dist-info → junifer-0.0.6.dev252.dist-info}/RECORD +131 -131
- {junifer-0.0.6.dev227.dist-info → junifer-0.0.6.dev252.dist-info}/WHEEL +1 -1
- {junifer-0.0.6.dev227.dist-info → junifer-0.0.6.dev252.dist-info}/AUTHORS.rst +0 -0
- {junifer-0.0.6.dev227.dist-info → junifer-0.0.6.dev252.dist-info}/LICENSE.md +0 -0
- {junifer-0.0.6.dev227.dist-info → junifer-0.0.6.dev252.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.6.dev227.dist-info → junifer-0.0.6.dev252.dist-info}/top_level.txt +0 -0
@@ -6,7 +6,7 @@
|
|
6
6
|
import copy
|
7
7
|
import warnings
|
8
8
|
from math import cosh, exp, log, sinh, sqrt
|
9
|
-
from typing import TYPE_CHECKING,
|
9
|
+
from typing import TYPE_CHECKING, Optional, Union
|
10
10
|
|
11
11
|
import numpy as np
|
12
12
|
import pytest
|
@@ -149,7 +149,7 @@ def random_spd(
|
|
149
149
|
|
150
150
|
def _signals(
|
151
151
|
n_subjects: int = N_SUBJECTS,
|
152
|
-
) ->
|
152
|
+
) -> tuple[list[np.ndarray], np.ndarray]:
|
153
153
|
"""Generate signals and compute covariances while applying confounds.
|
154
154
|
|
155
155
|
Parameters
|
@@ -178,7 +178,7 @@ def _signals(
|
|
178
178
|
|
179
179
|
|
180
180
|
@pytest.fixture
|
181
|
-
def signals() ->
|
181
|
+
def signals() -> list[np.ndarray]:
|
182
182
|
"""Return signals as list of np.ndarray."""
|
183
183
|
return _signals(N_SUBJECTS)[0]
|
184
184
|
|
@@ -186,7 +186,7 @@ def signals() -> List[np.ndarray]:
|
|
186
186
|
@pytest.fixture
|
187
187
|
def signals_and_covariances(
|
188
188
|
cov_estimator: Union[LedoitWolf, EmpiricalCovariance]
|
189
|
-
) ->
|
189
|
+
) -> tuple[list[np.ndarray], list[float]]:
|
190
190
|
"""Return signals and covariances for a covariance estimator.
|
191
191
|
|
192
192
|
Parameters
|
@@ -417,7 +417,7 @@ def grad_geometric_mean(
|
|
417
417
|
init: Optional["ArrayLike"] = None,
|
418
418
|
max_iter: int = 10,
|
419
419
|
tol: float = 1e-7,
|
420
|
-
) ->
|
420
|
+
) -> list[float]:
|
421
421
|
"""Compute gradient of geometric mean.
|
422
422
|
|
423
423
|
Return the norm of the covariant derivative at each iteration step
|
@@ -615,8 +615,8 @@ def test_connectivity_measure_errors():
|
|
615
615
|
@pytest.mark.parametrize("kind", CONNECTIVITY_KINDS)
|
616
616
|
def test_connectivity_measure_generic(
|
617
617
|
kind: str,
|
618
|
-
cov_estimator:
|
619
|
-
signals_and_covariances:
|
618
|
+
cov_estimator: type["BaseEstimator"],
|
619
|
+
signals_and_covariances: tuple[list[np.ndarray], list[float]],
|
620
620
|
) -> None:
|
621
621
|
"""Test generic JuniferConnectivityMeasure.
|
622
622
|
|
@@ -778,8 +778,8 @@ def _assert_connectivity_partial_correlation(connectivities, covs) -> None:
|
|
778
778
|
)
|
779
779
|
def test_connectivity_measure_specific_for_each_kind(
|
780
780
|
kind: str,
|
781
|
-
cov_estimator:
|
782
|
-
signals_and_covariances:
|
781
|
+
cov_estimator: type["BaseEstimator"],
|
782
|
+
signals_and_covariances: tuple[list[np.ndarray], list[float]],
|
783
783
|
) -> None:
|
784
784
|
"""Test connectivity matrix for each kind.
|
785
785
|
|
@@ -812,7 +812,7 @@ def test_connectivity_measure_specific_for_each_kind(
|
|
812
812
|
|
813
813
|
@pytest.mark.parametrize("kind", CONNECTIVITY_KINDS)
|
814
814
|
def test_connectivity_measure_check_mean(
|
815
|
-
kind: str, signals:
|
815
|
+
kind: str, signals: list[np.ndarray]
|
816
816
|
) -> None:
|
817
817
|
"""Test mean of connectivity matrix for each kind.
|
818
818
|
|
@@ -846,7 +846,7 @@ def test_connectivity_measure_check_mean(
|
|
846
846
|
|
847
847
|
@pytest.mark.parametrize("kind", CONNECTIVITY_KINDS)
|
848
848
|
def test_connectivity_measure_check_vectorization_option(
|
849
|
-
kind: str, signals:
|
849
|
+
kind: str, signals: list[np.ndarray]
|
850
850
|
) -> None:
|
851
851
|
"""Test vectorization of connectivity matrix for each kind.
|
852
852
|
|
@@ -879,7 +879,7 @@ def test_connectivity_measure_check_vectorization_option(
|
|
879
879
|
["covariance", "correlation", "precision", "partial correlation"],
|
880
880
|
)
|
881
881
|
def test_connectivity_measure_check_inverse_transformation(
|
882
|
-
kind: str, signals:
|
882
|
+
kind: str, signals: list[np.ndarray]
|
883
883
|
) -> None:
|
884
884
|
"""Test inverse transform.
|
885
885
|
|
@@ -915,7 +915,7 @@ def test_connectivity_measure_check_inverse_transformation(
|
|
915
915
|
["covariance", "correlation", "precision", "partial correlation"],
|
916
916
|
)
|
917
917
|
def test_connectivity_measure_check_inverse_transformation_discard_diag(
|
918
|
-
kind: str, signals:
|
918
|
+
kind: str, signals: list[np.ndarray]
|
919
919
|
) -> None:
|
920
920
|
"""Test diagonal for inverse transform.
|
921
921
|
|
@@ -957,7 +957,7 @@ def test_connectivity_measure_check_inverse_transformation_discard_diag(
|
|
957
957
|
|
958
958
|
|
959
959
|
def test_connectivity_measure_inverse_transform_tangent(
|
960
|
-
signals:
|
960
|
+
signals: list[np.ndarray],
|
961
961
|
) -> None:
|
962
962
|
"""Test that for 'tangent' kind, covariance matrices are reconstructed.
|
963
963
|
|
@@ -1067,7 +1067,7 @@ def test_confounds_connectivity_measure_errors() -> None:
|
|
1067
1067
|
|
1068
1068
|
|
1069
1069
|
def test_connectivity_measure_standardize(
|
1070
|
-
signals:
|
1070
|
+
signals: list[np.ndarray],
|
1071
1071
|
) -> None:
|
1072
1072
|
"""Check warning is raised and then suppressed with setting standardize.
|
1073
1073
|
|
@@ -4,7 +4,6 @@
|
|
4
4
|
# License: AGPL
|
5
5
|
|
6
6
|
import warnings
|
7
|
-
from typing import List, Tuple
|
8
7
|
|
9
8
|
import nibabel
|
10
9
|
import numpy as np
|
@@ -361,10 +360,10 @@ def test_nifti_spheres_masker_io_shapes() -> None:
|
|
361
360
|
],
|
362
361
|
)
|
363
362
|
def test_junifer_and_nilearn_mean_agg_are_equal(
|
364
|
-
shape:
|
363
|
+
shape: tuple[int, ...],
|
365
364
|
radius: float,
|
366
365
|
allow_overlap: bool,
|
367
|
-
coords:
|
366
|
+
coords: list[tuple[int, int, int]],
|
368
367
|
) -> None:
|
369
368
|
"""Test junifer's masker behaves same as nilearn's when agg is mean.
|
370
369
|
|
junifer/markers/base.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
from abc import ABC, abstractmethod
|
8
8
|
from copy import deepcopy
|
9
|
-
from typing import Any,
|
9
|
+
from typing import Any, Optional, Union
|
10
10
|
|
11
11
|
from ..pipeline import PipelineStepMixin, UpdateMetaMixin
|
12
12
|
from ..typing import StorageLike
|
@@ -42,7 +42,7 @@ class BaseMarker(ABC, PipelineStepMixin, UpdateMetaMixin):
|
|
42
42
|
|
43
43
|
def __init__(
|
44
44
|
self,
|
45
|
-
on: Optional[Union[
|
45
|
+
on: Optional[Union[list[str], str]] = None,
|
46
46
|
name: Optional[str] = None,
|
47
47
|
) -> None:
|
48
48
|
# Check for missing mapping attribute
|
@@ -65,7 +65,7 @@ class BaseMarker(ABC, PipelineStepMixin, UpdateMetaMixin):
|
|
65
65
|
raise_error(f"{self.name} cannot be computed on {wrong_on}")
|
66
66
|
self._on = on
|
67
67
|
|
68
|
-
def validate_input(self, input:
|
68
|
+
def validate_input(self, input: list[str]) -> list[str]:
|
69
69
|
"""Validate input.
|
70
70
|
|
71
71
|
Parameters
|
@@ -94,7 +94,7 @@ class BaseMarker(ABC, PipelineStepMixin, UpdateMetaMixin):
|
|
94
94
|
)
|
95
95
|
return [x for x in self._on if x in input]
|
96
96
|
|
97
|
-
def get_valid_inputs(self) ->
|
97
|
+
def get_valid_inputs(self) -> list[str]:
|
98
98
|
"""Get valid data types for input.
|
99
99
|
|
100
100
|
Returns
|
@@ -124,7 +124,7 @@ class BaseMarker(ABC, PipelineStepMixin, UpdateMetaMixin):
|
|
124
124
|
return self._MARKER_INOUT_MAPPINGS[input_type][output_feature]
|
125
125
|
|
126
126
|
@abstractmethod
|
127
|
-
def compute(self, input:
|
127
|
+
def compute(self, input: dict, extra_input: Optional[dict] = None) -> dict:
|
128
128
|
"""Compute.
|
129
129
|
|
130
130
|
Parameters
|
@@ -155,7 +155,7 @@ class BaseMarker(ABC, PipelineStepMixin, UpdateMetaMixin):
|
|
155
155
|
self,
|
156
156
|
type_: str,
|
157
157
|
feature: str,
|
158
|
-
out:
|
158
|
+
out: dict[str, Any],
|
159
159
|
storage: StorageLike,
|
160
160
|
) -> None:
|
161
161
|
"""Store.
|
@@ -178,9 +178,9 @@ class BaseMarker(ABC, PipelineStepMixin, UpdateMetaMixin):
|
|
178
178
|
|
179
179
|
def _fit_transform(
|
180
180
|
self,
|
181
|
-
input:
|
181
|
+
input: dict[str, dict],
|
182
182
|
storage: Optional[StorageLike] = None,
|
183
|
-
) ->
|
183
|
+
) -> dict:
|
184
184
|
"""Fit and transform.
|
185
185
|
|
186
186
|
Parameters
|
junifer/markers/brainprint.py
CHANGED
@@ -8,8 +8,6 @@ from pathlib import Path
|
|
8
8
|
from typing import (
|
9
9
|
Any,
|
10
10
|
ClassVar,
|
11
|
-
Dict,
|
12
|
-
List,
|
13
11
|
Optional,
|
14
12
|
Union,
|
15
13
|
)
|
@@ -117,7 +115,7 @@ class BrainPrint(BaseMarker):
|
|
117
115
|
self,
|
118
116
|
aseg_path: Path,
|
119
117
|
norm_path: Path,
|
120
|
-
indices:
|
118
|
+
indices: list,
|
121
119
|
) -> Path:
|
122
120
|
"""Generate a surface from the aseg and label files.
|
123
121
|
|
@@ -193,7 +191,7 @@ class BrainPrint(BaseMarker):
|
|
193
191
|
self,
|
194
192
|
aseg_path: Path,
|
195
193
|
norm_path: Path,
|
196
|
-
) ->
|
194
|
+
) -> dict[str, Path]:
|
197
195
|
"""Create surfaces from FreeSurfer aseg labels.
|
198
196
|
|
199
197
|
Parameters
|
@@ -268,7 +266,7 @@ class BrainPrint(BaseMarker):
|
|
268
266
|
rh_white_path: Path,
|
269
267
|
lh_pial_path: Path,
|
270
268
|
rh_pial_path: Path,
|
271
|
-
) ->
|
269
|
+
) -> dict[str, Path]:
|
272
270
|
"""Create cortical surfaces from FreeSurfer labels.
|
273
271
|
|
274
272
|
Parameters
|
@@ -309,7 +307,7 @@ class BrainPrint(BaseMarker):
|
|
309
307
|
|
310
308
|
def _fix_nan(
|
311
309
|
self,
|
312
|
-
input_data:
|
310
|
+
input_data: list[Union[float, str, npt.ArrayLike]],
|
313
311
|
) -> np.ndarray:
|
314
312
|
"""Convert BrainPrint output with string NaN to ``numpy.nan``.
|
315
313
|
|
@@ -330,9 +328,9 @@ class BrainPrint(BaseMarker):
|
|
330
328
|
|
331
329
|
def compute(
|
332
330
|
self,
|
333
|
-
input:
|
334
|
-
extra_input: Optional[
|
335
|
-
) ->
|
331
|
+
input: dict[str, Any],
|
332
|
+
extra_input: Optional[dict] = None,
|
333
|
+
) -> dict:
|
336
334
|
"""Compute.
|
337
335
|
|
338
336
|
Parameters
|
@@ -8,8 +8,6 @@ from typing import (
|
|
8
8
|
TYPE_CHECKING,
|
9
9
|
Any,
|
10
10
|
ClassVar,
|
11
|
-
Dict,
|
12
|
-
List,
|
13
11
|
Optional,
|
14
12
|
Union,
|
15
13
|
)
|
@@ -61,10 +59,10 @@ class ComplexityBase(BaseMarker):
|
|
61
59
|
|
62
60
|
def __init__(
|
63
61
|
self,
|
64
|
-
parcellation: Union[str,
|
62
|
+
parcellation: Union[str, list[str]],
|
65
63
|
agg_method: str = "mean",
|
66
|
-
agg_method_params: Optional[
|
67
|
-
masks: Union[str,
|
64
|
+
agg_method_params: Optional[dict] = None,
|
65
|
+
masks: Union[str, dict, list[Union[dict, str]], None] = None,
|
68
66
|
name: Optional[str] = None,
|
69
67
|
) -> None:
|
70
68
|
self.parcellation = parcellation
|
@@ -86,9 +84,9 @@ class ComplexityBase(BaseMarker):
|
|
86
84
|
|
87
85
|
def compute(
|
88
86
|
self,
|
89
|
-
input:
|
90
|
-
extra_input: Optional[
|
91
|
-
) ->
|
87
|
+
input: dict[str, Any],
|
88
|
+
extra_input: Optional[dict[str, Any]] = None,
|
89
|
+
) -> dict[str, Any]:
|
92
90
|
"""Compute.
|
93
91
|
|
94
92
|
Parameters
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# Leonard Sasse <l.sasse@fz-juelich.de>
|
5
5
|
# License: AGPL
|
6
6
|
|
7
|
-
from typing import
|
7
|
+
from typing import Optional, Union
|
8
8
|
|
9
9
|
import neurokit2 as nk
|
10
10
|
import numpy as np
|
@@ -55,11 +55,11 @@ class HurstExponent(ComplexityBase):
|
|
55
55
|
|
56
56
|
def __init__(
|
57
57
|
self,
|
58
|
-
parcellation: Union[str,
|
58
|
+
parcellation: Union[str, list[str]],
|
59
59
|
agg_method: str = "mean",
|
60
|
-
agg_method_params: Optional[
|
61
|
-
masks: Union[str,
|
62
|
-
params: Optional[
|
60
|
+
agg_method_params: Optional[dict] = None,
|
61
|
+
masks: Union[str, dict, list[Union[dict, str]], None] = None,
|
62
|
+
params: Optional[dict] = None,
|
63
63
|
name: Optional[str] = None,
|
64
64
|
) -> None:
|
65
65
|
super().__init__(
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# Leonard Sasse <l.sasse@fz-juelich.de>
|
5
5
|
# License: AGPL
|
6
6
|
|
7
|
-
from typing import
|
7
|
+
from typing import Optional, Union
|
8
8
|
|
9
9
|
import neurokit2 as nk
|
10
10
|
import numpy as np
|
@@ -56,11 +56,11 @@ class MultiscaleEntropyAUC(ComplexityBase):
|
|
56
56
|
|
57
57
|
def __init__(
|
58
58
|
self,
|
59
|
-
parcellation: Union[str,
|
59
|
+
parcellation: Union[str, list[str]],
|
60
60
|
agg_method: str = "mean",
|
61
|
-
agg_method_params: Optional[
|
62
|
-
masks: Union[str,
|
63
|
-
params: Optional[
|
61
|
+
agg_method_params: Optional[dict] = None,
|
62
|
+
masks: Union[str, dict, list[Union[dict, str]], None] = None,
|
63
|
+
params: Optional[dict] = None,
|
64
64
|
name: Optional[str] = None,
|
65
65
|
) -> None:
|
66
66
|
super().__init__(
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# Leonard Sasse <l.sasse@fz-juelich.de>
|
5
5
|
# License: AGPL
|
6
6
|
|
7
|
-
from typing import
|
7
|
+
from typing import Optional, Union
|
8
8
|
|
9
9
|
import neurokit2 as nk
|
10
10
|
import numpy as np
|
@@ -56,11 +56,11 @@ class PermEntropy(ComplexityBase):
|
|
56
56
|
|
57
57
|
def __init__(
|
58
58
|
self,
|
59
|
-
parcellation: Union[str,
|
59
|
+
parcellation: Union[str, list[str]],
|
60
60
|
agg_method: str = "mean",
|
61
|
-
agg_method_params: Optional[
|
62
|
-
masks: Union[str,
|
63
|
-
params: Optional[
|
61
|
+
agg_method_params: Optional[dict] = None,
|
62
|
+
masks: Union[str, dict, list[Union[dict, str]], None] = None,
|
63
|
+
params: Optional[dict] = None,
|
64
64
|
name: Optional[str] = None,
|
65
65
|
) -> None:
|
66
66
|
super().__init__(
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# Leonard Sasse <l.sasse@fz-juelich.de>
|
5
5
|
# License: AGPL
|
6
6
|
|
7
|
-
from typing import
|
7
|
+
from typing import Optional, Union
|
8
8
|
|
9
9
|
import neurokit2 as nk
|
10
10
|
import numpy as np
|
@@ -56,11 +56,11 @@ class RangeEntropy(ComplexityBase):
|
|
56
56
|
|
57
57
|
def __init__(
|
58
58
|
self,
|
59
|
-
parcellation: Union[str,
|
59
|
+
parcellation: Union[str, list[str]],
|
60
60
|
agg_method: str = "mean",
|
61
|
-
agg_method_params: Optional[
|
62
|
-
masks: Union[str,
|
63
|
-
params: Optional[
|
61
|
+
agg_method_params: Optional[dict] = None,
|
62
|
+
masks: Union[str, dict, list[Union[dict, str]], None] = None,
|
63
|
+
params: Optional[dict] = None,
|
64
64
|
name: Optional[str] = None,
|
65
65
|
) -> None:
|
66
66
|
super().__init__(
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# Leonard Sasse <l.sasse@fz-juelich.de>
|
5
5
|
# License: AGPL
|
6
6
|
|
7
|
-
from typing import
|
7
|
+
from typing import Optional, Union
|
8
8
|
|
9
9
|
import neurokit2 as nk
|
10
10
|
import numpy as np
|
@@ -56,11 +56,11 @@ class RangeEntropyAUC(ComplexityBase):
|
|
56
56
|
|
57
57
|
def __init__(
|
58
58
|
self,
|
59
|
-
parcellation: Union[str,
|
59
|
+
parcellation: Union[str, list[str]],
|
60
60
|
agg_method: str = "mean",
|
61
|
-
agg_method_params: Optional[
|
62
|
-
masks: Union[str,
|
63
|
-
params: Optional[
|
61
|
+
agg_method_params: Optional[dict] = None,
|
62
|
+
masks: Union[str, dict, list[Union[dict, str]], None] = None,
|
63
|
+
params: Optional[dict] = None,
|
64
64
|
name: Optional[str] = None,
|
65
65
|
) -> None:
|
66
66
|
super().__init__(
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# Leonard Sasse <l.sasse@fz-juelich.de>
|
5
5
|
# License: AGPL
|
6
6
|
|
7
|
-
from typing import
|
7
|
+
from typing import Optional, Union
|
8
8
|
|
9
9
|
import neurokit2 as nk
|
10
10
|
import numpy as np
|
@@ -57,11 +57,11 @@ class SampleEntropy(ComplexityBase):
|
|
57
57
|
|
58
58
|
def __init__(
|
59
59
|
self,
|
60
|
-
parcellation: Union[str,
|
60
|
+
parcellation: Union[str, list[str]],
|
61
61
|
agg_method: str = "mean",
|
62
|
-
agg_method_params: Optional[
|
63
|
-
masks: Union[str,
|
64
|
-
params: Optional[
|
62
|
+
agg_method_params: Optional[dict] = None,
|
63
|
+
masks: Union[str, dict, list[Union[dict, str]], None] = None,
|
64
|
+
params: Optional[dict] = None,
|
65
65
|
name: Optional[str] = None,
|
66
66
|
) -> None:
|
67
67
|
super().__init__(
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# Leonard Sasse <l.sasse@fz-juelich.de>
|
5
5
|
# License: AGPL
|
6
6
|
|
7
|
-
from typing import
|
7
|
+
from typing import Optional, Union
|
8
8
|
|
9
9
|
import neurokit2 as nk
|
10
10
|
import numpy as np
|
@@ -57,11 +57,11 @@ class WeightedPermEntropy(ComplexityBase):
|
|
57
57
|
|
58
58
|
def __init__(
|
59
59
|
self,
|
60
|
-
parcellation: Union[str,
|
60
|
+
parcellation: Union[str, list[str]],
|
61
61
|
agg_method: str = "mean",
|
62
|
-
agg_method_params: Optional[
|
63
|
-
masks: Union[str,
|
64
|
-
params: Optional[
|
62
|
+
agg_method_params: Optional[dict] = None,
|
63
|
+
masks: Union[str, dict, list[Union[dict, str]], None] = None,
|
64
|
+
params: Optional[dict] = None,
|
65
65
|
name: Optional[str] = None,
|
66
66
|
) -> None:
|
67
67
|
super().__init__(
|
junifer/markers/ets_rss.py
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
7
7
|
# License: AGPL
|
8
8
|
|
9
|
-
from typing import Any, ClassVar,
|
9
|
+
from typing import Any, ClassVar, Optional, Union
|
10
10
|
|
11
11
|
import numpy as np
|
12
12
|
|
@@ -56,10 +56,10 @@ class RSSETSMarker(BaseMarker):
|
|
56
56
|
|
57
57
|
def __init__(
|
58
58
|
self,
|
59
|
-
parcellation: Union[str,
|
59
|
+
parcellation: Union[str, list[str]],
|
60
60
|
agg_method: str = "mean",
|
61
|
-
agg_method_params: Optional[
|
62
|
-
masks: Union[str,
|
61
|
+
agg_method_params: Optional[dict] = 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
|
@@ -70,9 +70,9 @@ class RSSETSMarker(BaseMarker):
|
|
70
70
|
|
71
71
|
def compute(
|
72
72
|
self,
|
73
|
-
input:
|
74
|
-
extra_input: Optional[
|
75
|
-
) ->
|
73
|
+
input: dict[str, Any],
|
74
|
+
extra_input: Optional[dict] = None,
|
75
|
+
) -> dict:
|
76
76
|
"""Compute.
|
77
77
|
|
78
78
|
Take a timeseries of brain areas, and calculate timeseries for each
|
@@ -9,7 +9,6 @@ from typing import (
|
|
9
9
|
TYPE_CHECKING,
|
10
10
|
ClassVar,
|
11
11
|
Optional,
|
12
|
-
Tuple,
|
13
12
|
)
|
14
13
|
|
15
14
|
import nibabel as nib
|
@@ -55,7 +54,7 @@ class AFNIALFF(metaclass=Singleton):
|
|
55
54
|
highpass: float,
|
56
55
|
lowpass: float,
|
57
56
|
tr: Optional[float],
|
58
|
-
) ->
|
57
|
+
) -> tuple["Nifti1Image", "Nifti1Image", Path, Path]:
|
59
58
|
"""Compute ALFF + fALFF map.
|
60
59
|
|
61
60
|
Parameters
|
@@ -9,7 +9,6 @@ from typing import (
|
|
9
9
|
TYPE_CHECKING,
|
10
10
|
ClassVar,
|
11
11
|
Optional,
|
12
|
-
Tuple,
|
13
12
|
)
|
14
13
|
|
15
14
|
import nibabel as nib
|
@@ -52,7 +51,7 @@ class JuniferALFF(metaclass=Singleton):
|
|
52
51
|
highpass: float,
|
53
52
|
lowpass: float,
|
54
53
|
tr: Optional[float],
|
55
|
-
) ->
|
54
|
+
) -> tuple["Nifti1Image", "Nifti1Image", Path, Path]:
|
56
55
|
"""Compute ALFF + fALFF map.
|
57
56
|
|
58
57
|
Parameters
|
@@ -11,9 +11,7 @@ from typing import (
|
|
11
11
|
TYPE_CHECKING,
|
12
12
|
Any,
|
13
13
|
ClassVar,
|
14
|
-
Dict,
|
15
14
|
Optional,
|
16
|
-
Tuple,
|
17
15
|
)
|
18
16
|
|
19
17
|
from ...typing import ConditionalDependencies, MarkerInOutMappings
|
@@ -116,8 +114,8 @@ class ALFFBase(BaseMarker):
|
|
116
114
|
|
117
115
|
def _compute(
|
118
116
|
self,
|
119
|
-
input_data:
|
120
|
-
) ->
|
117
|
+
input_data: dict[str, Any],
|
118
|
+
) -> tuple["Nifti1Image", "Nifti1Image", Path, Path]:
|
121
119
|
"""Compute ALFF and fALFF.
|
122
120
|
|
123
121
|
Parameters
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
7
7
|
# License: AGPL
|
8
8
|
|
9
|
-
from typing import Any,
|
9
|
+
from typing import Any, Optional, Union
|
10
10
|
|
11
11
|
from ...api.decorators import register_marker
|
12
12
|
from ...utils import logger
|
@@ -70,14 +70,14 @@ class ALFFParcels(ALFFBase):
|
|
70
70
|
|
71
71
|
def __init__(
|
72
72
|
self,
|
73
|
-
parcellation: Union[str,
|
73
|
+
parcellation: Union[str, list[str]],
|
74
74
|
using: str,
|
75
75
|
highpass: float = 0.01,
|
76
76
|
lowpass: float = 0.1,
|
77
77
|
tr: Optional[float] = None,
|
78
78
|
agg_method: str = "mean",
|
79
|
-
agg_method_params: Optional[
|
80
|
-
masks: Union[str,
|
79
|
+
agg_method_params: Optional[dict] = None,
|
80
|
+
masks: Union[str, dict, list[Union[dict, str]], None] = None,
|
81
81
|
name: Optional[str] = None,
|
82
82
|
) -> None:
|
83
83
|
# Superclass init first to validate `using` parameter
|
@@ -95,9 +95,9 @@ class ALFFParcels(ALFFBase):
|
|
95
95
|
|
96
96
|
def compute(
|
97
97
|
self,
|
98
|
-
input:
|
99
|
-
extra_input: Optional[
|
100
|
-
) ->
|
98
|
+
input: dict[str, Any],
|
99
|
+
extra_input: Optional[dict[str, Any]] = None,
|
100
|
+
) -> dict[str, Any]:
|
101
101
|
"""Compute.
|
102
102
|
|
103
103
|
Parameters
|
@@ -6,7 +6,7 @@
|
|
6
6
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
7
7
|
# License: AGPL
|
8
8
|
|
9
|
-
from typing import Any,
|
9
|
+
from typing import Any, Optional, Union
|
10
10
|
|
11
11
|
from ...api.decorators import register_marker
|
12
12
|
from ...utils import logger
|
@@ -85,8 +85,8 @@ class ALFFSpheres(ALFFBase):
|
|
85
85
|
lowpass: float = 0.1,
|
86
86
|
tr: Optional[float] = None,
|
87
87
|
agg_method: str = "mean",
|
88
|
-
agg_method_params: Optional[
|
89
|
-
masks: Union[str,
|
88
|
+
agg_method_params: Optional[dict] = None,
|
89
|
+
masks: Union[str, dict, list[Union[dict, str]], None] = None,
|
90
90
|
name: Optional[str] = None,
|
91
91
|
) -> None:
|
92
92
|
# Superclass init first to validate `using` parameter
|
@@ -106,9 +106,9 @@ class ALFFSpheres(ALFFBase):
|
|
106
106
|
|
107
107
|
def compute(
|
108
108
|
self,
|
109
|
-
input:
|
110
|
-
extra_input: Optional[
|
111
|
-
) ->
|
109
|
+
input: dict[str, Any],
|
110
|
+
extra_input: Optional[dict[str, Any]] = None,
|
111
|
+
) -> dict[str, Any]:
|
112
112
|
"""Compute.
|
113
113
|
|
114
114
|
Parameters
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# Kaustubh R. Patil <k.patil@fz-juelich.de>
|
5
5
|
# License: AGPL
|
6
6
|
|
7
|
-
from typing import Any, ClassVar,
|
7
|
+
from typing import Any, ClassVar, Optional, Union
|
8
8
|
|
9
9
|
import pandas as pd
|
10
10
|
|
@@ -63,9 +63,9 @@ class CrossParcellationFC(BaseMarker):
|
|
63
63
|
parcellation_one: str,
|
64
64
|
parcellation_two: str,
|
65
65
|
agg_method: str = "mean",
|
66
|
-
agg_method_params: Optional[
|
66
|
+
agg_method_params: Optional[dict] = None,
|
67
67
|
corr_method: str = "pearson",
|
68
|
-
masks: Union[str,
|
68
|
+
masks: Union[str, dict, list[Union[dict, str]], None] = None,
|
69
69
|
name: Optional[str] = None,
|
70
70
|
) -> None:
|
71
71
|
if parcellation_one == parcellation_two:
|
@@ -82,9 +82,9 @@ class CrossParcellationFC(BaseMarker):
|
|
82
82
|
|
83
83
|
def compute(
|
84
84
|
self,
|
85
|
-
input:
|
86
|
-
extra_input: Optional[
|
87
|
-
) ->
|
85
|
+
input: dict[str, Any],
|
86
|
+
extra_input: Optional[dict] = None,
|
87
|
+
) -> dict:
|
88
88
|
"""Compute.
|
89
89
|
|
90
90
|
Take a timeseries, parcellate them with two different parcellation
|