TVB-Framework command initialisation

In [ ]:
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
In [2]:
list_projects()
                    name    id
         Default_Project     1
In [3]:
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
2022-08-18 10:08:56,092 - INFO - tvb.core.services.operation_service - Starting operation AllenConnectomeBuilder
2022-08-18 10:08:56,239 - INFO - tvb.core.services.backend_clients.standalone_client - Start processing operation id:23
2022-08-18 10:08:56,260 - INFO - tvb.core.services.operation_service - Finished operation launch:AllenConnectomeBuilder
2022-08-18 10:08:56,261 - INFO - tvb.interfaces.command.lab - Operation launched....
Out[3]:
<Operation('95317a28f83d4685847828b481ef2916', 9fc1f8bd-1ec4-11ed-aaf8-782b46fbd208, 2,'1','59','2022-08-18 10:08:56.104635','None', 'None','4-PENDING',True, 'None', '', '', 0)>
In [4]:
launched_operation = wait_to_finish(launched_operation)
launched_operation
2022-08-18 10:10:11,346 - INFO - tvb.interfaces.command.lab - Operation finished successfully
Out[4]:
<Operation('95317a28f83d4685847828b481ef2916', 9fc1f8bd-1ec4-11ed-aaf8-782b46fbd208, 2,'1','59','2022-08-18 10:08:56.104635','2022-08-18 10:09:02.478566', '2022-08-18 10:10:11.049714','5-FINISHED',True, 'None', '2022-08-18,10-10-10', '', -1)>
2022-08-18 10:10:11,531 - INFO - tvb.core.services.backend_clients.standalone_client - Finished with launch of operation 23
2022-08-18 10:10:11,534 - INFO - tvb.core.services.backend_clients.standalone_client - Return code: 0. Stopped: False
2022-08-18 10:10:11,535 - INFO - tvb.core.services.backend_clients.standalone_client - Thread: <OperationExecutor(Thread-93, started 7252)>

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.

In [5]:
list_operation_results(launched_operation.id)
              id                     type                              gid         date
              30        ConnectivityIndex cb26b68eaf514b0eafaccd360cfc4623 2022-08-18 10:10:10.619210
              31              VolumeIndex f4fdbf31494240fd97d057e2aed2e73c 2022-08-18 10:10:10.729235
              32 RegionVolumeMappingIndex b54ed9da8753403cbbbde678ee44d525 2022-08-18 10:10:10.826571
              33       StructuralMRIIndex 858ee191fcff4d2991a4ed4e17b2281f 2022-08-18 10:10:10.939135
In [ ]: