mcmodels.models.voxel.RegionalizedModel

class mcmodels.models.voxel.RegionalizedModel(weights, nodes, source_key, target_key, ordering=None, dataframe=False)[source]

Regionalization/Parcelation of VoxelModel.

Regionalizes the connectivity model in VoxelModel given a brain parcelation.

Parameters:
source_key : array-like, shape=(n_source_voxels,)

Flattened key relating each source voxel to a given brain region.

target_key : array-like, shape=(n_target_voxels,)

Flattened key relating each target voxel to a given brain region.

ordering : array-like, optional (default=None)

Order with which to arrange the source/target regions. If supplied, the ordering must contain at least every unique structure_id associated with each of the source/target regions.

dataframe : boolean, optional (default=False)

If True, each metric of the regionalized model will be returned as a labeled pandas dataframe. Else, each metric will be returned as an unlabeled numpy array.

Examples

>>> from mcmodels.core import VoxelModelCache
>>> from mcmodels.models.voxel import RegionalizedModel
>>> cache = VoxelModelCache()
>>> # pull voxel-scale model from cache
>>> voxel_array, source_mask, target_mask = cache.get_voxel_connectivity_array()
>>> # regionalize to summary structures (region 934 was removed in new ccf)
>>> regions = cache.get_structures_by_set_id(
>>> region_ids = [r['id'] for r in regions if r['id'] != 934]
>>> # get array keys
>>> source_key = source_mask.get_key(region_ids)
>>> target_key = source_mask.get_key(region_ids)
>>> # regionalize model
>>> regional_model = RegionalizedModel.from_voxel_array(
...     voxel_array, source_key, target_key)
>>> regional_model.normalized_connection_density.shape
(291, 577)
Attributes:
connection_density

\(w_{ij} / |Y|\)

connection_strength

\(w_{ij}\)

normalized_connection_density

\(w_{ij} / (|X| |Y|)\)

normalized_connection_strength

\(w_{ij} / |X|\)

Methods

from_voxel_array(voxel_array, \*args, \*\*kwargs) Alternative constructor.
predict(self, X[, normalize]) Predict regional projection.
__init__(self, weights, nodes, source_key, target_key, ordering=None, dataframe=False)[source]

Methods

__init__(self, weights, nodes, source_key, …)
from_voxel_array(voxel_array, \*args, \*\*kwargs) Alternative constructor.
predict(self, X[, normalize]) Predict regional projection.
connection_density

\(w_{ij} / |Y|\)

The average voxel-scale connectivity between each source voxel to each source region.

connection_strength

\(w_{ij}\)

The sum of the voxel-scale connectivity between each pair of source-target regions.

classmethod from_voxel_array(voxel_array, *args, **kwargs)[source]

Alternative constructor.

Parameters:
voxel_array : VoxelConnectivityArray object

The voxel-scale model in the form of a VoxelConnectivityArray object.

source_key : array-like, shape=(n_source_voxels,)

Flattened key relating each source voxel to a given brain region.

target_key : array-like, shape=(n_target_voxels,)

Flattened key relating each target voxel to a given brain region.

ordering : array-like, optional (default=None)

Order with which to arrange the source/target regions. If supplied, the ordering must contain at least every unique structure_id associated with each of the source/target regions.

dataframe : boolean, optional (default=False)

If True, each metric of the regionalized model will be returned as a labeled pandas dataframe. Else, each metric will be returned as an unlabeled numpy array.

Returns:
An instantiated RegionalizedModel object.
normalized_connection_density

\(w_{ij} / (|X| |Y|)\)

The average voxel-scale connectivity between each pair of source-target regions

normalized_connection_strength

\(w_{ij} / |X|\)

The average voxel-scale connectivity between each source region to each target voxel”

predict(self, X, normalize=False)[source]

Predict regional projection.