brain_image_library
navis.interfaces.brain_image_library.BILError #
Raised when the Brain Image Library API returns an error.
Source code in navis/interfaces/brain_image_library.py
85 86 | |
navis.interfaces.brain_image_library.clear_metadata_cache #
Clear the in-process metadata cache.
Source code in navis/interfaces/brain_image_library.py
351 352 353 | |
navis.interfaces.brain_image_library.download_files #
Download files from a BIL dataset.
| PARAMETER | DESCRIPTION |
|---|---|
x | TYPE: |
filepath | TYPE: |
pattern | TYPE: |
max_size | TYPE: |
skip_existing | TYPE: |
parallel | TYPE: |
max_threads | TYPE: |
**kwargs | DEFAULT: |
| RETURNS | DESCRIPTION |
|---|---|
pandas.DataFrame | The file table with an added |
Examples:
>>> import navis.interfaces.brain_image_library as bil
>>> files = bil.download_files('ace-boo-van', '~/bil', pattern='*.swc')
Source code in navis/interfaces/brain_image_library.py
1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 | |
navis.interfaces.brain_image_library.get_dataset_url #
Return the download URL(s) for the given dataset(s).
| PARAMETER | DESCRIPTION |
|---|---|
x | TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
str | If a single dataset was requested. |
list of str | If multiple datasets were requested. |
Examples:
>>> import navis.interfaces.brain_image_library as bil
>>> bil.get_dataset_url('ace-boo-van')
'https://download.brainimagelibrary.org/22/5c/225c37cacfbd897c/'
Source code in navis/interfaces/brain_image_library.py
613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 | |
navis.interfaces.brain_image_library.get_metadata #
Fetch metadata for one or more BIL datasets.
| PARAMETER | DESCRIPTION |
|---|---|
x | TYPE: |
raw | TYPE: |
parallel | TYPE: |
max_threads | TYPE: |
chunk_size | TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
pandas.DataFrame | One row per dataset. |
list of dict | If |
Examples:
>>> import navis.interfaces.brain_image_library as bil
>>> meta = bil.get_metadata('ace-boo-van')
>>> meta.title.values[0]
'Single neuron reconstruction from fMOST images'
Source code in navis/interfaces/brain_image_library.py
518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 | |
navis.interfaces.brain_image_library.get_neurons #
Fetch neuron reconstructions from a BIL dataset.
Skeletons are streamed straight into memory - nothing is written to disk. Use navis.interfaces.brain_image_library.download_files if you want the files themselves.
| PARAMETER | DESCRIPTION |
|---|---|
x | TYPE: |
pattern | TYPE: |
max_neurons | TYPE: |
parallel | TYPE: |
max_threads | TYPE: |
**kwargs | DEFAULT: |
| RETURNS | DESCRIPTION |
|---|---|
navis.NeuronList | |
Examples:
>>> import navis.interfaces.brain_image_library as bil
>>> # Look before you leap
>>> files = bil.list_files('ace-boo-van', pattern='*.swc')
>>> nl = bil.get_neurons(files, max_neurons=5)
>>> len(nl)
5
Source code in navis/interfaces/brain_image_library.py
1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 | |
navis.interfaces.brain_image_library.list_files #
List the files in a BIL dataset.
This works by crawling the dataset's directory listing. Note that BIL hosts datasets with over a million files - see the guardrails below.
| PARAMETER | DESCRIPTION |
|---|---|
x | TYPE: |
pattern | TYPE: |
recursive | TYPE: |
max_depth | TYPE: |
max_files | TYPE: |
max_requests | TYPE: |
force | TYPE: |
parallel | TYPE: |
max_threads | TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
pandas.DataFrame | Columns: |
Examples:
>>> import navis.interfaces.brain_image_library as bil
>>> files = bil.list_files('ace-boo-van', pattern='*.swc')
Source code in navis/interfaces/brain_image_library.py
774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 | |
navis.interfaces.brain_image_library.query #
Run a single raw query against the BIL metadata API.
This is a low-level escape hatch for division/element combinations not covered by navis.interfaces.brain_image_library.search. No validation is performed on division/element.
| PARAMETER | DESCRIPTION |
|---|---|
division | TYPE: |
element | TYPE: |
value | TYPE: |
| RETURNS | DESCRIPTION |
|---|---|
list of str | The IDs ("bildids") of matching datasets. Empty if no match. |
Examples:
>>> import navis.interfaces.brain_image_library as bil
>>> ids = bil.query('dataset', 'generalmodality', 'cell morphology')
Source code in navis/interfaces/brain_image_library.py
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 | |
navis.interfaces.brain_image_library.search #
Search BIL for datasets matching the given criteria.
| PARAMETER | DESCRIPTION |
|---|---|
limit | TYPE: |
metadata | TYPE: |
parallel | TYPE: |
max_threads | TYPE: |
**filters | |
| RETURNS | DESCRIPTION |
|---|---|
pandas.DataFrame | One row per dataset. Feed this straight into |
Examples:
>>> import navis.interfaces.brain_image_library as bil
>>> # Find mouse single-neuron reconstructions
>>> ds = bil.search(species='mouse', generalmodality='cell morphology')
>>> # Full-text search
>>> ds = bil.search(text='barrel cortex')
Note that class is a Python keyword and hence can't be used as a keyword argument. Pass it as a dict instead:
>>> ds = bil.search(**{'class': 'somevalue'})
Source code in navis/interfaces/brain_image_library.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 | |