catmssim_2d {catsim}R Documentation

Multiscale Categorical Structural Similarity Index Measure (2D)


The categorical structural similarity index measure for 2D categorical or binary images for multiple scales. The default is to compute over 5 scales.


  levels = NULL,
  weights = NULL,
  window = 11,
  method = "Cohen",
  random = "random"


x, y

a binary or categorical image


how many levels of downsampling to use. By default, 5. If weights is specified and this is left blank, the argument will be inferred from the number of weights specified.


a vector of weights for the different scales. By default, equal to rep(1,levels)/levels. If specified, there must at least as many weights as there are levels and the first levels weights will be used.


by default 11 for 2D and 5 for 3D images, but can be specified as a vector if the window sizes differ by dimension. The vector must have the same number of dimensions as the inputted x and y.


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


additional constants can be passed to internal functions.


whether to have deterministic PRNG (pseudo) or to use sample() (random). If NULL, will choose the first mode. For complete reproducibility, use pseudo or NULL.


a value less than 1 indicating the similarity between the images.


x <- matrix(sample(0:3, 128^2, replace = TRUE), nrow = 128)
y <- x
for (i in 1:128) y[i, i] <- 0
for (i in 1:127) y[i, i + 1] <- 0
catmssim_2d(x, y, method = "Cohen", levels = 2) # the default
# now using a different similarity score (Jaccard Index)
catmssim_2d(x, y, method = "NMI")

[Package catsim version 0.2.3 Index]