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 (
int|float|tuple[int|float,int|float] |None) – Size of the crop as(height, width). If a singleint, the crop will be a square.If True, yields a
dictwhere keys are layers and values arenumpy.ndarray.If a
str, yields onenumpy.ndarrayfor the specified layer.If a
typing.Sequence, yields atupleofnumpy.ndarrayfor 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[tuple[Any,...],dtype[Any]]]]
Notes
Crops going outside out of the image boundary are padded with
cval.