How to use the brainrender.Utils.paths_manager.Paths.__init__ function in brainrender

To help you get started, we’ve selected a few brainrender 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 / celegans.py View on Github external
def __init__(self, data_folder=None, base_dir=None, **kwargs):
        """
            This class handles loading and parsing neuroanatomical data for the C. elegans connectome from 
            https://www.biorxiv.org/content/10.1101/2020.04.30.066209v1

            :param base_dir: path to directory to use for saving data (default value None)
            :param kwargs: can be used to pass path to individual data folders. See brainrender/Utils/paths_manager.py
            :param data_folder: str, path to a folder with data for the connectome # TODO replace with downloading data
        """
        # Initialise atlas
        Paths.__init__(self, base_dir, **kwargs)

        # Get data
        if data_folder is None:
            raise ValueError(
                "No data folder was passed, use the 'atlas_kwargs' argument of Scene to pass a data folder path"
            )
        if not os.path.isdir(data_folder):
            raise FileNotFoundError(f"The folder {data_folder} does not exist")
        self.data_folder = data_folder
        self._get_data()
github BrancoLab / BrainRender / brainrender / Utils / AllenMorphologyAPI / AllenMorphology.py View on Github external
def __init__(self, *args, scene_kwargs={},  **kwargs):
		"""
			Initialise API interaction and fetch metadata of neurons in the Allen Database. 
		"""
		if not connected_to_internet():
			raise ConnectionError("You will need to be connected to the internet to use the AllenMorphology class")

		Paths.__init__(self, *args, **kwargs)
		self.scene = Scene(add_root=False, display_inset=False, **scene_kwargs)

		# Create a Cache for the Cell Types Cache API
		self.ctc = CellTypesCache(manifest_file=os.path.join(self.morphology_allen, 'manifest.json'))

		# Get a list of cell metadata for neurons with reconstructions, download if necessary
		self.neurons = pd.DataFrame(self.ctc.get_cells(species=[CellTypesApi.MOUSE], require_reconstruction = True))
		self.n_neurons = len(self.neurons)
		if not self.n_neurons: raise ValueError("Something went wrong and couldn't get neurons metadata from Allen")

		self.downloaded_neurons = self.get_downloaded_neurons()
github BrancoLab / BrainRender / brainrender / atlases / atlas.py View on Github external
def __init__(self, atlas_name, *args, base_dir=None, **kwargs):
        # Create brainglobe atlas
        BrainGlobeAtlas.__init__(self, *args, atlas_name=atlas_name, **kwargs)

        # Add brainrender paths
        Paths.__init__(self, base_dir=base_dir, **kwargs)
        self.meshes_folder = (
            None  # where the .obj mesh for each region is saved
        )

        # If it's a mouse atlas, add extra functionality
        if "Mus musculus" == self.metadata["species"]:
            ABA.__init__(self)
github BrancoLab / BrainRender / brainrender / Utils / MouseLightAPI / mouselight_api.py View on Github external
def __init__(self, base_dir=None, **kwargs):
		"""
			Handles the download of neurons morphology data from the Mouse Light project

			:param base_dir: path to directory to use for saving data (default value None)
			:param kwargs: can be used to pass path to individual data folders. See brainrender/Utils/paths_manager.py
		"""
		Paths.__init__(self, base_dir=base_dir, **kwargs)
github BrancoLab / BrainRender / brainrender / Utils / parsers / mouselight.py View on Github external
"""
		self.scene = scene # for the meaning of the arguments check self.render_neurons
		self.render_neurites = render_neurites 
		self.render_dendrites = render_dendrites
		self.render_axons = render_axons
		self.neurite_radius = neurite_radius 
		self.color_neurites = color_neurites 
		self.axon_color = axon_color 
		self.soma_color = soma_color 
		self.dendrites_color = dendrites_color 
		self.random_color = random_color
		self.mirror = mirror
		self.color_by_region = color_by_region
		self.force_to_hemisphere = force_to_hemisphere

		Paths.__init__(self, base_dir=base_dir, **kwargs)

		# Load cache metadata
		self.cache_metadata = load_json(self.morphology_cache_metadata)
github BrancoLab / BrainRender / brainrender / atlases / custom_atlases / insects_brains_db.py View on Github external
def __init__(
        self, species=None, sex=None, base_dir=None, make_root=True, **kwargs
    ):
        self.make_root = make_root

        Paths.__init__(self, base_dir=base_dir, **kwargs)

        # Get a list of available species
        self.species_info = pd.DataFrame(
            request(
                f"{self._base_url}/{self._url_paths['species_info']}"
            ).json()
        )
        self.species = list(self.species_info.scientific_name.values)

        # Get selected species
        self.structures, self.region_names, self.region_acronyms = (
            None,
            None,
            None,
        )
        self.sel_species = species