This computes the categorical or binary structural similarity index metric on a whole-image scale. The difference between this and the default 2-D method is that this considers the whole image at once and one scale rather than computing the index over a sliding window and downsampling to consider it at other scales.

binssim(
  x,
  y,
  alpha = 1,
  beta = 1,
  gamma = 1,
  c1 = 0.01,
  c2 = 0.01,
  method = "Cohen",
  ...
)

Arguments

x, y

binary or categorical image

alpha

normalizing parameter, by default 1

beta

normalizing parameter, by default 1

gamma

normalizing parameter, by default 1

c1

small normalization constant for the c function, by default 0.01

c2

small normalization constant for the s function, by default 0.01

method

whether to use Cohen's kappa (Cohen), Jaccard Index (Jaccard), Dice index (Dice), accuracy (accuracy), Rand index (Rand), Adjusted Rand Index (AdjRand or ARI), or normalized mutual information (NMI or MI) as the similarity index. Note Jaccard and Dice should only be used on binary data.

...

Constants can be passed to the components of the index.

Value

Structural similarity index.

Examples

set.seed(20181207)
x <- matrix(sample(1:4, 10000, replace = TRUE), nrow = 100)
y <- x
for (i in 1:100) y[i, i] <- 1
for (i in 1:99) y[i, i + 1] <- 1
binssim(x, y)
#> [1] 0.9806734