siibra 1.0.1a0__tar.gz → 1.0.1a2__tar.gz
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.
Potentially problematic release.
This version of siibra might be problematic. Click here for more details.
- {siibra-1.0.1a0/siibra.egg-info → siibra-1.0.1a2}/PKG-INFO +21 -8
- {siibra-1.0.1a0 → siibra-1.0.1a2}/README.rst +10 -6
- siibra-1.0.1a2/siibra/VERSION +1 -0
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/__init__.py +11 -20
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/commons.py +17 -14
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/configuration/__init__.py +1 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/configuration/configuration.py +6 -6
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/configuration/factory.py +10 -9
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/core/__init__.py +2 -2
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/core/assignment.py +2 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/core/atlas.py +4 -4
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/core/concept.py +7 -5
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/core/parcellation.py +10 -10
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/core/region.py +82 -73
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/core/space.py +5 -7
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/core/structure.py +4 -4
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/exceptions.py +6 -2
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/explorer/__init__.py +1 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/explorer/url.py +2 -2
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/explorer/util.py +1 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/__init__.py +1 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/anchor.py +4 -6
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/connectivity/__init__.py +1 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/connectivity/functional_connectivity.py +1 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/connectivity/regional_connectivity.py +12 -15
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/connectivity/streamline_counts.py +1 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/connectivity/streamline_lengths.py +1 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/connectivity/tracing_connectivity.py +1 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/dataset/__init__.py +1 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/dataset/ebrains.py +2 -2
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/feature.py +31 -28
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/image/__init__.py +5 -3
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/image/image.py +4 -6
- siibra-1.0.1a2/siibra/features/image/sections.py +105 -0
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/image/volume_of_interest.py +1 -9
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/tabular/__init__.py +2 -2
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/tabular/bigbrain_intensity_profile.py +3 -2
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/tabular/cell_density_profile.py +10 -11
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/tabular/cortical_profile.py +9 -9
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/tabular/gene_expression.py +7 -6
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/tabular/layerwise_bigbrain_intensities.py +5 -4
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/tabular/layerwise_cell_density.py +5 -7
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/tabular/receptor_density_fingerprint.py +47 -19
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/tabular/receptor_density_profile.py +2 -3
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/tabular/regional_timeseries_activity.py +9 -9
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/features/tabular/tabular.py +10 -9
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/livequeries/__init__.py +1 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/livequeries/allen.py +23 -25
- siibra-1.0.1a2/siibra/livequeries/bigbrain.py +394 -0
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/livequeries/ebrains.py +14 -11
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/livequeries/query.py +5 -5
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/locations/__init__.py +19 -10
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/locations/boundingbox.py +10 -13
- siibra-1.0.1a0/siibra/experimental/plane3d.py → siibra-1.0.1a2/siibra/locations/experimental.py +117 -17
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/locations/location.py +11 -13
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/locations/point.py +10 -19
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/locations/pointcloud.py +59 -23
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/retrieval/__init__.py +1 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/retrieval/cache.py +2 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/retrieval/datasets.py +23 -17
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/retrieval/exceptions/__init__.py +1 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/retrieval/repositories.py +14 -15
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/retrieval/requests.py +32 -30
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/vocabularies/__init__.py +2 -3
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/volumes/__init__.py +5 -4
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/volumes/parcellationmap.py +55 -20
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/volumes/providers/__init__.py +1 -1
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/volumes/providers/freesurfer.py +7 -7
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/volumes/providers/gifti.py +5 -5
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/volumes/providers/neuroglancer.py +25 -28
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/volumes/providers/nifti.py +7 -7
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/volumes/providers/provider.py +4 -3
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/volumes/sparsemap.py +8 -7
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/volumes/volume.py +33 -40
- {siibra-1.0.1a0 → siibra-1.0.1a2/siibra.egg-info}/PKG-INFO +21 -8
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra.egg-info/SOURCES.txt +1 -5
- siibra-1.0.1a0/siibra/VERSION +0 -1
- siibra-1.0.1a0/siibra/experimental/__init__.py +0 -19
- siibra-1.0.1a0/siibra/experimental/contour.py +0 -61
- siibra-1.0.1a0/siibra/experimental/cortical_profile_sampler.py +0 -57
- siibra-1.0.1a0/siibra/experimental/patch.py +0 -98
- siibra-1.0.1a0/siibra/features/image/sections.py +0 -26
- siibra-1.0.1a0/siibra/livequeries/bigbrain.py +0 -197
- {siibra-1.0.1a0 → siibra-1.0.1a2}/LICENSE +0 -0
- {siibra-1.0.1a0 → siibra-1.0.1a2}/MANIFEST.in +0 -0
- {siibra-1.0.1a0 → siibra-1.0.1a2}/setup.cfg +0 -0
- {siibra-1.0.1a0 → siibra-1.0.1a2}/setup.py +0 -0
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/vocabularies/gene_names.json +0 -0
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/vocabularies/receptor_symbols.json +0 -0
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra/vocabularies/region_aliases.json +0 -0
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra.egg-info/dependency_links.txt +0 -0
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra.egg-info/requires.txt +0 -0
- {siibra-1.0.1a0 → siibra-1.0.1a2}/siibra.egg-info/top_level.txt +0 -0
- {siibra-1.0.1a0 → siibra-1.0.1a2}/test/test_siibra.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.2
|
|
2
2
|
Name: siibra
|
|
3
|
-
Version: 1.0.
|
|
3
|
+
Version: 1.0.1a2
|
|
4
4
|
Summary: siibra - Software interfaces for interacting with brain atlases
|
|
5
5
|
Home-page: https://github.com/FZJ-INM1-BDA/siibra-python
|
|
6
6
|
Author: Big Data Analytics Group, Forschungszentrum Juelich, Institute of Neuroscience and Medicine (INM-1)
|
|
@@ -27,6 +27,15 @@ Requires-Dist: nilearn
|
|
|
27
27
|
Requires-Dist: typing-extensions; python_version < "3.8"
|
|
28
28
|
Requires-Dist: filelock
|
|
29
29
|
Requires-Dist: ebrains-drive>=0.6.0
|
|
30
|
+
Dynamic: author
|
|
31
|
+
Dynamic: author-email
|
|
32
|
+
Dynamic: classifier
|
|
33
|
+
Dynamic: description
|
|
34
|
+
Dynamic: description-content-type
|
|
35
|
+
Dynamic: home-page
|
|
36
|
+
Dynamic: requires-dist
|
|
37
|
+
Dynamic: requires-python
|
|
38
|
+
Dynamic: summary
|
|
30
39
|
|
|
31
40
|
|License| |PyPI version| |doi| |Python versions| |Documentation Status|
|
|
32
41
|
|
|
@@ -34,7 +43,7 @@ Requires-Dist: ebrains-drive>=0.6.0
|
|
|
34
43
|
siibra - Software interface for interacting with brain atlases
|
|
35
44
|
==============================================================
|
|
36
45
|
|
|
37
|
-
Copyright
|
|
46
|
+
Copyright 2018-2024, Forschungszentrum Jülich GmbH
|
|
38
47
|
|
|
39
48
|
*Authors: Big Data Analytics Group, Institute of Neuroscience and
|
|
40
49
|
Medicine (INM-1), Forschungszentrum Jülich GmbH*
|
|
@@ -50,6 +59,14 @@ It aims to facilitate programmatic and reproducible incorporation of brain parce
|
|
|
50
59
|
It supports both discretely labelled and statistical (probabilistic) parcellation maps, which can be used to assign brain regions to spatial locations and image signals, to retrieve region-specific neuroscience datasets from multiple online repositories, and to sample information from high-resolution image data.
|
|
51
60
|
The datasets anchored to brain regions address features of molecular, cellular and architecture as well as connectivity, and are complemented with live queries to external repositories as well as dynamic extraction from "big" image volumes such as the 20 micrometer BigBrain model.
|
|
52
61
|
|
|
62
|
+
``siibra`` hides much of the complexity that would be required to collect and interact with the individual parcellations, templates and data repositories.
|
|
63
|
+
By encapsulating many aspects of interacting with different maps and reference templates spaces, it also minimizes common errors like misinterpretation of coordinates from different reference spaces, confusing label indices of brain regions, or using inconsistent versions of parcellation maps.
|
|
64
|
+
It aims to provide a safe way of using maps defined across multiple spatial scales for reproducible analysis.
|
|
65
|
+
|
|
66
|
+
.. intro-end
|
|
67
|
+
|
|
68
|
+
.. about-start
|
|
69
|
+
|
|
53
70
|
``siibra`` was developed in the frame of the `Human Brain Project <https://humanbrainproject.eu>`__ for accessing the `EBRAINS
|
|
54
71
|
human brain atlas <https://ebrains.eu/service/human-brain-atlas>`__.
|
|
55
72
|
It stores most of its contents as sustainable and open datasets in the `EBRAINS Knowledge Graph <https://kg.ebrains.eu>`__, and is designed to support the `OpenMINDS metadata standards <https://github.com/HumanBrainProject/openMINDS_SANDS>`__.
|
|
@@ -58,11 +75,7 @@ In fact, the viewer is a good resource for exploring ``siibra``\ ’s core funct
|
|
|
58
75
|
Feature queries in ``siibra`` are parameterized by data modality and anatomical location, while the latter could be a brain region, brain parcellation, or location in reference space.
|
|
59
76
|
Beyond the explorative focus of ``siibra-explorer``, the Python library supports a range of data analysis functions suitable for typical neuroscience workflows.
|
|
60
77
|
|
|
61
|
-
|
|
62
|
-
By encapsulating many aspects of interacting with different maps and reference templates spaces, it also minimizes common errors like misinterpretation of coordinates from different reference spaces, confusing label indices of brain regions, or using inconsistent versions of parcellation maps.
|
|
63
|
-
It aims to provide a safe way of using maps defined across multiple spatial scales for reproducible analysis.
|
|
64
|
-
|
|
65
|
-
.. intro-end
|
|
78
|
+
.. about-end
|
|
66
79
|
|
|
67
80
|
.. getting-started-start
|
|
68
81
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
siibra - Software interface for interacting with brain atlases
|
|
5
5
|
==============================================================
|
|
6
6
|
|
|
7
|
-
Copyright
|
|
7
|
+
Copyright 2018-2024, Forschungszentrum Jülich GmbH
|
|
8
8
|
|
|
9
9
|
*Authors: Big Data Analytics Group, Institute of Neuroscience and
|
|
10
10
|
Medicine (INM-1), Forschungszentrum Jülich GmbH*
|
|
@@ -20,6 +20,14 @@ It aims to facilitate programmatic and reproducible incorporation of brain parce
|
|
|
20
20
|
It supports both discretely labelled and statistical (probabilistic) parcellation maps, which can be used to assign brain regions to spatial locations and image signals, to retrieve region-specific neuroscience datasets from multiple online repositories, and to sample information from high-resolution image data.
|
|
21
21
|
The datasets anchored to brain regions address features of molecular, cellular and architecture as well as connectivity, and are complemented with live queries to external repositories as well as dynamic extraction from "big" image volumes such as the 20 micrometer BigBrain model.
|
|
22
22
|
|
|
23
|
+
``siibra`` hides much of the complexity that would be required to collect and interact with the individual parcellations, templates and data repositories.
|
|
24
|
+
By encapsulating many aspects of interacting with different maps and reference templates spaces, it also minimizes common errors like misinterpretation of coordinates from different reference spaces, confusing label indices of brain regions, or using inconsistent versions of parcellation maps.
|
|
25
|
+
It aims to provide a safe way of using maps defined across multiple spatial scales for reproducible analysis.
|
|
26
|
+
|
|
27
|
+
.. intro-end
|
|
28
|
+
|
|
29
|
+
.. about-start
|
|
30
|
+
|
|
23
31
|
``siibra`` was developed in the frame of the `Human Brain Project <https://humanbrainproject.eu>`__ for accessing the `EBRAINS
|
|
24
32
|
human brain atlas <https://ebrains.eu/service/human-brain-atlas>`__.
|
|
25
33
|
It stores most of its contents as sustainable and open datasets in the `EBRAINS Knowledge Graph <https://kg.ebrains.eu>`__, and is designed to support the `OpenMINDS metadata standards <https://github.com/HumanBrainProject/openMINDS_SANDS>`__.
|
|
@@ -28,11 +36,7 @@ In fact, the viewer is a good resource for exploring ``siibra``\ ’s core funct
|
|
|
28
36
|
Feature queries in ``siibra`` are parameterized by data modality and anatomical location, while the latter could be a brain region, brain parcellation, or location in reference space.
|
|
29
37
|
Beyond the explorative focus of ``siibra-explorer``, the Python library supports a range of data analysis functions suitable for typical neuroscience workflows.
|
|
30
38
|
|
|
31
|
-
|
|
32
|
-
By encapsulating many aspects of interacting with different maps and reference templates spaces, it also minimizes common errors like misinterpretation of coordinates from different reference spaces, confusing label indices of brain regions, or using inconsistent versions of parcellation maps.
|
|
33
|
-
It aims to provide a safe way of using maps defined across multiple spatial scales for reproducible analysis.
|
|
34
|
-
|
|
35
|
-
.. intro-end
|
|
39
|
+
.. about-end
|
|
36
40
|
|
|
37
41
|
.. getting-started-start
|
|
38
42
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
1.0.1-alpha.2
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2018-
|
|
1
|
+
# Copyright 2018-2025
|
|
2
2
|
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
|
|
3
3
|
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,35 +13,29 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
+
import os as _os
|
|
17
|
+
|
|
16
18
|
from .commons import (
|
|
17
19
|
logger,
|
|
18
20
|
QUIET,
|
|
19
21
|
VERBOSE,
|
|
20
22
|
MapType,
|
|
21
|
-
MapIndex,
|
|
22
23
|
set_log_level,
|
|
23
24
|
__version__
|
|
24
25
|
)
|
|
25
|
-
|
|
26
|
+
from . import configuration, features, livequeries
|
|
27
|
+
from .configuration import factory
|
|
26
28
|
from .core import (
|
|
27
29
|
atlas as _atlas,
|
|
28
30
|
parcellation as _parcellation,
|
|
29
31
|
space as _space
|
|
30
32
|
)
|
|
31
33
|
from .volumes import parcellationmap as _parcellationmap
|
|
32
|
-
from .retrieval.requests import
|
|
33
|
-
EbrainsRequest as _EbrainsRequest,
|
|
34
|
-
CACHE as cache
|
|
35
|
-
)
|
|
34
|
+
from .retrieval.requests import CACHE as cache
|
|
36
35
|
from .retrieval.cache import Warmup, WarmupLevel
|
|
36
|
+
from .locations import Point, PointCloud, Plane, BoundingBox
|
|
37
37
|
|
|
38
|
-
from . import configuration
|
|
39
|
-
from . import experimental
|
|
40
|
-
from .configuration import factory
|
|
41
|
-
from . import features, livequeries
|
|
42
|
-
from siibra.locations import Point, PointCloud
|
|
43
38
|
|
|
44
|
-
import os as _os
|
|
45
39
|
logger.info(f"Version: {__version__}")
|
|
46
40
|
logger.warning("This is a development release. Use at your own risk.")
|
|
47
41
|
logger.info(
|
|
@@ -49,8 +43,6 @@ logger.info(
|
|
|
49
43
|
)
|
|
50
44
|
|
|
51
45
|
# forward access to some functions
|
|
52
|
-
set_ebrains_token = _EbrainsRequest.set_token
|
|
53
|
-
fetch_ebrains_token = _EbrainsRequest.fetch_token
|
|
54
46
|
find_regions = _parcellation.find_regions
|
|
55
47
|
from_json = factory.Factory.from_json
|
|
56
48
|
|
|
@@ -108,7 +100,7 @@ def set_feasible_download_size(maxsize_gbyte):
|
|
|
108
100
|
|
|
109
101
|
def set_cache_size(maxsize_gbyte: int):
|
|
110
102
|
"""
|
|
111
|
-
siibra runs
|
|
103
|
+
siibra runs maintenance on its local cache to keep it under a predetermined
|
|
112
104
|
size of 2 gigabytes. This method changes the cache size.
|
|
113
105
|
|
|
114
106
|
Parameters
|
|
@@ -129,9 +121,9 @@ def warm_cache(level=WarmupLevel.INSTANCE):
|
|
|
129
121
|
Preload preconfigured siibra concepts.
|
|
130
122
|
|
|
131
123
|
Siibra relies on preconfigurations that simplify integrating various
|
|
132
|
-
concepts such as parcellations,
|
|
124
|
+
concepts such as parcellations, reference spaces, and multimodal data
|
|
133
125
|
features. By preloading the instances, siibra commits all preconfigurations
|
|
134
|
-
to the memory at once instead of
|
|
126
|
+
to the memory at once instead of committing them when required.
|
|
135
127
|
"""
|
|
136
128
|
Warmup.warmup(level)
|
|
137
129
|
|
|
@@ -151,10 +143,9 @@ def __dir__():
|
|
|
151
143
|
"MapType",
|
|
152
144
|
"Point",
|
|
153
145
|
"PointCloud",
|
|
146
|
+
"BoundingBox",
|
|
154
147
|
"QUIET",
|
|
155
148
|
"VERBOSE",
|
|
156
|
-
"fetch_ebrains_token",
|
|
157
|
-
"set_ebrains_token",
|
|
158
149
|
"vocabularies",
|
|
159
150
|
"__version__",
|
|
160
151
|
"cache",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2018-
|
|
1
|
+
# Copyright 2018-2025
|
|
2
2
|
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
|
|
3
3
|
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -17,24 +17,26 @@
|
|
|
17
17
|
import os
|
|
18
18
|
import re
|
|
19
19
|
from enum import Enum
|
|
20
|
-
from nibabel import Nifti1Image
|
|
21
|
-
from nilearn.image import resample_to_img
|
|
22
20
|
import logging
|
|
23
|
-
from tqdm import tqdm
|
|
24
|
-
import numpy as np
|
|
25
|
-
import pandas as pd
|
|
26
|
-
from typing import Generic, Iterable, Iterator, List, TypeVar, Union, Dict, Generator, Tuple
|
|
27
|
-
from skimage.filters import gaussian
|
|
28
21
|
from dataclasses import dataclass
|
|
29
22
|
from hashlib import md5
|
|
30
23
|
from uuid import UUID
|
|
31
24
|
import math
|
|
25
|
+
from typing import Generic, Iterable, Iterator, List, TypeVar, Union, Dict, Generator, Tuple
|
|
32
26
|
try:
|
|
33
27
|
from typing import TypedDict
|
|
34
28
|
except ImportError:
|
|
35
29
|
# support python 3.7
|
|
36
30
|
from typing_extensions import TypedDict
|
|
37
31
|
|
|
32
|
+
from tqdm import tqdm
|
|
33
|
+
import numpy as np
|
|
34
|
+
import pandas as pd
|
|
35
|
+
from nibabel import Nifti1Image
|
|
36
|
+
from nilearn.image import resample_to_img
|
|
37
|
+
from skimage.filters import gaussian
|
|
38
|
+
|
|
39
|
+
|
|
38
40
|
logging.addLevelName(21, "INFO_WO_PROGRESS_BARS")
|
|
39
41
|
logger = logging.getLogger(__name__.split(os.path.extsep)[0])
|
|
40
42
|
ch = logging.StreamHandler()
|
|
@@ -139,7 +141,7 @@ class InstanceTable(Generic[T], Iterable):
|
|
|
139
141
|
return (w for w in self._elements.values())
|
|
140
142
|
|
|
141
143
|
def __contains__(self, key: Union[str, T]) -> bool:
|
|
142
|
-
"""Test
|
|
144
|
+
"""Test whether the given key or element is defined by the registry."""
|
|
143
145
|
if isinstance(key, str):
|
|
144
146
|
return key in self._elements
|
|
145
147
|
return key in [item for _, item in self._elements.values()]
|
|
@@ -536,7 +538,8 @@ def resample_img_to_img(
|
|
|
536
538
|
resampled_img = resample_to_img(
|
|
537
539
|
source_img=source_img,
|
|
538
540
|
target_img=target_img,
|
|
539
|
-
interpolation=interpolation
|
|
541
|
+
interpolation=interpolation,
|
|
542
|
+
force_resample=True, # False is intended for testing. see nilearn docs
|
|
540
543
|
)
|
|
541
544
|
return resampled_img
|
|
542
545
|
|
|
@@ -554,7 +557,7 @@ def connected_components(
|
|
|
554
557
|
|
|
555
558
|
Note
|
|
556
559
|
----
|
|
557
|
-
`Uses skimage.measure.label()` to determine foreground
|
|
560
|
+
`Uses skimage.measure.label()` to determine foreground components.
|
|
558
561
|
|
|
559
562
|
Parameters
|
|
560
563
|
----------
|
|
@@ -568,7 +571,7 @@ def connected_components(
|
|
|
568
571
|
Yields
|
|
569
572
|
------
|
|
570
573
|
Generator[Tuple[int, np.ndarray], None, None]
|
|
571
|
-
tuple of integer label of the component and component as an
|
|
574
|
+
tuple of integer label of the component and component as an ndarray in
|
|
572
575
|
the shape of the original image.
|
|
573
576
|
"""
|
|
574
577
|
from skimage import measure
|
|
@@ -644,11 +647,11 @@ def MI(arr1, arr2, nbins=100, normalized=True):
|
|
|
644
647
|
assert (all(arr.size > 0) for arr in [arr1, arr2])
|
|
645
648
|
|
|
646
649
|
# compute the normalized joint 2D histogram as an
|
|
647
|
-
# empirical measure of the joint
|
|
650
|
+
# empirical measure of the joint probability of arr1 and arr2
|
|
648
651
|
pxy, _, _ = np.histogram2d(arr1.ravel(), arr2.ravel(), bins=nbins)
|
|
649
652
|
pxy /= pxy.sum()
|
|
650
653
|
|
|
651
|
-
# extract the empirical
|
|
654
|
+
# extract the empirical probabilities of intensities
|
|
652
655
|
# from the joint histogram
|
|
653
656
|
px = np.sum(pxy, axis=1) # marginal for x over y
|
|
654
657
|
py = np.sum(pxy, axis=0) # marginal for y over x
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2018-
|
|
1
|
+
# Copyright 2018-2025
|
|
2
2
|
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
|
|
3
3
|
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,16 +13,16 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
-
from ..commons import logger, __version__, SIIBRA_USE_CONFIGURATION, siibra_tqdm
|
|
17
|
-
from ..retrieval.repositories import GitlabConnector, RepositoryConnector, GithubConnector
|
|
18
|
-
from ..retrieval.exceptions import NoSiibraConfigMirrorsAvailableException
|
|
19
|
-
from ..retrieval.requests import SiibraHttpRequestError
|
|
20
|
-
|
|
21
16
|
from typing import Union, List
|
|
22
17
|
from collections import defaultdict
|
|
23
18
|
from requests.exceptions import ConnectionError
|
|
24
19
|
from os import path
|
|
25
20
|
|
|
21
|
+
from ..commons import logger, __version__, SIIBRA_USE_CONFIGURATION, siibra_tqdm
|
|
22
|
+
from ..retrieval.repositories import GitlabConnector, RepositoryConnector, GithubConnector
|
|
23
|
+
from ..retrieval.exceptions import NoSiibraConfigMirrorsAvailableException
|
|
24
|
+
from ..retrieval.requests import SiibraHttpRequestError
|
|
25
|
+
|
|
26
26
|
|
|
27
27
|
class Configuration:
|
|
28
28
|
"""
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2018-
|
|
1
|
+
# Copyright 2018-2025
|
|
2
2
|
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
|
|
3
3
|
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,6 +13,15 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
|
|
16
|
+
from os import path
|
|
17
|
+
import json
|
|
18
|
+
from typing import List, Dict, Callable
|
|
19
|
+
from io import BytesIO
|
|
20
|
+
from functools import wraps
|
|
21
|
+
|
|
22
|
+
import numpy as np
|
|
23
|
+
import pandas as pd
|
|
24
|
+
|
|
16
25
|
from ..commons import logger, Species
|
|
17
26
|
from ..features import anchor, connectivity
|
|
18
27
|
from ..features.tabular import (
|
|
@@ -29,14 +38,6 @@ from ..retrieval import datasets, repositories
|
|
|
29
38
|
from ..volumes import volume, sparsemap, parcellationmap
|
|
30
39
|
from ..volumes.providers.provider import VolumeProvider
|
|
31
40
|
|
|
32
|
-
from os import path
|
|
33
|
-
import json
|
|
34
|
-
import numpy as np
|
|
35
|
-
from typing import List, Dict, Callable
|
|
36
|
-
import pandas as pd
|
|
37
|
-
from io import BytesIO
|
|
38
|
-
from functools import wraps
|
|
39
|
-
|
|
40
41
|
|
|
41
42
|
_registered_build_fns: Dict[str, Callable] = {}
|
|
42
43
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2018-
|
|
1
|
+
# Copyright 2018-2025
|
|
2
2
|
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
|
|
3
3
|
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -12,5 +12,5 @@
|
|
|
12
12
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
|
-
""":ref:`
|
|
15
|
+
"""Core concepts behind siibra, :ref:`see glossary <glossary>` for details."""
|
|
16
16
|
from . import atlas, parcellation, space
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2018-
|
|
1
|
+
# Copyright 2018-2025
|
|
2
2
|
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
|
|
3
3
|
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -17,6 +17,7 @@
|
|
|
17
17
|
from enum import Enum
|
|
18
18
|
from dataclasses import dataclass
|
|
19
19
|
from typing import Dict, Generic, TypeVar, TYPE_CHECKING
|
|
20
|
+
|
|
20
21
|
if TYPE_CHECKING:
|
|
21
22
|
from .structure import BrainStructure
|
|
22
23
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2018-
|
|
1
|
+
# Copyright 2018-2025
|
|
2
2
|
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
|
|
3
3
|
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,12 +13,12 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
"""Provides reference systems for brains."""
|
|
16
|
-
from . import concept, space as _space, parcellation as _parcellation
|
|
17
|
-
|
|
18
|
-
from ..commons import MapType, logger, InstanceTable, Species
|
|
19
16
|
|
|
20
17
|
from typing import List
|
|
21
18
|
|
|
19
|
+
from . import concept, space as _space, parcellation as _parcellation
|
|
20
|
+
from ..commons import MapType, logger, InstanceTable, Species
|
|
21
|
+
|
|
22
22
|
|
|
23
23
|
VERSION_BLACKLIST_WORDS = ["beta", "rc", "alpha"]
|
|
24
24
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2018-
|
|
1
|
+
# Copyright 2018-2025
|
|
2
2
|
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
|
|
3
3
|
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,6 +13,10 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
"""Parent class to siibra main concepts."""
|
|
16
|
+
|
|
17
|
+
import re
|
|
18
|
+
from typing import TypeVar, Type, Union, List, TYPE_CHECKING, Dict
|
|
19
|
+
|
|
16
20
|
from ..commons import (
|
|
17
21
|
create_key,
|
|
18
22
|
clear_name,
|
|
@@ -23,8 +27,6 @@ from ..commons import (
|
|
|
23
27
|
)
|
|
24
28
|
from ..retrieval import cache
|
|
25
29
|
|
|
26
|
-
import re
|
|
27
|
-
from typing import TypeVar, Type, Union, List, TYPE_CHECKING, Dict
|
|
28
30
|
|
|
29
31
|
T = TypeVar("T", bound="AtlasConcept")
|
|
30
32
|
_REGISTRIES: Dict[Type[T], InstanceTable[T]] = {}
|
|
@@ -145,9 +147,9 @@ class AtlasConcept:
|
|
|
145
147
|
@property
|
|
146
148
|
def authors(self):
|
|
147
149
|
return [
|
|
148
|
-
|
|
150
|
+
contributor['name']
|
|
149
151
|
for ds in self.datasets
|
|
150
|
-
for
|
|
152
|
+
for contributor in ds.contributors
|
|
151
153
|
]
|
|
152
154
|
|
|
153
155
|
@property
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Copyright 2018-
|
|
1
|
+
# Copyright 2018-2025
|
|
2
2
|
# Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
|
|
3
3
|
|
|
4
4
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
@@ -13,11 +13,6 @@
|
|
|
13
13
|
# See the License for the specific language governing permissions and
|
|
14
14
|
# limitations under the License.
|
|
15
15
|
"""Hierarchal brain regions and metadata."""
|
|
16
|
-
from . import region
|
|
17
|
-
|
|
18
|
-
from ..commons import logger, MapType, Species
|
|
19
|
-
from ..volumes import parcellationmap
|
|
20
|
-
from ..exceptions import NoMapMatchingValues
|
|
21
16
|
|
|
22
17
|
from functools import lru_cache
|
|
23
18
|
import re
|
|
@@ -28,6 +23,11 @@ except ImportError:
|
|
|
28
23
|
# support python 3.7
|
|
29
24
|
from typing_extensions import Literal
|
|
30
25
|
|
|
26
|
+
from . import region
|
|
27
|
+
from ..commons import logger, MapType, Species
|
|
28
|
+
from ..volumes import parcellationmap
|
|
29
|
+
from ..exceptions import MapNotFound
|
|
30
|
+
|
|
31
31
|
|
|
32
32
|
if TYPE_CHECKING:
|
|
33
33
|
from .space import Space
|
|
@@ -193,13 +193,13 @@ class Parcellation(region.Region, configuration_folder="parcellations"):
|
|
|
193
193
|
and m.parcellation.matches(self)
|
|
194
194
|
]
|
|
195
195
|
if len(candidates) == 0:
|
|
196
|
-
raise
|
|
196
|
+
raise MapNotFound(f"No '{maptype}' map in '{space}' available for {str(self)}")
|
|
197
197
|
if len(candidates) > 1:
|
|
198
198
|
spec_candidates = [
|
|
199
199
|
c for c in candidates if all(w.lower() in c.id.lower() for w in spec.split())
|
|
200
200
|
]
|
|
201
201
|
if len(spec_candidates) == 0:
|
|
202
|
-
raise
|
|
202
|
+
raise MapNotFound(f"'{spec}' does not match any options from {[c.name for c in candidates]}.")
|
|
203
203
|
if len(spec_candidates) > 1:
|
|
204
204
|
logger.warning(
|
|
205
205
|
f"Multiple maps are available in this specification of space, parcellation, and map type.\n"
|
|
@@ -221,7 +221,7 @@ class Parcellation(region.Region, configuration_folder="parcellations"):
|
|
|
221
221
|
"""
|
|
222
222
|
spec = re.sub(r'Group: *', '', spec)
|
|
223
223
|
for substr in re.findall(r'\(.*?\)', spec):
|
|
224
|
-
#
|
|
224
|
+
# temporarily replace commas inside brackets with a placeholder
|
|
225
225
|
# because these are not region spec delimiters
|
|
226
226
|
spec = spec.replace(substr, re.sub(r', *', '##', substr))
|
|
227
227
|
# process the comma separated substrings
|
|
@@ -354,7 +354,7 @@ def find_regions(
|
|
|
354
354
|
):
|
|
355
355
|
"""
|
|
356
356
|
Find regions matching the given region specification across all parcellation
|
|
357
|
-
instances in the
|
|
357
|
+
instances in the registry.
|
|
358
358
|
|
|
359
359
|
Parameters
|
|
360
360
|
----------
|