Skip to content

Commit

Permalink
add support for custom offline atlases (#497)
Browse files Browse the repository at this point in the history
Co-authored-by: Igor Tatarnikov <[email protected]>
  • Loading branch information
carlocastoldi and IgorTatarnikov authored Feb 18, 2025
1 parent 8ea937a commit cc00169
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions brainglobe_atlasapi/list_atlases.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,18 +59,22 @@ def get_local_atlas_version(atlas_name):
def get_all_atlases_lastversions():
"""Read from URL or local cache all available last versions"""
cache_path = config.get_brainglobe_dir() / "last_versions.conf"
custom_path = config.get_brainglobe_dir() / "custom_atlases.conf"

if utils.check_internet_connection(
raise_error=False
) and utils.check_gin_status(raise_error=False):
available_atlases = utils.conf_from_url(
official_atlases = utils.conf_from_url(
descriptors.remote_url_base.format("last_versions.conf")
)
else:
print("Cannot fetch latest atlas versions from the server.")
available_atlases = utils.conf_from_file(cache_path)

return dict(available_atlases["atlases"])
official_atlases = utils.conf_from_file(cache_path)
try:
custom_atlases = utils.conf_from_file(custom_path)
except FileNotFoundError:
return dict(official_atlases["atlases"])
return {**official_atlases["atlases"], **custom_atlases["atlases"]}


def get_atlases_lastversions():
Expand Down

0 comments on commit cc00169

Please sign in to comment.