The categorical structural similarity index measure for 2D or 3D categorical or
binary images for multiple scales. The default is to compute over 5 scales.
This determines whether this is a 2D or 3D image and applies the appropriate
windowing, weighting, and scaling. Additional arguments can be passed.
This is a wrapper function for the 2D and 3D functions whose functionality
can be accessed through the ... arguments. This function is a wrapper for the
catmssim_2d()
, catmssim_3d_slice()
, and
catmssim_3d_cube()
functions.
catsim( x, y, ..., cube = TRUE, levels = NULL, weights = NULL, method = "Cohen", window = NULL )
x, y | a binary or categorical image |
---|---|
... | additional arguments, such as window, can be passed as well as arguments for internal functions. |
cube | for the 3D method, whether to use the true 3D method
(cube or |
levels | how many levels of downsampling to use. By default, 5. If
|
weights | a vector of weights for the different scales. By default,
equal to |
method | whether to use Cohen's kappa ( |
window | 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 |
a value less than 1 indicating the similarity between the images.
set.seed(20181207) dim <- 16 x <- array(sample(0:4, dim^3, replace = TRUE), dim = c(dim, dim, dim)) y <- x for (j in 1:dim) { for (i in 1:dim) y[i, i, j] <- 0 for (i in 1:(dim - 1)) y[i, i + 1, j] <- 0 } catsim(x, y, weights = c(.75, .25))#> [1] 0.791647# Now using a different similarity score catsim(x, y, levels = 2, method = "accuracy")#> [1] 0.7449315#> [1] 0.7858388