from tvb.interfaces.command.lab import *
from tvb.adapters.creators.allen_creator import AllenConnectomeBuilder
from tvb.adapters.creators.allen_creator import AllenConnectModel
from tvb.adapters.creators.allen_creator import ResolutionOptionsEnum, WeightsOptionsEnum
from tvb.core.adapters.abcadapter import ABCAdapter
from tvb.core.services.operation_service import OperationService
list_projects()
builder_instance = ABCAdapter.build_adapter_from_class(AllenConnectomeBuilder)
# The corresponding view_model is AllenConnectModel. You can either instantiate it directly or get it by calling
# the get_view_model_class adapter function.
view_model = builder_instance.get_view_model_class()()
view_model.resolution = ResolutionOptionsEnum.ONE_HUNDRED
view_model.weighting = WeightsOptionsEnum.PROJECTION_DENSITY_INJECTION_DENSITY
view_model.inj_f_thresh = 80
view_model.vol_thresh= 100000000
# This ID of a project needs to exists in Db, and it can be taken from the WebInterface:
launched_operation = fire_operation(1, builder_instance, view_model)
launched_operation
launched_operation = wait_to_finish(launched_operation)
launched_operation
At this point, your operation of Allen DB import should be running in the background. If you launch TVB web GUI, and you go to Project -> Operations page, you should see the new operation running (state color BLUE).
When done, your results will be ready for inspection in TVB web GUI. Do not close your computer until the operation has finished. If you do so, then relaunch after you restart. Downloaded files will not be lost, but found by the new operation.
list_operation_results(launched_operation.id)