siibra 1.0a1__1-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.

Potentially problematic release.


This version of siibra might be problematic. Click here for more details.

Files changed (84) hide show
  1. siibra/VERSION +1 -0
  2. siibra/__init__.py +164 -0
  3. siibra/commons.py +823 -0
  4. siibra/configuration/__init__.py +17 -0
  5. siibra/configuration/configuration.py +189 -0
  6. siibra/configuration/factory.py +589 -0
  7. siibra/core/__init__.py +16 -0
  8. siibra/core/assignment.py +110 -0
  9. siibra/core/atlas.py +239 -0
  10. siibra/core/concept.py +308 -0
  11. siibra/core/parcellation.py +387 -0
  12. siibra/core/region.py +1223 -0
  13. siibra/core/space.py +131 -0
  14. siibra/core/structure.py +111 -0
  15. siibra/exceptions.py +63 -0
  16. siibra/experimental/__init__.py +19 -0
  17. siibra/experimental/contour.py +61 -0
  18. siibra/experimental/cortical_profile_sampler.py +57 -0
  19. siibra/experimental/patch.py +98 -0
  20. siibra/experimental/plane3d.py +256 -0
  21. siibra/explorer/__init__.py +17 -0
  22. siibra/explorer/url.py +222 -0
  23. siibra/explorer/util.py +87 -0
  24. siibra/features/__init__.py +117 -0
  25. siibra/features/anchor.py +224 -0
  26. siibra/features/connectivity/__init__.py +33 -0
  27. siibra/features/connectivity/functional_connectivity.py +57 -0
  28. siibra/features/connectivity/regional_connectivity.py +494 -0
  29. siibra/features/connectivity/streamline_counts.py +27 -0
  30. siibra/features/connectivity/streamline_lengths.py +27 -0
  31. siibra/features/connectivity/tracing_connectivity.py +30 -0
  32. siibra/features/dataset/__init__.py +17 -0
  33. siibra/features/dataset/ebrains.py +90 -0
  34. siibra/features/feature.py +970 -0
  35. siibra/features/image/__init__.py +27 -0
  36. siibra/features/image/image.py +115 -0
  37. siibra/features/image/sections.py +26 -0
  38. siibra/features/image/volume_of_interest.py +88 -0
  39. siibra/features/tabular/__init__.py +24 -0
  40. siibra/features/tabular/bigbrain_intensity_profile.py +77 -0
  41. siibra/features/tabular/cell_density_profile.py +298 -0
  42. siibra/features/tabular/cortical_profile.py +322 -0
  43. siibra/features/tabular/gene_expression.py +257 -0
  44. siibra/features/tabular/layerwise_bigbrain_intensities.py +62 -0
  45. siibra/features/tabular/layerwise_cell_density.py +95 -0
  46. siibra/features/tabular/receptor_density_fingerprint.py +192 -0
  47. siibra/features/tabular/receptor_density_profile.py +110 -0
  48. siibra/features/tabular/regional_timeseries_activity.py +294 -0
  49. siibra/features/tabular/tabular.py +139 -0
  50. siibra/livequeries/__init__.py +19 -0
  51. siibra/livequeries/allen.py +352 -0
  52. siibra/livequeries/bigbrain.py +197 -0
  53. siibra/livequeries/ebrains.py +145 -0
  54. siibra/livequeries/query.py +49 -0
  55. siibra/locations/__init__.py +91 -0
  56. siibra/locations/boundingbox.py +454 -0
  57. siibra/locations/location.py +115 -0
  58. siibra/locations/point.py +344 -0
  59. siibra/locations/pointcloud.py +349 -0
  60. siibra/retrieval/__init__.py +27 -0
  61. siibra/retrieval/cache.py +233 -0
  62. siibra/retrieval/datasets.py +389 -0
  63. siibra/retrieval/exceptions/__init__.py +27 -0
  64. siibra/retrieval/repositories.py +769 -0
  65. siibra/retrieval/requests.py +659 -0
  66. siibra/vocabularies/__init__.py +45 -0
  67. siibra/vocabularies/gene_names.json +29176 -0
  68. siibra/vocabularies/receptor_symbols.json +210 -0
  69. siibra/vocabularies/region_aliases.json +460 -0
  70. siibra/volumes/__init__.py +23 -0
  71. siibra/volumes/parcellationmap.py +1279 -0
  72. siibra/volumes/providers/__init__.py +20 -0
  73. siibra/volumes/providers/freesurfer.py +113 -0
  74. siibra/volumes/providers/gifti.py +165 -0
  75. siibra/volumes/providers/neuroglancer.py +736 -0
  76. siibra/volumes/providers/nifti.py +266 -0
  77. siibra/volumes/providers/provider.py +107 -0
  78. siibra/volumes/sparsemap.py +468 -0
  79. siibra/volumes/volume.py +892 -0
  80. siibra-1.0.0a1.dist-info/LICENSE +201 -0
  81. siibra-1.0.0a1.dist-info/METADATA +160 -0
  82. siibra-1.0.0a1.dist-info/RECORD +84 -0
  83. siibra-1.0.0a1.dist-info/WHEEL +5 -0
  84. siibra-1.0.0a1.dist-info/top_level.txt +1 -0
siibra/VERSION ADDED
@@ -0,0 +1 @@
1
+ 1.0.0-alpha.1
siibra/__init__.py ADDED
@@ -0,0 +1,164 @@
1
+ # Copyright 2018-2024
2
+ # Institute of Neuroscience and Medicine (INM-1), Forschungszentrum Jülich GmbH
3
+
4
+ # Licensed under the Apache License, Version 2.0 (the "License");
5
+ # you may not use this file except in compliance with the License.
6
+ # You may obtain a copy of the License at
7
+
8
+ # http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ # Unless required by applicable law or agreed to in writing, software
11
+ # distributed under the License is distributed on an "AS IS" BASIS,
12
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ # See the License for the specific language governing permissions and
14
+ # limitations under the License.
15
+
16
+ from .commons import (
17
+ logger,
18
+ QUIET,
19
+ VERBOSE,
20
+ MapType,
21
+ MapIndex,
22
+ set_log_level,
23
+ __version__
24
+ )
25
+
26
+ from .core import (
27
+ atlas as _atlas,
28
+ parcellation as _parcellation,
29
+ space as _space
30
+ )
31
+ from .volumes import parcellationmap as _parcellationmap
32
+ from .retrieval.requests import (
33
+ EbrainsRequest as _EbrainsRequest,
34
+ CACHE as cache
35
+ )
36
+ from .retrieval.cache import Warmup, WarmupLevel
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
+
44
+ import os as _os
45
+ logger.info(f"Version: {__version__}")
46
+ logger.warning("This is a development release. Use at your own risk.")
47
+ logger.info(
48
+ "Please file bugs and issues at https://github.com/FZJ-INM1-BDA/siibra-python."
49
+ )
50
+
51
+ # forward access to some functions
52
+ set_ebrains_token = _EbrainsRequest.set_token
53
+ fetch_ebrains_token = _EbrainsRequest.fetch_token
54
+ find_regions = _parcellation.find_regions
55
+ from_json = factory.Factory.from_json
56
+
57
+
58
+ def __getattr__(attr: str):
59
+ # lazy loading of some classes for package-level functions.
60
+ if attr == 'atlases':
61
+ return _atlas.Atlas.registry()
62
+ elif attr == 'spaces':
63
+ return _space.Space.registry()
64
+ elif attr == 'parcellations':
65
+ return _parcellation.Parcellation.registry()
66
+ elif attr == 'maps':
67
+ return _parcellationmap.Map.registry()
68
+ elif attr == 'use_configuration':
69
+ return configuration.Configuration.use_configuration
70
+ elif attr == 'extend_configuration':
71
+ return configuration.Configuration.extend_configuration
72
+ else:
73
+ raise AttributeError(f"No such attribute: {__name__}.{attr}")
74
+
75
+
76
+ # convenient access to reference space templates
77
+ def get_template(space_spec: str, **kwargs):
78
+ return (
79
+ _space.Space
80
+ .get_instance(space_spec)
81
+ .get_template(**kwargs)
82
+ )
83
+
84
+
85
+ # convenient access to parcellation maps
86
+ def get_map(parcellation: str, space: str, maptype: MapType = MapType.LABELLED, **kwargs):
87
+ return (
88
+ _parcellation.Parcellation
89
+ .get_instance(parcellation)
90
+ .get_map(space=space, maptype=maptype, **kwargs)
91
+ )
92
+
93
+
94
+ # convenient access to regions of a parcellation
95
+ def get_region(parcellation: str, region: str):
96
+ return (
97
+ _parcellation.Parcellation
98
+ .get_instance(parcellation)
99
+ .get_region(region)
100
+ )
101
+
102
+
103
+ def set_feasible_download_size(maxsize_gbyte):
104
+ from .volumes import volume
105
+ volume.gbyte_feasible = maxsize_gbyte
106
+ logger.info(f"Set feasible download size to {maxsize_gbyte} GiB.")
107
+
108
+
109
+ def set_cache_size(maxsize_gbyte: int):
110
+ """
111
+ siibra runs maintainance on its local cache to keep it under a predetermined
112
+ size of 2 gigabytes. This method changes the cache size.
113
+
114
+ Parameters
115
+ ----------
116
+ maxsize_gbyte : int
117
+ """
118
+ assert maxsize_gbyte >= 0
119
+ cache.SIZE_GIB = maxsize_gbyte
120
+ logger.info(f"Set cache size to {maxsize_gbyte} GiB.")
121
+
122
+
123
+ if "SIIBRA_CACHE_SIZE_GIB" in _os.environ:
124
+ set_cache_size(float(_os.environ.get("SIIBRA_CACHE_SIZE_GIB")))
125
+
126
+
127
+ def warm_cache(level=WarmupLevel.INSTANCE):
128
+ """
129
+ Preload preconfigured siibra concepts.
130
+
131
+ Siibra relies on preconfigurations that simplify integrating various
132
+ concepts such as parcellations, refernce spaces, and multimodal data
133
+ features. By preloading the instances, siibra commits all preconfigurations
134
+ to the memory at once instead of commiting them when required.
135
+ """
136
+ Warmup.warmup(level)
137
+
138
+
139
+ def __dir__():
140
+ return [
141
+ "atlases",
142
+ "spaces",
143
+ "parcellations",
144
+ "features",
145
+ "use_configuration",
146
+ "extend_configuration",
147
+ "get_region",
148
+ "find_regions",
149
+ "get_map",
150
+ "get_template",
151
+ "MapType",
152
+ "Point",
153
+ "PointCloud",
154
+ "QUIET",
155
+ "VERBOSE",
156
+ "fetch_ebrains_token",
157
+ "set_ebrains_token",
158
+ "vocabularies",
159
+ "__version__",
160
+ "cache",
161
+ "warm_cache",
162
+ "set_cache_size",
163
+ "from_json",
164
+ ]