ImageContainer.features_texture

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 in img that should be processed. If None and only 1 layer is present, it will be selected.

library_id str | None (default: None)

Name of the Z-dimension that this function should be applied to.

feature_name str (default: 'texture')

Base name of feature in resulting feature values dict.

channels int | Sequence[int] | None (default: None)

Channels for this feature is computed. If None, use all channels.

props Sequence[str] (default: ('contrast', 'dissimilarity', 'homogeneity', 'correlation', 'ASM'))

Texture features that are calculated, see the prop argument in skimage.feature.graycoprops().

distances Sequence[int] (default: (1,))

The distances argument in skimage.feature.graycomatrix().

angles Sequence[float] (default: (0, 0.7853981633974483, 1.5707963267948966, 2.356194490192345))

The angles argument in skimage.feature.graycomatrix().

Returns:

dict[str, Any] – 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.