本文整理汇总了Python中tvb.core.entities.storage.dao.get_project_by_id函数的典型用法代码示例。如果您正苦于以下问题:Python get_project_by_id函数的具体用法?Python get_project_by_id怎么用?Python get_project_by_id使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_project_by_id函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: test_editone_remove
def test_editone_remove(self):
"""
Test that a project is indeed deleted.
"""
cherrypy.request.method = "POST"
self._expect_redirect('/project/viewall', self.project_c.editone,
self.test_project.id, delete=True)
with pytest.raises(NoResultFound):
dao.get_project_by_id(self.test_project.id)
开发者ID:maedoc,项目名称:tvb-framework,代码行数:9,代码来源:project_controller_test.py
示例2: store_project
def store_project(self, current_user, is_create, selected_id, **data):
"""
We want to create/update a project entity.
"""
# Validate Unique Name
new_name = data["name"]
if len(new_name) < 1:
raise ProjectServiceException("Invalid project name!")
projects_no = dao.count_projects_for_name(new_name, selected_id)
if projects_no > 0:
err = {'name': 'Please choose another name, this one is used!'}
raise formencode.Invalid("Duplicate Name Error", {}, None, error_dict=err)
started_operations = dao.get_operation_numbers(selected_id)[1]
if started_operations > 0:
raise ProjectServiceException("A project can not be renamed while operations are still running!")
if is_create:
current_proj = model.Project(new_name, current_user.id, data["description"])
self.structure_helper.get_project_folder(current_proj)
else:
try:
current_proj = dao.get_project_by_id(selected_id)
except Exception as excep:
self.logger.exception("An error has occurred!")
raise ProjectServiceException(str(excep))
if current_proj.name != new_name:
self.structure_helper.rename_project_structure(current_proj.name, new_name)
current_proj.name = new_name
current_proj.description = data["description"]
# Commit to make sure we have a valid ID
current_proj.refresh_update_date()
self.structure_helper.write_project_metadata(current_proj)
current_proj = dao.store_entity(current_proj)
# Retrieve, to initialize lazy attributes
current_proj = dao.get_project_by_id(current_proj.id)
# Update share settings on current Project entity
visited_pages = []
prj_admin = current_proj.administrator.username
if 'visited_pages' in data and data['visited_pages']:
visited_pages = data['visited_pages'].split(',')
for page in visited_pages:
members = UserService.retrieve_all_users(prj_admin, int(page))[0]
members = [m.id for m in members]
dao.delete_members_for_project(current_proj.id, members)
selected_user_ids = data["users"]
dao.add_members_to_project(current_proj.id, selected_user_ids)
# Finish operation
self.logger.debug("Edit/Save OK for project:" + str(current_proj.id) + ' by user:' + current_user.username)
return current_proj
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:49,代码来源:project_service.py
示例3: fire_operation
def fire_operation(self, adapter_instance, current_user, project_id,
method_name=ABCAdapter.LAUNCH_METHOD, visible=True, **data):
"""
Launch an operation, specified by AdapterInstance, for CurrentUser,
Current Project and a given set of UI Input Data.
"""
operation_name = str(adapter_instance.__class__.__name__) + "." + method_name
try:
# if OperationService.ATT_UID in data:
# existent = dao.get_last_data_with_uid(data[OperationService.ATT_UID])
# if existent is not None:
# self.create_link(existent, project_id)
# return "Created required links."
self.logger.info("Starting operation " + operation_name)
project = dao.get_project_by_id(project_id)
tmp_folder = self.file_helper.get_project_folder(project, self.file_helper.TEMP_FOLDER)
result = OperationService().initiate_operation(current_user, project.id, adapter_instance,
tmp_folder, method_name, visible, **data)
self.logger.info("Finished operation:" + operation_name)
return result
except TVBException, excep:
self.logger.error("Could not launch operation " + operation_name + " with the given set of input data!")
self.logger.exception(excep)
raise OperationException(excep.message, excep)
开发者ID:HuifangWang,项目名称:the-virtual-brain-website,代码行数:26,代码来源:flow_service.py
示例4: remove_project
def remove_project(self, project_id):
"""
Remove Project from DB and File Storage.
"""
try:
project2delete = dao.get_project_by_id(project_id)
self.logger.debug("Deleting project: id=" + str(project_id) + ' name=' + project2delete.name)
project_bursts = dao.get_bursts_for_project(project_id)
for burst in project_bursts:
dao.remove_entity(burst.__class__, burst.id)
project_datatypes = dao.get_datatypes_in_project(project_id)
for one_data in project_datatypes:
self.remove_datatype(project_id, one_data.gid, True)
links = dao.get_links_for_project(project_id)
for one_link in links:
dao.remove_entity(model.Links, one_link.id)
self.structure_helper.remove_project_structure(project2delete.name)
dao.delete_project(project_id)
self.logger.debug("Deleted project: id=" + str(project_id) + ' name=' + project2delete.name)
except RemoveDataTypeException, excep:
self.logger.exception("Could not execute operation Node Remove!")
raise ProjectServiceException(str(excep))
开发者ID:rajul,项目名称:tvb-framework,代码行数:27,代码来源:project_service.py
示例5: store_project
def store_project(self, current_user, is_create, selected_id, **data):
"""
We want to create/update a project entity.
"""
#Validate Unique Name
new_name = data["name"]
if len(new_name) < 1:
raise ProjectServiceException("Invalid project name!")
projects_no = dao.count_projects_for_name(new_name, selected_id)
if projects_no > 0:
err = {'name': 'Please choose another name, this one is used!'}
raise formencode.Invalid("Duplicate Name Error", {}, None, error_dict=err)
started_operations = dao.get_operation_numbers(selected_id)[1]
if started_operations > 0:
raise ProjectServiceException("A project can not be renamed while operations are still running!")
if is_create:
current_proj = model.Project(new_name, current_user.id, data["description"])
self.structure_helper.get_project_folder(current_proj)
else:
try:
current_proj = dao.get_project_by_id(selected_id)
except Exception, excep:
self.logger.exception("An error has occurred!")
raise ProjectServiceException(str(excep))
if current_proj.name != new_name:
self.structure_helper.rename_project_structure(current_proj.name, new_name)
current_proj.name = new_name
current_proj.description = data["description"]
开发者ID:rajul,项目名称:tvb-framework,代码行数:28,代码来源:project_service.py
示例6: fire_simulation
def fire_simulation(project_id=1, **kwargs):
project = dao.get_project_by_id(project_id)
flow_service = FlowService()
# below the holy procedure to launch with the correct parameters taken from the defaults
stored_adapter = flow_service.get_algorithm_by_module_and_class(SIMULATOR_MODULE, SIMULATOR_CLASS)
simulator_adapter = ABCAdapter.build_adapter(stored_adapter)
flatten_interface = simulator_adapter.flaten_input_interface()
itree_mngr = flow_service.input_tree_manager
prepared_flatten_interface = itree_mngr.fill_input_tree_with_options(flatten_interface, project.id,
stored_adapter.fk_category)
launch_args = {}
for entry in prepared_flatten_interface:
value = entry['default']
if isinstance(value, dict):
value = str(value)
if hasattr(value, 'tolist'):
value = value.tolist()
launch_args[entry['name']] = value
launch_args.update(**kwargs)
# end of magic
launched_operation = flow_service.fire_operation(simulator_adapter, project.administrator,
project.id, **launch_args)[0]
return launched_operation
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:25,代码来源:lab.py
示例7: prepare_next_step
def prepare_next_step(self, last_executed_op_id):
"""
If the operation with id 'last_executed_op_id' resulted after
the execution of a workflow step then this method will launch
the operation corresponding to the next step from the workflow.
"""
try:
current_step, next_workflow_step = self._get_data(last_executed_op_id)
if next_workflow_step is not None:
operation = dao.get_operation_by_id(next_workflow_step.fk_operation)
dynamic_param_names = next_workflow_step.dynamic_workflow_param_names
if len(dynamic_param_names) > 0:
op_params = json.loads(operation.parameters)
for param_name in dynamic_param_names:
dynamic_param = op_params[param_name]
former_step = dao.get_workflow_step_by_step_index(next_workflow_step.fk_workflow,
dynamic_param[wf_cfg.STEP_INDEX_KEY])
if type(dynamic_param[wf_cfg.DATATYPE_INDEX_KEY]) is IntType:
datatypes = dao.get_results_for_operation(former_step.fk_operation)
op_params[param_name] = datatypes[dynamic_param[wf_cfg.DATATYPE_INDEX_KEY]].gid
else:
previous_operation = dao.get_operation_by_id(former_step.fk_operation)
op_params[param_name] = json.loads(previous_operation.parameters)[
dynamic_param[wf_cfg.DATATYPE_INDEX_KEY]]
operation.parameters = json.dumps(op_params)
operation = dao.store_entity(operation)
return operation.id
else:
if current_step is not None:
current_workflow = dao.get_workflow_by_id(current_step.fk_workflow)
current_workflow.status = current_workflow.STATUS_FINISHED
dao.store_entity(current_workflow)
burst_entity = dao.get_burst_by_id(current_workflow.fk_burst)
parallel_workflows = dao.get_workflows_for_burst(burst_entity.id)
all_finished = True
for workflow in parallel_workflows:
if workflow.status == workflow.STATUS_STARTED:
all_finished = False
if all_finished:
self.mark_burst_finished(burst_entity, success=True)
disk_size = dao.get_burst_disk_size(burst_entity.id) # Transform from kB to MB
if disk_size > 0:
user = dao.get_project_by_id(burst_entity.fk_project).administrator
user.used_disk_space = user.used_disk_space + disk_size
dao.store_entity(user)
else:
operation = dao.get_operation_by_id(last_executed_op_id)
disk_size = dao.get_disk_size_for_operation(operation.id) # Transform from kB to MB
if disk_size > 0:
user = dao.get_user_by_id(operation.fk_launched_by)
user.used_disk_space = user.used_disk_space + disk_size
dao.store_entity(user)
return None
except Exception, excep:
self.logger.error(excep)
self.logger.exception(excep)
raise WorkflowInterStepsException(excep)
开发者ID:HuifangWang,项目名称:the-virtual-brain-website,代码行数:57,代码来源:workflow_service.py
示例8: find_project
def find_project(self, project_id):
"""
Simply retrieve Project entity from Database.
"""
try:
return dao.get_project_by_id(project_id)
except Exception, excep:
self.logger.exception("Given Project ID was not found in DB!")
raise ProjectServiceException(str(excep))
开发者ID:rajul,项目名称:tvb-framework,代码行数:9,代码来源:project_service.py
示例9: remove_datatype
def remove_datatype(self, project_id, datatype_gid, skip_validation=False):
"""
Method used for removing a dataType. If the given dataType is a DatatypeGroup
or a dataType from a DataTypeGroup than this method will remove the entire group.
The operation(s) used for creating the dataType(s) will also be removed.
"""
datatype = dao.get_datatype_by_gid(datatype_gid)
if datatype is None:
self.logger.warning("Attempt to delete DT[%s] which no longer exists." % datatype_gid)
return
user = dao.get_user_for_datatype(datatype.id)
freed_space = datatype.disk_size or 0
is_datatype_group = False
if dao.is_datatype_group(datatype_gid):
is_datatype_group = True
freed_space = dao.get_datatype_group_disk_size(datatype.id)
elif datatype.fk_datatype_group is not None:
is_datatype_group = True
datatype = dao.get_datatype_by_id(datatype.fk_datatype_group)
freed_space = dao.get_datatype_group_disk_size(datatype.id)
operations_set = [datatype.fk_from_operation]
correct = True
if is_datatype_group:
self.logger.debug("Removing datatype group %s" % datatype)
data_list = dao.get_datatypes_from_datatype_group(datatype.id)
for adata in data_list:
self._remove_project_node_files(project_id, adata.gid, skip_validation)
if adata.fk_from_operation not in operations_set:
operations_set.append(adata.fk_from_operation)
datatype_group = dao.get_datatype_group_by_gid(datatype.gid)
dao.remove_datatype(datatype_gid)
correct = correct and dao.remove_entity(model.OperationGroup, datatype_group.fk_operation_group)
else:
self.logger.debug("Removing datatype %s" % datatype)
self._remove_project_node_files(project_id, datatype.gid, skip_validation)
## Remove Operation entity in case no other DataType needs them.
project = dao.get_project_by_id(project_id)
for operation_id in operations_set:
dependent_dt = dao.get_generic_entity(model.DataType, operation_id, "fk_from_operation")
if len(dependent_dt) > 0:
### Do not remove Operation in case DataType still exist referring it.
continue
correct = correct and dao.remove_entity(model.Operation, operation_id)
## Make sure Operation folder is removed
self.structure_helper.remove_operation_data(project.name, datatype.fk_from_operation)
if not correct:
raise RemoveDataTypeException("Could not remove DataType " + str(datatype_gid))
user.used_disk_space = user.used_disk_space - freed_space
dao.store_entity(user)
开发者ID:unimauro,项目名称:tvb-framework,代码行数:56,代码来源:project_service.py
示例10: get_gifty_file_name
def get_gifty_file_name(project_id, desired_name):
"""
Compute non-existent file name, in the TEMP folder of
the given project.
Try desired_name, and if already exists, try adding a number.
"""
if project_id:
project = dao.get_project_by_id(project_id)
file_helper = FilesHelper()
temp_path = file_helper.get_project_folder(project, FilesHelper.TEMP_FOLDER)
return get_unique_file_name(temp_path, desired_name)[0]
return get_unique_file_name(cfg.TVB_STORAGE, desired_name)[0]
开发者ID:HuifangWang,项目名称:the-virtual-brain-website,代码行数:12,代码来源:helper_handler.py
示例11: __init__
def __init__(self, overwrites=None, settings_file=None):
""" Parameters can be overwritten either from a settigns file or from a dictionary. """
if overwrites is not None:
self.overwrites.update(overwrites)
if settings_file is not None:
settings = open(sys.argv[1]).read()
for line in settings.split('\n'):
key, value = line.split('=')
self.overwrites[key.strip()] = value.strip()
if KEY_PROJECT not in self.overwrites:
raise Exception("Settings file should contain the id of the project: %s=1" % KEY_PROJECT)
self.project = dao.get_project_by_id(self.overwrites[KEY_PROJECT])
self.flow_service = FlowService()
self.operation_service = OperationService()
开发者ID:gummadhav,项目名称:tvb-framework,代码行数:14,代码来源:model_validations.py
示例12: cancel_or_remove_burst
def cancel_or_remove_burst(self, burst_id):
"""
Cancel (if burst is still running) or Remove the burst given by burst_id.
:returns True when Remove operation was done and False when Cancel
"""
burst_entity = dao.get_burst_by_id(burst_id)
if burst_entity.status == burst_entity.BURST_RUNNING:
self.stop_burst(burst_entity)
return False
service = ProjectService()
## Remove each DataType in current burst.
## We can not leave all on cascade, because it won't work on SQLite for mapped dataTypes.
datatypes = dao.get_all_datatypes_in_burst(burst_id)
## Get operations linked to current burst before removing the burst or else
## the burst won't be there to identify operations any more.
remaining_ops = dao.get_operations_in_burst(burst_id)
# Remove burst first to delete work-flow steps which still hold foreign keys to operations.
correct = dao.remove_entity(burst_entity.__class__, burst_id)
if not correct:
raise RemoveDataTypeException("Could not remove Burst entity!")
for datatype in datatypes:
service.remove_datatype(burst_entity.fk_project, datatype.gid, False)
## Remove all Operations remained.
correct = True
remaining_op_groups = set()
project = dao.get_project_by_id(burst_entity.fk_project)
for oper in remaining_ops:
is_remaining = dao.get_generic_entity(oper.__class__, oper.id)
if len(is_remaining) == 0:
### Operation removed cascaded.
continue
if oper.fk_operation_group is not None and oper.fk_operation_group not in remaining_op_groups:
is_remaining = dao.get_generic_entity(model.OperationGroup, oper.fk_operation_group)
if len(is_remaining) > 0:
remaining_op_groups.add(oper.fk_operation_group)
correct = correct and dao.remove_entity(model.OperationGroup, oper.fk_operation_group)
correct = correct and dao.remove_entity(oper.__class__, oper.id)
service.structure_helper.remove_operation_data(project.name, oper.id)
if not correct:
raise RemoveDataTypeException("Could not remove Burst because a linked operation could not be dropped!!")
return True
开发者ID:lcosters,项目名称:tvb-framework,代码行数:47,代码来源:burst_service.py
示例13: test_find_project_happy_flow
def test_find_project_happy_flow(self):
"""
Standard flow for finding a project by it's id.
"""
initial_projects = dao.get_projects_for_user(self.test_user.id)
self.assertEqual(len(initial_projects), 0, "Database reset probably failed!")
inserted_project = TestFactory.create_project(self.test_user, 'test_project')
self.assertTrue(self.project_service.find_project(inserted_project.id) is not None, "Project not found !")
dao_returned_project = dao.get_project_by_id(inserted_project.id)
service_returned_project = self.project_service.find_project(inserted_project.id)
self.assertEqual(dao_returned_project.id, service_returned_project.id,
"Data returned from service is different from data returned by DAO.")
self.assertEqual(dao_returned_project.name, service_returned_project.name,
"Data returned from service is different than data returned by DAO.")
self.assertEqual(dao_returned_project.description, service_returned_project.description,
"Data returned from service is different from data returned by DAO.")
self.assertEqual(dao_returned_project.members, service_returned_project.members,
"Data returned from service is different from data returned by DAO.")
开发者ID:sdiazpier,项目名称:tvb-framework,代码行数:18,代码来源:project_service_test.py
示例14: get_users_for_project
def get_users_for_project(self, user_name, project_id, page=1):
"""
Return tuple: (All Users except the project administrator, Project Members).
Parameter "user_name" is the current user.
Parameter "user_name" is used for new projects (project_id is None).
When "project_id" not None, parameter "user_name" is ignored.
"""
try:
admin_name = user_name
if project_id is not None:
project = dao.get_project_by_id(project_id)
if project is not None:
admin_name = project.administrator.username
all_users, total_pages = self.retrieve_all_users(admin_name, page)
members = dao.get_members_of_project(project_id)
return all_users, members, total_pages
except Exception as excep:
self.logger.exception("Invalid userName or project identifier")
raise UsernameException(str(excep))
开发者ID:maedoc,项目名称:tvb-framework,代码行数:19,代码来源:user_service.py
示例15: import_h5
def import_h5(file_path, project_id):
flow_service = FlowService()
## This ID of a project needs to exists in Db, and it can be taken from the WebInterface:
project = dao.get_project_by_id(project_id)
adapter_instance = ABCAdapter.build_adapter_from_class(TVBImporter)
## Prepare the input algorithms as if they were coming from web UI submit:
launch_args = {"data_file": file_path}
print "We will try to import file at path " + file_path
## launch an operation and have the results stored both in DB and on disk
launched_operations = flow_service.fire_operation(
adapter_instance, project.administrator, project.id, **launch_args
)
print "Operation launched. Check the web UI"
开发者ID:transpersonify,项目名称:tvb-framework,代码行数:19,代码来源:h5_import.py
示例16: remove_project
def remove_project(self, project_id):
"""
Remove Project from DB and File Storage.
"""
try:
project2delete = dao.get_project_by_id(project_id)
project_bursts = dao.get_bursts_for_project(project_id)
for burst in project_bursts:
dao.remove_entity(burst.__class__, burst.id)
project_datatypes = dao.get_datatypes_info_for_project(project_id)
for one_data in project_datatypes:
self.remove_datatype(project_id, one_data[9], True)
self.structure_helper.remove_project_structure(project2delete.name)
name = project2delete.name
dao.delete_project(project_id)
self.logger.debug("Deleted project: id=" + str(project_id) + ' name=' + name)
except RemoveDataTypeError, excep:
self.logger.error("Invalid DataType to remove!")
self.logger.exception(excep)
raise ProjectServiceException(excep.message)
开发者ID:HuifangWang,项目名称:the-virtual-brain-website,代码行数:20,代码来源:project_service.py
示例17: fire_operation
def fire_operation(self, adapter_instance, current_user, project_id, visible=True, **data):
"""
Launch an operation, specified by AdapterInstance, for CurrentUser,
Current Project and a given set of UI Input Data.
"""
operation_name = str(adapter_instance.__class__.__name__)
try:
self.logger.info("Starting operation " + operation_name)
project = dao.get_project_by_id(project_id)
tmp_folder = self.file_helper.get_project_folder(project, self.file_helper.TEMP_FOLDER)
result = OperationService().initiate_operation(current_user, project.id, adapter_instance,
tmp_folder, visible, **data)
self.logger.info("Finished operation:" + operation_name)
return result
except TVBException, excep:
self.logger.exception("Could not launch operation " + operation_name +
" with the given set of input data, because: " + excep.message)
raise OperationException(excep.message, excep)
开发者ID:boegel,项目名称:tvb-framework,代码行数:20,代码来源:flow_service.py
示例18: launch_simulation_workflow
def launch_simulation_workflow(json_path, prj_id):
"""
:param json_path: Path towards a local JSON file exported from GUI
:param prj_id: This ID of a project needs to exists in DB, and it can be taken from the WebInterface
"""
project = dao.get_project_by_id(prj_id)
with open(json_path, 'rb') as input_file:
simulation_json = input_file.read()
simulation_json = json.loads(simulation_json)
LOG.info("Simulation JSON loaded from file '%s': \n %s", json_path, simulation_json)
importer = ImportService()
simulation_config = importer.load_burst_entity(simulation_json, prj_id)
LOG.info("Simulation Workflow configuration object loaded: \n %s", simulation_config)
flow_service = FlowService()
simulator_algorithm, _ = flow_service.get_algorithm_by_module_and_class(SIMULATOR_MODULE, SIMULATOR_CLASS)
LOG.info("Found Simulation algorithm in local DB: \n %s", simulator_algorithm)
burst_service = BurstService()
burst_service.launch_burst(simulation_config, 0, simulator_algorithm.id, project.administrator.id, LAUNCH_NEW)
LOG.info("Check in the web GUI for your operation. It should be starting now ...")
开发者ID:amitsaroj001,项目名称:tvb-framework,代码行数:24,代码来源:run_workflow.py
示例19: launch
def launch(self, resolution, weighting, inf_vox_thresh, vol_thresh):
resolution = int(resolution)
weighting = int(weighting)
inf_vox_thresh = float(inf_vox_thresh)
vol_thresh = float(vol_thresh)
project = dao.get_project_by_id(self.current_project_id)
manifest_file = self.file_handler.get_allen_mouse_cache_folder(project.name)
manifest_file = os.path.join(manifest_file, "mouse_connectivity_manifest.json")
cache = MouseConnectivityCache(resolution=resolution, manifest_file=manifest_file)
# the method creates a dictionary with information about which experiments need to be downloaded
ist2e = DictionaireBuilder(cache, False)
# the method downloads experiments necessary to build the connectivity
projmaps = DownloadAndConstructMatrix(cache, weighting, ist2e, False)
# the method cleans the file projmaps in 4 steps
projmaps = pmsCleaner(projmaps)
Vol, annot_info = cache.get_annotation_volume()
ontology = cache.get_ontology()
# the method includes in the parcellation only brain regions whose volume is greater than vol_thresh
projmaps = AreasVolumeTreshold(projmaps, vol_thresh, resolution, Vol, ontology)
# the method includes in the parcellation only brain regions where at least one injection experiment had infected more than N voxel (where N is inf_vox_thresh)
projmaps = AreasVoxelTreshold(cache, projmaps, inf_vox_thresh, Vol, ontology)
# the method creates file order and keyord that will be the link between the SC order and the id key in the Allen database
[order, key_ord] = CreateFileOrder(projmaps, ontology)
# the method builds the Structural Connectivity (SC) matrix
SC = ConstructingSC(projmaps, order, key_ord)
# the method returns the coordinate of the centres and the name of the brain areas in the selected parcellation
[centres, names] = Construct_centres(ontology, order, key_ord, Vol)
# the method returns the tract lengths between the brain areas in the selected parcellation
tract_lengths = ConstructTractLengths(centres)
# the method associated the parent and the grandparents to the child in the selected parcellation with the biggest volume
[unique_parents, unique_grandparents] = ParentsAndGrandParentsFinder(order, key_ord, Vol, ontology)
# the method returns a volume indexed between 0 and N-1, with N=tot brain areas in the parcellation. -1=background and areas that are not in the parcellation
Vol_parcel = MouseBrainVisualizer(Vol, order, key_ord, unique_parents, unique_grandparents, ontology, projmaps)
# results: Connectivity, Volume & RegionVolumeMapping
# Connectivity
result_connectivity = Connectivity(storage_path=self.storage_path)
result_connectivity.centres = centres
result_connectivity.region_labels = names
result_connectivity.weights = SC
result_connectivity.tract_lengths = tract_lengths
# Volume
result_volume = Volume(storage_path=self.storage_path)
result_volume.origin = [[0.0, 0.0, 0.0]]
result_volume.voxel_size = [resolution, resolution, resolution]
# result_volume.voxel_unit= micron
# Region Volume Mapping
result_rvm = RegionVolumeMapping(storage_path=self.storage_path)
result_rvm.volume = result_volume
result_rvm.array_data = Vol_parcel
result_rvm.connectivity = result_connectivity
result_rvm.title = "Volume mouse brain "
result_rvm.dimensions_labels = ["X", "Y", "Z"]
return [result_connectivity, result_rvm, result_volume]
开发者ID:transpersonify,项目名称:tvb-framework,代码行数:67,代码来源:allen_creator.py
示例20: import_conn_zip
def import_conn_zip(project_id, zip_path):
project = dao.get_project_by_id(project_id)
group = dao.get_algorithm_by_module('tvb.adapters.uploaders.zip_connectivity_importer', 'ZIPConnectivityImporter')
importer = ABCAdapter.build_adapter(group)
### Launch Operation
FlowService().fire_operation(importer, project.administrator, project_id, uploaded=zip_path)
开发者ID:LauHoiYanGladys,项目名称:tvb-framework,代码行数:6,代码来源:lab.py
注:本文中的tvb.core.entities.storage.dao.get_project_by_id函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论