sme.Model.compartment_image

property Model.compartment_image

an image of the compartments in this model

An array of RGB integer values for each voxel in the image of the compartments in this model, which can be displayed using e.g. matplotlib.pyplot.imshow

Examples

the image is a 4d (depth x height x width x 3) array of integers:

>>> import sme
>>> model = sme.open_example_model()
>>> type(model.compartment_image)
<class 'numpy.ndarray'>
>>> model.compartment_image.dtype
dtype('uint8')
>>> model.compartment_image.shape
(1, 100, 100, 3)

each voxel in the image has a triplet of RGB integer values in the range 0-255:

>>> model.compartment_image[0, 34, 36]
array([144,  97, 193], dtype=uint8)

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

>>> import matplotlib.pyplot as plt
>>> imgplot = plt.imshow(model.compartment_image[0])
Type:

numpy.ndarray