How to use the allensdk.core.mouse_connectivity_cache.MouseConnectivityCache function in allensdk

To help you get started, we’ve selected a few allensdk examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github BrancoLab / BrainRender / brainrender / atlases / mouse.py View on Github external
def __init__(self, base_dir=None, **kwargs):
        BrainGlobeAtlasBase.__init__(self, base_dir=base_dir, **kwargs)

        # get mouse connectivity cache and structure tree
        self.mcc = MouseConnectivityCache(
            manifest_file=os.path.join(
                self.mouse_connectivity_cache, "manifest.json"
            )
        )
        self.structure_tree = self.mcc.get_structure_tree()

        # get ontologies API and brain structures sets
        self.oapi = OntologiesApi()

        # get reference space
        self.space = ReferenceSpaceApi()
        self.spacecache = ReferenceSpaceCache(
            manifest=os.path.join(
                self.annotated_volume_fld, "manifest.json"
            ),  # downloaded files are stored relative to here
            resolution=self.resolution,
github the-virtual-brain / tvb-framework / tvb / adapters / creators / allen_creator.py View on Github external
def launch(self, resolution, weighting, inj_f_thresh, vol_thresh):
        resolution = int(resolution)
        weighting = int(weighting)
        inj_f_thresh = float(inj_f_thresh)/100.
        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 = dictionary_builder(cache, False)

        # the method downloads experiments necessary to build the connectivity
        projmaps = download_an_construct_matrix(cache, weighting, ist2e, False)

        # the method cleans the file projmaps in 4 steps
        projmaps = pms_cleaner(projmaps)

        # download from the AllenSDK the annotation volume, the template volume
        vol, annot_info = cache.get_annotation_volume()
        template, template_info = cache.get_template_volume()

        # rotate template in the TVB 3D reference:
        template = rotate_reference(template)
github AllenInstitute / mouse_connectivity_models / mcmodels / core / voxel_model_cache.py View on Github external
# Authors: Joseph Knox 
# License: Allen Institute Software License

import numpy as np
import pandas as pd
from allensdk.core import json_utilities
from allensdk.core.mouse_connectivity_cache import MouseConnectivityCache

from .base import VoxelData
from .masks import Mask
from .voxel_model_api import VoxelModelApi

from ..models.voxel import VoxelConnectivityArray


class VoxelModelCache(MouseConnectivityCache):
    """Cache class extending MouseConnectivityCache to cache voxel model data.

    Parameters
    ----------
    resolution: int
        Resolution of grid data to be downloaded when accessing projection volume,
        the annotation volume, and the annotation volume.  Must be one of (10, 25,
        50, 100).  Default is 25.

    ccf_version: string
        Desired version of the Common Coordinate Framework.  This affects the annotation
        volume (get_annotation_volume) and structure masks (get_structure_mask).
        Must be one of (MouseConnectivityApi.CCF_2015, MouseConnectivityApi.CCF_2016).
        Default: MouseConnectivityApi.CCF_2016

    cache: boolean
github BrancoLab / BrainRender / brainrender / atlases / aba.py View on Github external
def __init__(self):
        # get mouse connectivity cache and structure tree
        self.mcc = MouseConnectivityCache(
            manifest_file=os.path.join(
                self.mouse_connectivity_cache, "manifest.json"
            )
        )
        self.structure_tree = self.mcc.get_structure_tree()

        # get ontologies API and brain structures sets
        self.oapi = OntologiesApi()

        # get reference space
        self.space = ReferenceSpaceApi()
        self.spacecache = ReferenceSpaceCache(
            manifest=os.path.join(
                self.annotated_volume_fld, "manifest.json"
            ),  # downloaded files are stored relative to here
            resolution=int(self.resolution[0]),