Learn R Programming

gtexture (version 1.0.0)

cluster_prom: Cluster Prominence Metric for a GLCM

Description

Calculate the cluster prominence feature or metric for a gray-level co-occurrence matrix. For definition and application, see Lofstedt et al. (2019) tools:::Rd_expr_doi("10.1371/journal.pone.0212110").

Usage

cluster_prom(x, ...)

# S3 method for default cluster_prom(x, ...)

# S3 method for matrix cluster_prom(x, ...)

# S3 method for FitLandDF cluster_prom(x, nlevels, ...)

Value

double

Arguments

x

gray-level co-occurrence matrix

...

additional parameters

nlevels

desired number of discrete gray levels

Examples

Run this code
## calculate cluster prominence of arbitrary GLCM
# define arbitrary GLCM
x <- matrix(1:16, nrow = 4)

# normalize
n_x <- normalize_glcm(x)

# calculate cluster prominence
cluster_prom(n_x)

## calculate cluster prominence of arbitrary fitness landscape
# create fitness landscape using FitLandDF object
vals <- runif(64)
vals <- array(vals, dim = rep(4, 3))
my_landscape <- fitscape::FitLandDF(vals)

# calculate cluster prominence of fitness landscape, assuming 2 discrete gray levels
cluster_prom(my_landscape, nlevels = 2)

## confirm value of cluster prominence for fitness landscape
# extract normalized GLCM from fitness landscape
my_glcm <- get_comatrix(my_landscape, discrete = equal_discrete(2))

# calculate cluster prominence of extracted GLCM
cluster_prom(my_glcm)  # should match value of above cluster_prom function call

Run the code above in your browser using DataLab