squidpy.im.ImageContainer.generate_equal_crops
- ImageContainer.generate_equal_crops(size=None, as_array=False, squeeze=True, **kwargs)[source]
Decompose image into equally sized crops.
- Parameters:
size (
Union
[int
,float
,tuple
[Union
[int
,float
],Union
[int
,float
]],None
]) – Size of the crop as(height, width)
. If a singleint
, the crop will be a square.If True, yields a
dict
where keys are layers and values arenumpy.ndarray
.If a
str
, yields onenumpy.ndarray
for the specified layer.If a
typing.Sequence
, yields atuple
ofnumpy.ndarray
for the specified layers.Otherwise, yields
squidpy.im.ImageContainer
.
squeeze (
bool
) – Remove singleton dimensions from the results ifas_array = True
.kwargs (
Any
) – Keyword arguments forcrop_corner()
.
- Yields:
The crops, whose type depends on
as_array
.- Return type:
Iterator
[ImageContainer
] |Iterator
[dict
[str
,ndarray
[Any
,dtype
[Any
]]]]
Notes
Crops going outside out of the image boundary are padded with
cval
.