Skip to content

Instantly share code, notes, and snippets.

@micabe
Last active November 10, 2020 09:48
Show Gist options
  • Save micabe/f5b630e3583133342bbabfa0b848e3c8 to your computer and use it in GitHub Desktop.
Save micabe/f5b630e3583133342bbabfa0b848e3c8 to your computer and use it in GitHub Desktop.
# -*- coding: utf-8 -*-
import brainvisa.axon.processes
brainvisa.axon.processes.initializeProcesses()
context = brainvisa.processes.defaultContext()
def get_databases():
"""Get the list of Brainvisa databases."""
from brainvisa.processes import neuroConfig
return [dbs.directory for dbs in neuroConfig.dataPath if not dbs.builtin]
def update(dbPath):
"""Update the database."""
print('Updating %s database.' % (dbPath))
try:
db = databases.database(dbPath)
db.clear(context=context)
db.update(context=context)
except:
return
def update_databases():
"""Update the databases."""
for database in get_databases():
update(database)
from brainvisa.data import neuroHierarchy
from brainvisa.data.neuroHierarchy import *
if __name__ == '__main__':
descriptionMsg = \
'''Update BrainVisa databases.'''
update_databases()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment