allensdk.internal.mouse_connectivity.interval_unionize.interval_unionizer module

class allensdk.internal.mouse_connectivity.interval_unionize.interval_unionizer.IntervalUnionizer(exclude_structure_ids=None)[source]

Bases: object

direct_unionize(data_arrays, pre_sorted=False, **kwargs)[source]

Obtain unionize records from directly annotated regions.

Parameters:
data_arraysdict

Keys identify types of data volume. Values are flattened arrays.

sortedbool, optional

If False, data arrays will be sorted.

extract_data(data_arrays, low, high, **kwargs)[source]

Given flattened data arrays and a specified interval, generate summary data

Parameters:
data_arraysdict

Keys identify types of data volume. Values are flattened, sorted arrays.

lowint

Index at which interval of interest begins. Inclusive.

highint

Index at which interval of interest ends. Exclusive.

postprocess_unionizes(raw_unionizes, **kwargs)[source]

Carry out additional calculations/formatting derivative of core unionization.

Parameters:
raw_unionizeslist of unionizes

Each entry is a unionize record.

classmethod propagate_record(child_record, ancestor_record, copy_all=False)[source]

Updates one unionize corresponding to a rootward structure with information from a unionize corresponding to a leafward structure

Parameters:
child_recordunionize

Data will be drawn from this record

ancestor_recordunionize

This record will be updated

classmethod propagate_to_bilateral(lateral_unionizes)[source]
classmethod propagate_unionizes(direct_unionizes, ancestor_id_map)[source]

Structures are arranged in a tree, whose leafward-oriented edges indicate physical containment. This method updates rootward unionize records with information from leafward ones.

Parameters:
direct_unionizeslist of unionizes

Each entry is a unionize record produced from a collection of directly labeled voxels in the segmentation volume.

ancestor_id_mapdict

Keys are structure ids. Values are ids of all structures rootward in

the tree, including the key node
Returns:
output_unionizeslist of unionizes

Contains completed unionize records at all depths in the structure tree

classmethod record_cb()[source]
setup_interval_map(annotation)[source]

Build a map from structure ids to intervals in the sorted flattened reference space.

Parameters:
annotationnp.ndarray

Segmentation label array.

sort_data_arrays(data_arrays)[source]

Apply the precomputed sort to flattened data arrays

Parameters:
data_arraysdict

Keys identify types of data volume. Values are flattened, unsorted arrays.

Returns:
dict

As input, but values are sorted