pad_dict_to_shape

pad_dict_to_shape#

stimupy.utils.pad_dict_to_shape(dct, shape, pad_value=0, keys=('img', '*mask'))#

Pad images in dictionary to a resulting specified shape in pixels

Parameters:
  • dct (dict) – dict containing image-arrays to be padded

  • shape (Sequence[int, int, ...]) – desired shape of img after padding

  • pad_value (float, optional) – value to pad with, by default 0.0

  • keys (Sequence[String, String] or String) – keys in dict for images to be padded

Returns:

same as input dict but with larger key-arrays and updated keys for “visual_size” and “shape”

Return type:

dict[str, Any]

Raises:

ValueError – if img.shape already exceeds shape