Get#

class prose.blocks.utils.Get(*attributes, name: str = 'get', arrays: bool = True, **getters)[source]#

Retrieve and store properties from an Image.

If a list of paths is provided to a Sequence, each image is created at the beginning of the sequence, and deleted at the end, so that computed data stored as prose.Image properties are deleted at each iteration. This Get block provides a way to retain any data stored in images before they are deleted.

When a sequence is finished, this block has a values property, a dictionary where all retained properties are accessible by name, and consist of a list with a length corresponding to the number of images processed. The parameters of this dictionary are the args and kwargs provided to the block (see Example).

Parameters:
  • *attributes (str) – names of properties to retain

  • name (str, optional) – name of the block, by default “get”

  • arrays (bool, optional) – whether to convert each array of data as a numpy array , by default True

  • **getters (function) – name and functions

Example

from prose import example_image
from prose import blocks

# example image
image = example_image()

# running the block
block = blocks.Get(image_shape = lambda im: im.shape)
block.run(image)

# getting the output
block.image_shape
[array([600, 600])]