squidpy.im.ImageContainer.features_texture

ImageContainer.features_texture(layer, library_id=None, feature_name='texture', channels=None, props=('contrast', 'dissimilarity', 'homogeneity', 'correlation', 'ASM'), distances=(1,), angles=(0, 0.7853981633974483, 1.5707963267948966, 2.356194490192345))

Calculate texture features.

A gray level co-occurrence matrix (GLCM) is computed for different combinations of distance and angle.

The distance defines the pixel difference of co-occurrence. The angle define the direction along which we check for co-occurrence. The GLCM includes the number of times that gray-level \(j\) occurs at a distance \(d\) and at an angle theta from gray-level \(i\).

Parameters:
Return type:

dict[str, Any]

Returns:

: Returns features with the following keys for each channel c in channels:

  • '{feature_name}_ch-{c}_{p}_dist-{dist}_angle-{a}' - the GLCM properties, for each p in props, d in distances and a in angles.

Notes

If the image is not of type numpy.uint8, it will be converted.