mcmodels.core.RegionalData

class mcmodels.core.RegionalData(cache, injection_structure_ids=None, projection_structure_ids=None, injection_hemisphere_id=3, projection_hemisphere_id=3, normalized_injection=True, normalized_projection=True, flip_experiments=True, data_mask_tolerance=0.0, injection_volume_bounds=(0.0, inf), projection_volume_bounds=(0.0, inf), min_contained_injection_ratio=0.0)[source]

Container class for regionalized voxel-scale grid data.

Parameters:
cache - VoxelModelCache or MouseConnectivityCache object

Provides way to pull experiment grid-data from Allen Brain Atlas

injection_structure_ids : list, optional, default None

List of structure_ids to which the injection mask will be constrained.

projection_structure_ids : list, optional, default None

List of structure_ids to which the projection mask will be constrained.

injection_hemisphere_id : int, optional, default 3

Hemisphere (1:left, 2:right, 3:both) to which the injection mask will be constrained.

projection_hemisphere_id : int, optional, default 3

Hemisphere (1:left, 2:right, 3:both) to which the projection mask will be constrained.

normalized_injection : boolean, optional, default True

If True, the injection density will be normalized by the total injection density for each experiment.

normalized_projection : boolean, optional, default True

If True, the projection density will be normalized by the total injection density for each experiment.

flip_experiments : boolean, optional, default True

If True, experiment grid-data will be reflected across the midline. Useful if you wish to include L hemisphere injections into a R hemisphere model.

data_mask_tolerance : float, optional, default 0.0

Tolerance with which to include data in voxels informatically labeled as having error. The data_mask for each experiment is an array with values between (0, 1), where 1 indicates the voxel fully contains an error, whereas 0 indicates the voxel does not contain any error. A value of 0.0 thus indicates the highest threshold for data, whereas a value of 1.0 indicates that data will be included from all voxels.

injection_volume_bounds : float, optional, default (0.0, np.inf)

Includes experiments with total injection volume (mm^3) within bounds.

projection_volume_bounds : float, optional, default (0.0, np.inf)

Includes experiments with total projection volume (mm^3) within bounds.

min_contained_injection_ratio : float, optional, default 0.0

Includes experiments with total injection volume ratio within injection mask.

See also

VoxelData

Notes

object having identical injections or projections attributes to those generated from get_experiment_data since the latter unionizes are computed at a finer resolution. Still, the results should be very similar. - get_experiment_data is prefered if only concerned with unionized data, because it loads the unionizes cached by the cache parameter instead of computing the unionizations from cached grid data volumes.

Examples

>>> from mcmodels.core import RegionalData, VoxelModelCache
>>> cache = VoxelModelCache()
>>> experiment_ids = (112514202, 139520203)
>>> regional_data = RegionalData(cache)
>>> regional_data.get_experiment_data(experiment_ids)
RegionalData()
Attributes:
injection_mask : Mask object

Mask object used to constrain and flatten the injection_density from each experiment. This object can also be used to generate a key relating each column of the injections matrix to a corresponding structure or to transform a given row of the injections matrix to its corresponding brain volume.

projection_mask : Mask object

Mask object used to constrain and flatten the projection_density from each experiment. This object can also be used to generate a key relating each column of the projections matrix to a corresponding structure or to transform a given row of the projections matrix to its corresponding brain volume.

centroids : array, shape (n_experiments, 3)

Stacked array of injection centroids for each experiment.

injections : array, shape (n_experiments, n_source_regions)

Stacked array of constrained, flattened injection densities for each experiment.

projections : array, shape (n_experiments, n_target_regions)

Stacked array of constrained, flattened projection densities for each experiment.

Methods

from_voxel_data(voxel_data) Construct class from a VoxelData object.
get_experiment_data(self, experiment_ids[, …]) Pulls regionalized voxel-scale grid data for experiments.
__init__(self, cache, injection_structure_ids=None, projection_structure_ids=None, injection_hemisphere_id=3, projection_hemisphere_id=3, normalized_injection=True, normalized_projection=True, flip_experiments=True, data_mask_tolerance=0.0, injection_volume_bounds=(0.0, inf), projection_volume_bounds=(0.0, inf), min_contained_injection_ratio=0.0)

Methods

__init__(self, cache[, …])
from_voxel_data(voxel_data) Construct class from a VoxelData object.
get_experiment_data(self, experiment_ids[, …]) Pulls regionalized voxel-scale grid data for experiments.
classmethod from_voxel_data(voxel_data)[source]

Construct class from a VoxelData object.

Parameters:
voxel_data : a VoxelData object
Returns:
RegionalData : an installation of the RegionalData object
get_experiment_data(self, experiment_ids, use_dataframes=False)[source]

Pulls regionalized voxel-scale grid data for experiments.

Uses the cache attribute to pull grid data from the Allen Brain Atlas. Note that only experiments passing all defined parameters will be included.

Parameters:
experiment_ids : list

Ids of candidate experiments to pull. Only the subset of these experiments passing user defined object parameters will be pulled.

Returns:
self : returns an instance of self.