mcmodels.utils.unionize(volume, key, return_regions=False)[source]

Unionize voxel data to regional data.

volume : array, shape (n, m)

Possibly stacked flattened volume(s) such as projection densities or injection densities.

key : array, shape (m,)

1D Array with length equal to the number of columns in volume. This array has integer values corresponding to the region to which each voxel belongs.

return_regions : boolean, optional (default: False)

If True, return an array of the unique values of key in addition to the unionized volume array.

result : array, shape (n, len(unique(key)))

The unionized volume.

regions : array, optional, shape (len(unique(key)),)

The unique values of key.