Beispiel #1
0
    def get_analyze_groups(self):
        """
        :return: list of AlgorithmTransientGroup entities
        """
        categories = dao.get_launchable_categories(elimin_viewers=True)
        categories_ids = [categ.id for categ in categories]
        stored_adapters = dao.get_adapters_from_categories(categories_ids)

        groups_list = []
        for adapter in stored_adapters:
            # For empty groups, this time, we fill the actual adapter
            group = AlgorithmTransientGroup(adapter.group_name or adapter.displayname,
                                            adapter.group_description or adapter.description)
            group = self._find_group(groups_list, group)
            group.children.append(adapter)
        return categories[0], groups_list
Beispiel #2
0
 def _group_adapters_by_category(self, stored_adapters, categories):
     """
     :param stored_adapters: list StoredAdapter
     :return: dict(category_name: List AlgorithmTransientGroup), empty groups all in the same AlgorithmTransientGroup
     """
     categories_dict = dict()
     for adapter in stored_adapters:
         category_name = categories.get(adapter.fk_category)
         if category_name in categories_dict:
             groups_list = categories_dict.get(category_name)
         else:
             groups_list = []
             categories_dict[category_name] = groups_list
         group = AlgorithmTransientGroup(adapter.group_name, adapter.group_description)
         group = self._find_group(groups_list, group)
         group.children.append(adapter)
     return categories_dict
#
# CITATION:
# When using The Virtual Brain for scientific publications, please cite it as follows:
#
# Paula Sanz Leon, Stuart A. Knock, M. Marmaduke Woodman, Lia Domide,
# Jochen Mersmann, Anthony R. McIntosh, Viktor Jirsa (2013)
# The Virtual Brain: a simulator of primate brain network dynamics.
# Frontiers in Neuroinformatics (7:10. doi: 10.3389/fninf.2013.00010)
#
#

from tvb.core.entities.model import AlgorithmTransientGroup
from tvb.adapters.analyzers.bct_adapters import BaseBCT, bct_description

BCT_GROUP_DEGREE = AlgorithmTransientGroup("Degree and Similarity Algorithms",
                                           "Brain Connectivity Toolbox",
                                           "bctdegree")
BCT_GROUP_DENSITY = AlgorithmTransientGroup("Density Algorithms",
                                            "Brain Connectivity Toolbox",
                                            "bctdensity")


class Degree(BaseBCT):
    """
    """
    _ui_group = BCT_GROUP_DEGREE
    _ui_connectivity_label = "Undirected (binary/weighted) connection matrix:"

    _ui_name = "Degree"
    _ui_description = bct_description("degrees_und.m")
    _matlab_code = "deg = degrees_und(CIJ);"
Beispiel #4
0
#
# CITATION:
# When using The Virtual Brain for scientific publications, please cite it as follows:
#
# Paula Sanz Leon, Stuart A. Knock, M. Marmaduke Woodman, Lia Domide,
# Jochen Mersmann, Anthony R. McIntosh, Viktor Jirsa (2013)
# The Virtual Brain: a simulator of primate brain network dynamics.
# Frontiers in Neuroinformatics (7:10. doi: 10.3389/fninf.2013.00010)
#
#

from tvb.adapters.analyzers.bct_adapters import BaseBCT, BaseUndirected, bct_description, LABEL_CONNECTIVITY_BINARY
from tvb.core.entities.model import AlgorithmTransientGroup

BCT_GROUP_CENTRALITY = AlgorithmTransientGroup("Centrality Algorithms",
                                               "Brain Connectivity Toolbox",
                                               "bctcentrality")


class CentralityNodeBinary(BaseBCT):
    """
    """
    _ui_group = BCT_GROUP_CENTRALITY
    _ui_connectivity_label = LABEL_CONNECTIVITY_BINARY

    _ui_name = "Node Betweenness Centrality Binary"
    _ui_description = bct_description("betweenness_bin.m")
    _matlab_code = "C = betweenness_bin(A);"

    def launch(self, connectivity, **kwargs):
        kwargs['A'] = connectivity.binarized_weights
Beispiel #5
0
# CITATION:
# When using The Virtual Brain for scientific publications, please cite it as follows:
#
# Paula Sanz Leon, Stuart A. Knock, M. Marmaduke Woodman, Lia Domide,
# Jochen Mersmann, Anthony R. McIntosh, Viktor Jirsa (2013)
# The Virtual Brain: a simulator of primate brain network dynamics.
# Frontiers in Neuroinformatics (7:10. doi: 10.3389/fninf.2013.00010)
#
#

from tvb.core.entities.model import AlgorithmTransientGroup
from tvb.adapters.analyzers.bct_adapters import BaseBCT, BaseUndirected, bct_description, \
    LABEL_CONN_WEIGHTED_UNDIRECTED, LABEL_CONN_WEIGHTED_DIRECTED


BCT_GROUP_CLUSTERING = AlgorithmTransientGroup("Clustering Algorithms", "Brain Connectivity Toolbox", "bctclustering")


class ClusteringCoefficient(BaseBCT):
    """
    """
    _ui_group = BCT_GROUP_CLUSTERING
    _ui_connectivity_label = "Binary directed connection matrix:"

    _ui_name = "Clustering Coefficient BD"
    _ui_description = bct_description("clustering_coef_bd.m")
    _matlab_code = "C = clustering_coef_bd(A);"


    def launch(self, connectivity, **kwargs):
        kwargs['A'] = connectivity.weights
Beispiel #6
0
#

import os
from abc import abstractmethod
from tvb.adapters.analyzers.matlab_worker import MatlabWorker
from tvb.basic.filters.chain import FilterChain
from tvb.basic.profile import TvbProfile
from tvb.core.adapters.abcadapter import ABCAsynchronous
from tvb.core.entities.model import AlgorithmTransientGroup
from tvb.core.utils import extract_matlab_doc_string
from tvb.datatypes.connectivity import Connectivity
from tvb.datatypes.graph import ConnectivityMeasure
from tvb.datatypes.mapped_values import ValueWrapper

BCT_GROUP_MODULARITY = AlgorithmTransientGroup("Modularity Algorithms",
                                               "Brain Connectivity Toolbox",
                                               "bct")
BCT_GROUP_DISTANCE = AlgorithmTransientGroup("Distance Algorithms",
                                             "Brain Connectivity Toolbox",
                                             "bctdistance")

BCT_PATH = os.path.join(TvbProfile.current.EXTERNALS_FOLDER_PARENT,
                        "externals/BCT")
BCT_PATH_ENV = 'BCT_PATH'
if BCT_PATH_ENV in os.environ and os.path.exists(
        os.environ[BCT_PATH_ENV]) and os.path.isdir(os.environ[BCT_PATH_ENV]):
    BCT_PATH = os.environ[BCT_PATH_ENV]

LABEL_CONNECTIVITY_BINARY = "Binary (directed/undirected) connection matrix"
LABEL_CONN_WEIGHTED_DIRECTED = "Weighted directed connection matrix"
LABEL_CONN_WEIGHTED_UNDIRECTED = "Weighted undirected connection matrix"