junifer 0.0.6.dev219__py3-none-any.whl → 0.0.6.dev227__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/__init__.pyi +2 -0
- junifer/_version.py +2 -2
- junifer/api/decorators.py +5 -4
- junifer/api/functions.py +9 -8
- junifer/datagrabber/multiple.py +2 -1
- junifer/markers/base.py +4 -7
- junifer/markers/brainprint.py +4 -4
- junifer/markers/complexity/complexity_base.py +3 -3
- junifer/markers/ets_rss.py +4 -3
- junifer/markers/falff/_afni_falff.py +3 -5
- junifer/markers/falff/_junifer_falff.py +3 -3
- junifer/markers/falff/falff_base.py +4 -6
- junifer/markers/functional_connectivity/crossparcellation_functional_connectivity.py +4 -3
- junifer/markers/functional_connectivity/functional_connectivity_base.py +4 -3
- junifer/markers/parcel_aggregation.py +4 -3
- junifer/markers/reho/_afni_reho.py +3 -5
- junifer/markers/reho/_junifer_reho.py +3 -3
- junifer/markers/reho/reho_base.py +4 -6
- junifer/markers/sphere_aggregation.py +4 -3
- junifer/markers/temporal_snr/temporal_snr_base.py +4 -3
- junifer/onthefly/_brainprint.py +4 -7
- junifer/onthefly/read_transform.py +3 -6
- junifer/pipeline/marker_collection.py +6 -12
- junifer/pipeline/pipeline_component_registry.py +3 -8
- junifer/pipeline/tests/test_pipeline_step_mixin.py +18 -19
- junifer/pipeline/tests/test_workdir_manager.py +1 -0
- junifer/preprocess/confounds/fmriprep_confound_remover.py +2 -2
- junifer/preprocess/smoothing/_afni_smoothing.py +4 -6
- junifer/preprocess/smoothing/_fsl_smoothing.py +4 -7
- junifer/preprocess/smoothing/_nilearn_smoothing.py +3 -3
- junifer/preprocess/smoothing/smoothing.py +3 -2
- junifer/preprocess/warping/_ants_warper.py +3 -5
- junifer/preprocess/warping/_fsl_warper.py +3 -5
- junifer/preprocess/warping/space_warper.py +3 -2
- junifer/preprocess/warping/tests/test_space_warper.py +4 -7
- junifer/typing/__init__.py +9 -0
- junifer/typing/__init__.pyi +23 -0
- junifer/typing/_typing.py +61 -0
- {junifer-0.0.6.dev219.dist-info → junifer-0.0.6.dev227.dist-info}/METADATA +2 -1
- {junifer-0.0.6.dev219.dist-info → junifer-0.0.6.dev227.dist-info}/RECORD +45 -42
- {junifer-0.0.6.dev219.dist-info → junifer-0.0.6.dev227.dist-info}/WHEEL +1 -1
- {junifer-0.0.6.dev219.dist-info → junifer-0.0.6.dev227.dist-info}/AUTHORS.rst +0 -0
- {junifer-0.0.6.dev219.dist-info → junifer-0.0.6.dev227.dist-info}/LICENSE.md +0 -0
- {junifer-0.0.6.dev219.dist-info → junifer-0.0.6.dev227.dist-info}/entry_points.txt +0 -0
- {junifer-0.0.6.dev219.dist-info → junifer-0.0.6.dev227.dist-info}/top_level.txt +0 -0
junifer/__init__.pyi
CHANGED
junifer/_version.py
CHANGED
@@ -12,5 +12,5 @@ __version__: str
|
|
12
12
|
__version_tuple__: VERSION_TUPLE
|
13
13
|
version_tuple: VERSION_TUPLE
|
14
14
|
|
15
|
-
__version__ = version = '0.0.6.
|
16
|
-
__version_tuple__ = version_tuple = (0, 0, 6, '
|
15
|
+
__version__ = version = '0.0.6.dev227'
|
16
|
+
__version_tuple__ = version_tuple = (0, 0, 6, 'dev227')
|
junifer/api/decorators.py
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
from typing import Type
|
9
9
|
|
10
10
|
from ..pipeline import PipelineComponentRegistry
|
11
|
+
from ..typing import DataGrabberLike, MarkerLike, PreprocessorLike, StorageLike
|
11
12
|
|
12
13
|
|
13
14
|
__all__ = [
|
@@ -19,7 +20,7 @@ __all__ = [
|
|
19
20
|
]
|
20
21
|
|
21
22
|
|
22
|
-
def register_datagrabber(klass:
|
23
|
+
def register_datagrabber(klass: DataGrabberLike) -> DataGrabberLike:
|
23
24
|
"""Register DataGrabber.
|
24
25
|
|
25
26
|
Registers the DataGrabber so it can be used by name.
|
@@ -73,7 +74,7 @@ def register_datareader(klass: Type) -> Type:
|
|
73
74
|
return klass
|
74
75
|
|
75
76
|
|
76
|
-
def register_preprocessor(klass:
|
77
|
+
def register_preprocessor(klass: PreprocessorLike) -> PreprocessorLike:
|
77
78
|
"""Preprocessor registration decorator.
|
78
79
|
|
79
80
|
Registers the preprocessor so it can be used by name.
|
@@ -96,7 +97,7 @@ def register_preprocessor(klass: Type) -> Type:
|
|
96
97
|
return klass
|
97
98
|
|
98
99
|
|
99
|
-
def register_marker(klass:
|
100
|
+
def register_marker(klass: MarkerLike) -> MarkerLike:
|
100
101
|
"""Marker registration decorator.
|
101
102
|
|
102
103
|
Registers the marker so it can be used by name.
|
@@ -119,7 +120,7 @@ def register_marker(klass: Type) -> Type:
|
|
119
120
|
return klass
|
120
121
|
|
121
122
|
|
122
|
-
def register_storage(klass:
|
123
|
+
def register_storage(klass: StorageLike) -> StorageLike:
|
123
124
|
"""Storage registration decorator.
|
124
125
|
|
125
126
|
Registers the storage so it can be used by name.
|
junifer/api/functions.py
CHANGED
@@ -11,22 +11,23 @@ from pathlib import Path
|
|
11
11
|
from typing import Dict, List, Optional, Tuple, Union
|
12
12
|
|
13
13
|
from ..api.queue_context import GnuParallelLocalAdapter, HTCondorAdapter
|
14
|
-
from ..datagrabber
|
15
|
-
from ..markers
|
14
|
+
from ..datagrabber import BaseDataGrabber
|
15
|
+
from ..markers import BaseMarker
|
16
16
|
from ..pipeline import (
|
17
17
|
MarkerCollection,
|
18
18
|
PipelineComponentRegistry,
|
19
19
|
WorkDirManager,
|
20
20
|
)
|
21
|
-
from ..preprocess
|
22
|
-
from ..storage
|
21
|
+
from ..preprocess import BasePreprocessor
|
22
|
+
from ..storage import BaseFeatureStorage
|
23
|
+
from ..typing import DataGrabberLike, MarkerLike, PreprocessorLike, StorageLike
|
23
24
|
from ..utils import logger, raise_error, yaml
|
24
25
|
|
25
26
|
|
26
27
|
__all__ = ["run", "collect", "queue", "reset", "list_elements"]
|
27
28
|
|
28
29
|
|
29
|
-
def _get_datagrabber(datagrabber_config: Dict) ->
|
30
|
+
def _get_datagrabber(datagrabber_config: Dict) -> DataGrabberLike:
|
30
31
|
"""Get DataGrabber.
|
31
32
|
|
32
33
|
Parameters
|
@@ -48,7 +49,7 @@ def _get_datagrabber(datagrabber_config: Dict) -> BaseDataGrabber:
|
|
48
49
|
)
|
49
50
|
|
50
51
|
|
51
|
-
def _get_preprocessor(preprocessing_config: Dict) ->
|
52
|
+
def _get_preprocessor(preprocessing_config: Dict) -> PreprocessorLike:
|
52
53
|
"""Get Preprocessor.
|
53
54
|
|
54
55
|
Parameters
|
@@ -70,7 +71,7 @@ def _get_preprocessor(preprocessing_config: Dict) -> BasePreprocessor:
|
|
70
71
|
)
|
71
72
|
|
72
73
|
|
73
|
-
def _get_marker(marker_config: Dict) ->
|
74
|
+
def _get_marker(marker_config: Dict) -> MarkerLike:
|
74
75
|
"""Get Marker.
|
75
76
|
|
76
77
|
Parameters
|
@@ -92,7 +93,7 @@ def _get_marker(marker_config: Dict) -> BaseMarker:
|
|
92
93
|
)
|
93
94
|
|
94
95
|
|
95
|
-
def _get_storage(storage_config: Dict) ->
|
96
|
+
def _get_storage(storage_config: Dict) -> StorageLike:
|
96
97
|
"""Get Storage.
|
97
98
|
|
98
99
|
Parameters
|
junifer/datagrabber/multiple.py
CHANGED
@@ -8,6 +8,7 @@
|
|
8
8
|
from typing import Dict, List, Tuple, Union
|
9
9
|
|
10
10
|
from ..api.decorators import register_datagrabber
|
11
|
+
from ..typing import DataGrabberLike
|
11
12
|
from ..utils import deep_update, raise_error
|
12
13
|
from .base import BaseDataGrabber
|
13
14
|
|
@@ -37,7 +38,7 @@ class MultipleDataGrabber(BaseDataGrabber):
|
|
37
38
|
|
38
39
|
"""
|
39
40
|
|
40
|
-
def __init__(self, datagrabbers: List[
|
41
|
+
def __init__(self, datagrabbers: List[DataGrabberLike], **kwargs) -> None:
|
41
42
|
# Check datagrabbers consistency
|
42
43
|
# Check for same element keys
|
43
44
|
first_keys = datagrabbers[0].get_element_keys()
|
junifer/markers/base.py
CHANGED
@@ -6,16 +6,13 @@
|
|
6
6
|
|
7
7
|
from abc import ABC, abstractmethod
|
8
8
|
from copy import deepcopy
|
9
|
-
from typing import
|
9
|
+
from typing import Any, Dict, List, Optional, Union
|
10
10
|
|
11
11
|
from ..pipeline import PipelineStepMixin, UpdateMetaMixin
|
12
|
+
from ..typing import StorageLike
|
12
13
|
from ..utils import logger, raise_error
|
13
14
|
|
14
15
|
|
15
|
-
if TYPE_CHECKING:
|
16
|
-
from junifer.storage import BaseFeatureStorage
|
17
|
-
|
18
|
-
|
19
16
|
__all__ = ["BaseMarker"]
|
20
17
|
|
21
18
|
|
@@ -159,7 +156,7 @@ class BaseMarker(ABC, PipelineStepMixin, UpdateMetaMixin):
|
|
159
156
|
type_: str,
|
160
157
|
feature: str,
|
161
158
|
out: Dict[str, Any],
|
162
|
-
storage:
|
159
|
+
storage: StorageLike,
|
163
160
|
) -> None:
|
164
161
|
"""Store.
|
165
162
|
|
@@ -182,7 +179,7 @@ class BaseMarker(ABC, PipelineStepMixin, UpdateMetaMixin):
|
|
182
179
|
def _fit_transform(
|
183
180
|
self,
|
184
181
|
input: Dict[str, Dict],
|
185
|
-
storage: Optional[
|
182
|
+
storage: Optional[StorageLike] = None,
|
186
183
|
) -> Dict:
|
187
184
|
"""Fit and transform.
|
188
185
|
|
junifer/markers/brainprint.py
CHANGED
@@ -11,7 +11,6 @@ from typing import (
|
|
11
11
|
Dict,
|
12
12
|
List,
|
13
13
|
Optional,
|
14
|
-
Set,
|
15
14
|
Union,
|
16
15
|
)
|
17
16
|
|
@@ -25,6 +24,7 @@ from ..external.BrainPrint.brainprint.brainprint import (
|
|
25
24
|
)
|
26
25
|
from ..external.BrainPrint.brainprint.surfaces import surf_to_vtk
|
27
26
|
from ..pipeline import WorkDirManager
|
27
|
+
from ..typing import Dependencies, ExternalDependencies, MarkerInOutMappings
|
28
28
|
from ..utils import logger, run_ext_cmd
|
29
29
|
from .base import BaseMarker
|
30
30
|
|
@@ -68,7 +68,7 @@ class BrainPrint(BaseMarker):
|
|
68
68
|
|
69
69
|
"""
|
70
70
|
|
71
|
-
_EXT_DEPENDENCIES: ClassVar[
|
71
|
+
_EXT_DEPENDENCIES: ClassVar[ExternalDependencies] = [
|
72
72
|
{
|
73
73
|
"name": "freesurfer",
|
74
74
|
"commands": [
|
@@ -80,9 +80,9 @@ class BrainPrint(BaseMarker):
|
|
80
80
|
},
|
81
81
|
]
|
82
82
|
|
83
|
-
_DEPENDENCIES: ClassVar[
|
83
|
+
_DEPENDENCIES: ClassVar[Dependencies] = {"lapy", "numpy"}
|
84
84
|
|
85
|
-
_MARKER_INOUT_MAPPINGS: ClassVar[
|
85
|
+
_MARKER_INOUT_MAPPINGS: ClassVar[MarkerInOutMappings] = {
|
86
86
|
"FreeSurfer": {
|
87
87
|
"eigenvalues": "scalar_table",
|
88
88
|
"areas": "vector",
|
@@ -11,10 +11,10 @@ from typing import (
|
|
11
11
|
Dict,
|
12
12
|
List,
|
13
13
|
Optional,
|
14
|
-
Set,
|
15
14
|
Union,
|
16
15
|
)
|
17
16
|
|
17
|
+
from ...typing import Dependencies, MarkerInOutMappings
|
18
18
|
from ...utils import raise_error
|
19
19
|
from ..base import BaseMarker
|
20
20
|
from ..parcel_aggregation import ParcelAggregation
|
@@ -51,9 +51,9 @@ class ComplexityBase(BaseMarker):
|
|
51
51
|
|
52
52
|
"""
|
53
53
|
|
54
|
-
_DEPENDENCIES: ClassVar[
|
54
|
+
_DEPENDENCIES: ClassVar[Dependencies] = {"nilearn", "neurokit2"}
|
55
55
|
|
56
|
-
_MARKER_INOUT_MAPPINGS: ClassVar[
|
56
|
+
_MARKER_INOUT_MAPPINGS: ClassVar[MarkerInOutMappings] = {
|
57
57
|
"BOLD": {
|
58
58
|
"complexity": "vector",
|
59
59
|
},
|
junifer/markers/ets_rss.py
CHANGED
@@ -6,11 +6,12 @@
|
|
6
6
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
7
7
|
# License: AGPL
|
8
8
|
|
9
|
-
from typing import Any, ClassVar, Dict, List, Optional,
|
9
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
10
10
|
|
11
11
|
import numpy as np
|
12
12
|
|
13
13
|
from ..api.decorators import register_marker
|
14
|
+
from ..typing import Dependencies, MarkerInOutMappings
|
14
15
|
from ..utils import logger
|
15
16
|
from .base import BaseMarker
|
16
17
|
from .parcel_aggregation import ParcelAggregation
|
@@ -45,9 +46,9 @@ class RSSETSMarker(BaseMarker):
|
|
45
46
|
|
46
47
|
"""
|
47
48
|
|
48
|
-
_DEPENDENCIES: ClassVar[
|
49
|
+
_DEPENDENCIES: ClassVar[Dependencies] = {"nilearn"}
|
49
50
|
|
50
|
-
_MARKER_INOUT_MAPPINGS: ClassVar[
|
51
|
+
_MARKER_INOUT_MAPPINGS: ClassVar[MarkerInOutMappings] = {
|
51
52
|
"BOLD": {
|
52
53
|
"rss_ets": "timeseries",
|
53
54
|
},
|
@@ -8,22 +8,20 @@ from pathlib import Path
|
|
8
8
|
from typing import (
|
9
9
|
TYPE_CHECKING,
|
10
10
|
ClassVar,
|
11
|
-
Dict,
|
12
|
-
List,
|
13
11
|
Optional,
|
14
12
|
Tuple,
|
15
|
-
Union,
|
16
13
|
)
|
17
14
|
|
18
15
|
import nibabel as nib
|
19
16
|
|
20
17
|
from ...pipeline import WorkDirManager
|
18
|
+
from ...typing import ExternalDependencies
|
21
19
|
from ...utils import logger, run_ext_cmd
|
22
20
|
from ...utils.singleton import Singleton
|
23
21
|
|
24
22
|
|
25
23
|
if TYPE_CHECKING:
|
26
|
-
from nibabel import Nifti1Image
|
24
|
+
from nibabel.nifti1 import Nifti1Image
|
27
25
|
|
28
26
|
|
29
27
|
__all__ = ["AFNIALFF"]
|
@@ -37,7 +35,7 @@ class AFNIALFF(metaclass=Singleton):
|
|
37
35
|
|
38
36
|
"""
|
39
37
|
|
40
|
-
_EXT_DEPENDENCIES: ClassVar[
|
38
|
+
_EXT_DEPENDENCIES: ClassVar[ExternalDependencies] = [
|
41
39
|
{
|
42
40
|
"name": "afni",
|
43
41
|
"commands": ["3dRSFC", "3dAFNItoNIFTI"],
|
@@ -9,7 +9,6 @@ from typing import (
|
|
9
9
|
TYPE_CHECKING,
|
10
10
|
ClassVar,
|
11
11
|
Optional,
|
12
|
-
Set,
|
13
12
|
Tuple,
|
14
13
|
)
|
15
14
|
|
@@ -19,12 +18,13 @@ import scipy as sp
|
|
19
18
|
from nilearn import image as nimg
|
20
19
|
|
21
20
|
from ...pipeline import WorkDirManager
|
21
|
+
from ...typing import Dependencies
|
22
22
|
from ...utils import logger
|
23
23
|
from ...utils.singleton import Singleton
|
24
24
|
|
25
25
|
|
26
26
|
if TYPE_CHECKING:
|
27
|
-
from nibabel import Nifti1Image
|
27
|
+
from nibabel.nifti1 import Nifti1Image
|
28
28
|
|
29
29
|
|
30
30
|
__all__ = ["JuniferALFF"]
|
@@ -37,7 +37,7 @@ class JuniferALFF(metaclass=Singleton):
|
|
37
37
|
|
38
38
|
"""
|
39
39
|
|
40
|
-
_DEPENDENCIES: ClassVar[
|
40
|
+
_DEPENDENCIES: ClassVar[Dependencies] = {"numpy", "nilearn", "scipy"}
|
41
41
|
|
42
42
|
def __del__(self) -> None:
|
43
43
|
"""Terminate the class."""
|
@@ -12,13 +12,11 @@ from typing import (
|
|
12
12
|
Any,
|
13
13
|
ClassVar,
|
14
14
|
Dict,
|
15
|
-
List,
|
16
15
|
Optional,
|
17
16
|
Tuple,
|
18
|
-
Type,
|
19
|
-
Union,
|
20
17
|
)
|
21
18
|
|
19
|
+
from ...typing import ConditionalDependencies, MarkerInOutMappings
|
22
20
|
from ...utils.logging import logger, raise_error
|
23
21
|
from ..base import BaseMarker
|
24
22
|
from ._afni_falff import AFNIALFF
|
@@ -26,7 +24,7 @@ from ._junifer_falff import JuniferALFF
|
|
26
24
|
|
27
25
|
|
28
26
|
if TYPE_CHECKING:
|
29
|
-
from nibabel import Nifti1Image
|
27
|
+
from nibabel.nifti1 import Nifti1Image
|
30
28
|
|
31
29
|
|
32
30
|
__all__ = ["ALFFBase"]
|
@@ -72,7 +70,7 @@ class ALFFBase(BaseMarker):
|
|
72
70
|
|
73
71
|
"""
|
74
72
|
|
75
|
-
_CONDITIONAL_DEPENDENCIES: ClassVar[
|
73
|
+
_CONDITIONAL_DEPENDENCIES: ClassVar[ConditionalDependencies] = [
|
76
74
|
{
|
77
75
|
"using": "afni",
|
78
76
|
"depends_on": AFNIALFF,
|
@@ -83,7 +81,7 @@ class ALFFBase(BaseMarker):
|
|
83
81
|
},
|
84
82
|
]
|
85
83
|
|
86
|
-
_MARKER_INOUT_MAPPINGS: ClassVar[
|
84
|
+
_MARKER_INOUT_MAPPINGS: ClassVar[MarkerInOutMappings] = {
|
87
85
|
"BOLD": {
|
88
86
|
"alff": "vector",
|
89
87
|
"falff": "vector",
|
@@ -4,11 +4,12 @@
|
|
4
4
|
# Kaustubh R. Patil <k.patil@fz-juelich.de>
|
5
5
|
# License: AGPL
|
6
6
|
|
7
|
-
from typing import Any, ClassVar, Dict, List, Optional,
|
7
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
8
8
|
|
9
9
|
import pandas as pd
|
10
10
|
|
11
11
|
from ...api.decorators import register_marker
|
12
|
+
from ...typing import Dependencies, MarkerInOutMappings
|
12
13
|
from ...utils import logger, raise_error
|
13
14
|
from ..base import BaseMarker
|
14
15
|
from ..parcel_aggregation import ParcelAggregation
|
@@ -49,9 +50,9 @@ class CrossParcellationFC(BaseMarker):
|
|
49
50
|
|
50
51
|
"""
|
51
52
|
|
52
|
-
_DEPENDENCIES: ClassVar[
|
53
|
+
_DEPENDENCIES: ClassVar[Dependencies] = {"nilearn"}
|
53
54
|
|
54
|
-
_MARKER_INOUT_MAPPINGS: ClassVar[
|
55
|
+
_MARKER_INOUT_MAPPINGS: ClassVar[MarkerInOutMappings] = {
|
55
56
|
"BOLD": {
|
56
57
|
"functional_connectivity": "matrix",
|
57
58
|
},
|
@@ -5,11 +5,12 @@
|
|
5
5
|
|
6
6
|
|
7
7
|
from abc import abstractmethod
|
8
|
-
from typing import Any, ClassVar, Dict, List, Optional,
|
8
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
9
9
|
|
10
10
|
from sklearn.covariance import EmpiricalCovariance, LedoitWolf
|
11
11
|
|
12
12
|
from ...external.nilearn import JuniferConnectivityMeasure
|
13
|
+
from ...typing import Dependencies, MarkerInOutMappings
|
13
14
|
from ...utils import raise_error
|
14
15
|
from ..base import BaseMarker
|
15
16
|
|
@@ -51,9 +52,9 @@ class FunctionalConnectivityBase(BaseMarker):
|
|
51
52
|
|
52
53
|
"""
|
53
54
|
|
54
|
-
_DEPENDENCIES: ClassVar[
|
55
|
+
_DEPENDENCIES: ClassVar[Dependencies] = {"nilearn", "scikit-learn"}
|
55
56
|
|
56
|
-
_MARKER_INOUT_MAPPINGS: ClassVar[
|
57
|
+
_MARKER_INOUT_MAPPINGS: ClassVar[MarkerInOutMappings] = {
|
57
58
|
"BOLD": {
|
58
59
|
"functional_connectivity": "matrix",
|
59
60
|
},
|
@@ -4,7 +4,7 @@
|
|
4
4
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
5
5
|
# License: AGPL
|
6
6
|
|
7
|
-
from typing import Any, ClassVar, Dict, List, Optional,
|
7
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
8
8
|
|
9
9
|
import numpy as np
|
10
10
|
from nilearn.image import math_img
|
@@ -13,6 +13,7 @@ from nilearn.maskers import NiftiMasker
|
|
13
13
|
from ..api.decorators import register_marker
|
14
14
|
from ..data import get_data
|
15
15
|
from ..stats import get_aggfunc_by_name
|
16
|
+
from ..typing import Dependencies, MarkerInOutMappings
|
16
17
|
from ..utils import logger, raise_error, warn_with_log
|
17
18
|
from .base import BaseMarker
|
18
19
|
|
@@ -61,9 +62,9 @@ class ParcelAggregation(BaseMarker):
|
|
61
62
|
|
62
63
|
"""
|
63
64
|
|
64
|
-
_DEPENDENCIES: ClassVar[
|
65
|
+
_DEPENDENCIES: ClassVar[Dependencies] = {"nilearn", "numpy"}
|
65
66
|
|
66
|
-
_MARKER_INOUT_MAPPINGS: ClassVar[
|
67
|
+
_MARKER_INOUT_MAPPINGS: ClassVar[MarkerInOutMappings] = {
|
67
68
|
"T1w": {
|
68
69
|
"aggregation": "vector",
|
69
70
|
},
|
@@ -8,22 +8,20 @@ from pathlib import Path
|
|
8
8
|
from typing import (
|
9
9
|
TYPE_CHECKING,
|
10
10
|
ClassVar,
|
11
|
-
Dict,
|
12
|
-
List,
|
13
11
|
Optional,
|
14
12
|
Tuple,
|
15
|
-
Union,
|
16
13
|
)
|
17
14
|
|
18
15
|
import nibabel as nib
|
19
16
|
|
20
17
|
from ...pipeline import WorkDirManager
|
18
|
+
from ...typing import ExternalDependencies
|
21
19
|
from ...utils import logger, run_ext_cmd
|
22
20
|
from ...utils.singleton import Singleton
|
23
21
|
|
24
22
|
|
25
23
|
if TYPE_CHECKING:
|
26
|
-
from nibabel import Nifti1Image
|
24
|
+
from nibabel.nifti1 import Nifti1Image
|
27
25
|
|
28
26
|
|
29
27
|
__all__ = ["AFNIReHo"]
|
@@ -37,7 +35,7 @@ class AFNIReHo(metaclass=Singleton):
|
|
37
35
|
|
38
36
|
"""
|
39
37
|
|
40
|
-
_EXT_DEPENDENCIES: ClassVar[
|
38
|
+
_EXT_DEPENDENCIES: ClassVar[ExternalDependencies] = [
|
41
39
|
{
|
42
40
|
"name": "afni",
|
43
41
|
"commands": ["3dReHo", "3dAFNItoNIFTI"],
|
@@ -9,7 +9,6 @@ from pathlib import Path
|
|
9
9
|
from typing import (
|
10
10
|
TYPE_CHECKING,
|
11
11
|
ClassVar,
|
12
|
-
Set,
|
13
12
|
Tuple,
|
14
13
|
)
|
15
14
|
|
@@ -20,12 +19,13 @@ from nilearn import image as nimg
|
|
20
19
|
from nilearn import masking as nmask
|
21
20
|
|
22
21
|
from ...pipeline import WorkDirManager
|
22
|
+
from ...typing import Dependencies
|
23
23
|
from ...utils import logger, raise_error
|
24
24
|
from ...utils.singleton import Singleton
|
25
25
|
|
26
26
|
|
27
27
|
if TYPE_CHECKING:
|
28
|
-
from nibabel import Nifti1Image
|
28
|
+
from nibabel.nifti1 import Nifti1Image
|
29
29
|
|
30
30
|
|
31
31
|
__all__ = ["JuniferReHo"]
|
@@ -38,7 +38,7 @@ class JuniferReHo(metaclass=Singleton):
|
|
38
38
|
|
39
39
|
"""
|
40
40
|
|
41
|
-
_DEPENDENCIES: ClassVar[
|
41
|
+
_DEPENDENCIES: ClassVar[Dependencies] = {"numpy", "nilearn", "scipy"}
|
42
42
|
|
43
43
|
def __del__(self) -> None:
|
44
44
|
"""Terminate the class."""
|
@@ -10,13 +10,11 @@ from typing import (
|
|
10
10
|
Any,
|
11
11
|
ClassVar,
|
12
12
|
Dict,
|
13
|
-
List,
|
14
13
|
Optional,
|
15
14
|
Tuple,
|
16
|
-
Type,
|
17
|
-
Union,
|
18
15
|
)
|
19
16
|
|
17
|
+
from ...typing import ConditionalDependencies, MarkerInOutMappings
|
20
18
|
from ...utils import logger, raise_error
|
21
19
|
from ..base import BaseMarker
|
22
20
|
from ._afni_reho import AFNIReHo
|
@@ -24,7 +22,7 @@ from ._junifer_reho import JuniferReHo
|
|
24
22
|
|
25
23
|
|
26
24
|
if TYPE_CHECKING:
|
27
|
-
from nibabel import Nifti1Image
|
25
|
+
from nibabel.nifti1 import Nifti1Image
|
28
26
|
|
29
27
|
__all__ = ["ReHoBase"]
|
30
28
|
|
@@ -51,7 +49,7 @@ class ReHoBase(BaseMarker):
|
|
51
49
|
|
52
50
|
"""
|
53
51
|
|
54
|
-
_CONDITIONAL_DEPENDENCIES: ClassVar[
|
52
|
+
_CONDITIONAL_DEPENDENCIES: ClassVar[ConditionalDependencies] = [
|
55
53
|
{
|
56
54
|
"using": "afni",
|
57
55
|
"depends_on": AFNIReHo,
|
@@ -62,7 +60,7 @@ class ReHoBase(BaseMarker):
|
|
62
60
|
},
|
63
61
|
]
|
64
62
|
|
65
|
-
_MARKER_INOUT_MAPPINGS: ClassVar[
|
63
|
+
_MARKER_INOUT_MAPPINGS: ClassVar[MarkerInOutMappings] = {
|
66
64
|
"BOLD": {
|
67
65
|
"reho": "vector",
|
68
66
|
},
|
@@ -4,12 +4,13 @@
|
|
4
4
|
# Synchon Mandal <s.mandal@fz-juelich.de>
|
5
5
|
# License: AGPL
|
6
6
|
|
7
|
-
from typing import Any, ClassVar, Dict, List, Optional,
|
7
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
8
8
|
|
9
9
|
from ..api.decorators import register_marker
|
10
10
|
from ..data import get_data
|
11
11
|
from ..external.nilearn import JuniferNiftiSpheresMasker
|
12
12
|
from ..stats import get_aggfunc_by_name
|
13
|
+
from ..typing import Dependencies, MarkerInOutMappings
|
13
14
|
from ..utils import logger, raise_error, warn_with_log
|
14
15
|
from .base import BaseMarker
|
15
16
|
|
@@ -66,9 +67,9 @@ class SphereAggregation(BaseMarker):
|
|
66
67
|
|
67
68
|
"""
|
68
69
|
|
69
|
-
_DEPENDENCIES: ClassVar[
|
70
|
+
_DEPENDENCIES: ClassVar[Dependencies] = {"nilearn", "numpy"}
|
70
71
|
|
71
|
-
_MARKER_INOUT_MAPPINGS: ClassVar[
|
72
|
+
_MARKER_INOUT_MAPPINGS: ClassVar[MarkerInOutMappings] = {
|
72
73
|
"T1w": {
|
73
74
|
"aggregation": "vector",
|
74
75
|
},
|
@@ -5,10 +5,11 @@
|
|
5
5
|
|
6
6
|
|
7
7
|
from abc import abstractmethod
|
8
|
-
from typing import Any, ClassVar, Dict, List, Optional,
|
8
|
+
from typing import Any, ClassVar, Dict, List, Optional, Union
|
9
9
|
|
10
10
|
from nilearn import image as nimg
|
11
11
|
|
12
|
+
from ...typing import Dependencies, MarkerInOutMappings
|
12
13
|
from ...utils import raise_error
|
13
14
|
from ..base import BaseMarker
|
14
15
|
|
@@ -37,9 +38,9 @@ class TemporalSNRBase(BaseMarker):
|
|
37
38
|
|
38
39
|
"""
|
39
40
|
|
40
|
-
_DEPENDENCIES: ClassVar[
|
41
|
+
_DEPENDENCIES: ClassVar[Dependencies] = {"nilearn"}
|
41
42
|
|
42
|
-
_MARKER_INOUT_MAPPINGS: ClassVar[
|
43
|
+
_MARKER_INOUT_MAPPINGS: ClassVar[MarkerInOutMappings] = {
|
43
44
|
"BOLD": {
|
44
45
|
"tsnr": "vector",
|
45
46
|
},
|
junifer/onthefly/_brainprint.py
CHANGED
@@ -3,23 +3,20 @@
|
|
3
3
|
# Authors: Synchon Mandal <s.mandal@fz-juelich.de>
|
4
4
|
# License: AGPL
|
5
5
|
|
6
|
-
from typing import
|
6
|
+
from typing import Dict, Optional
|
7
7
|
|
8
8
|
import numpy as np
|
9
9
|
import pandas as pd
|
10
10
|
|
11
|
+
from ..typing import StorageLike
|
11
12
|
from ..utils import raise_error
|
12
13
|
|
13
14
|
|
14
|
-
if TYPE_CHECKING:
|
15
|
-
from junifer.storage import BaseFeatureStorage
|
16
|
-
|
17
|
-
|
18
15
|
__all__ = ["normalize", "reweight"]
|
19
16
|
|
20
17
|
|
21
18
|
def normalize(
|
22
|
-
storage:
|
19
|
+
storage: StorageLike,
|
23
20
|
features: Dict[str, Dict[str, Optional[str]]],
|
24
21
|
kind: str,
|
25
22
|
) -> pd.DataFrame:
|
@@ -89,7 +86,7 @@ def normalize(
|
|
89
86
|
|
90
87
|
|
91
88
|
def reweight(
|
92
|
-
storage:
|
89
|
+
storage: StorageLike,
|
93
90
|
feature_name: Optional[str] = None,
|
94
91
|
feature_md5: Optional[str] = None,
|
95
92
|
) -> pd.DataFrame:
|
@@ -4,22 +4,19 @@
|
|
4
4
|
# License: AGPL
|
5
5
|
|
6
6
|
|
7
|
-
from typing import
|
7
|
+
from typing import Dict, Optional, Tuple
|
8
8
|
|
9
9
|
import pandas as pd
|
10
10
|
|
11
|
+
from ..typing import StorageLike
|
11
12
|
from ..utils import logger, raise_error, warn_with_log
|
12
13
|
|
13
14
|
|
14
|
-
if TYPE_CHECKING:
|
15
|
-
from junifer.storage import BaseFeatureStorage
|
16
|
-
|
17
|
-
|
18
15
|
__all__ = ["read_transform"]
|
19
16
|
|
20
17
|
|
21
18
|
def read_transform(
|
22
|
-
storage:
|
19
|
+
storage: StorageLike,
|
23
20
|
transform: str,
|
24
21
|
feature_name: Optional[str] = None,
|
25
22
|
feature_md5: Optional[str] = None,
|