sme.Compartment.geometry_mask

property Compartment.geometry_mask

a voxel mask of the compartment geometry

An array of boolean values, where geometry_mask[z][y][x] = True if the voxel at point (x,y,z) is part of this compartment

Examples

the mask is a 3d (depth x height x width) array of bool:

>>> import sme
>>> model = sme.open_example_model()
>>> mask = model.compartments['Cell'].geometry_mask
>>> type(mask)
<class 'numpy.ndarray'>
>>> mask.dtype
dtype('bool')
>>> mask.shape
(1, 100, 100)

the first z-slice of the mask can be displayed using matplotlib:

>>> import matplotlib.pyplot as plt
>>> imgplot = plt.imshow(mask[0], interpolation='none')
Type:

numpy.ndarray