pad_dict_by_shape

pad_dict_by_shape#

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

Pad images in dictionary by specified amount(s) of pixels Can specify different amount (before, after) each axis.

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

  • padding (int, or Sequence[int, int], or Sequence[Sequence[int, int], ...]) – amount of padding, in pixels, in each direction: ((before_1, after_1), … (before_N, after_N)) unique pad widths for each axis (int,) or int is a shortcut for before = after = pad width for all axes.

  • pad_val (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]