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:
layer (
str) – Image layer inimgthat should be processed. If None and only 1 layer is present, it will be selected.library_id (
str|None) – Name of the Z-dimension that this function should be applied to.feature_name (
str) – Base name of feature in resulting feature valuesdict.channels (
int|Sequence[int] |None) – Channels for this feature is computed. If None, use all channels.props (
Sequence[str]) – Texture features that are calculated, see the prop argument inskimage.feature.graycoprops().distances (
Sequence[int]) – The distances argument inskimage.feature.graycomatrix().angles (
Sequence[float]) – The angles argument inskimage.feature.graycomatrix().
- Return type:
- 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 inprops, d indistancesand a inangles.
Notes
If the image is not of type
numpy.uint8, it will be converted.