squidpy.im.process
- squidpy.im.process(img, layer=None, library_id=None, method='smooth', chunks=None, lazy=False, layer_added=None, channel_dim=None, copy=False, apply_kwargs=mappingproxy({}), **kwargs)[source]
Process an image by applying a transformation.
- Parameters:
img (
ImageContainer) – High-resolution image.layer (
str|None) – Image layer inimgthat should be processed. If None and only 1 layer is present, it will be selected.library_id (
str|Sequence[str] |None) – Name of the Z-dimension(s) that this function should be applied to. For not specified Z-dimensions, the identity function is applied. If None, all Z-dimensions are processed at once, treating the image as a 3D volume.method (
str|Callable[...,ndarray[tuple[Any,...],dtype[Any]]]) –Processing method to use. Valid options are:
’smooth’ -
skimage.filters.gaussian().’gray’ -
skimage.color.rgb2gray().
Alternatively, any
callable()can be passed as long as it has the following signature:numpy.ndarray(height, width, channels)->numpy.ndarray(height, width[, channels]).chunks (
int|None) – Number of chunks for Dask. For automatic chunking, usechunks = 'auto'.lazy (
bool) – Whether to lazily compute the result or not. Only used whenchunks != None.layer_added (
str|None) – Layer of new image layer to add intoimgobject. If None, use'{layer}_{method}'.channel_dim (
str|None) – Name of the channel dimension of the new image layer. Default is the same as the original, if the processing function does not change the number of channels, and'{channel}_{processing}'otherwise.copy (
bool) – IfTrue, return the result, otherwise save it to the image container.apply_kwargs (
Mapping[str,Any]) – Keyword arguments forsquidpy.im.ImageContainer.apply().kwargs (
Any) – Keyword arguments formethod.
- Return type:
- Returns:
If
copy = True, returns a new container with the processed image in'{layer_added}'.Otherwise, modifies the
imgwith the following key:squidpy.im.ImageContainer['{layer_added}']- the processed image.
- Raises:
NotImplementedError – If
methodhas not been implemented.