labelmoments: Label Image Moments

labelmoments-methodsR Documentation

Label Image Moments

Description

Returns the list with the data frame Mij containing the cluster levels l, the numbers of pixels n and the cluster moments \bm{M} = (M_{\mathrm{10}}, M_{\mathrm{01}}, M_{\mathrm{11}})^{\top} for 2D images or the data frame Mijk containing the cluster levels l, the numbers of voxels n and the cluster moments \bm{M} = (M_{\mathrm{100}}, M_{\mathrm{010}}, M_{\mathrm{001}}, M_{\mathrm{111}})^{\top} for 3D images and the adjacency matrix A of size c_{\mathrm{max}} \times c_{\mathrm{max}}. It may have some NA rows and columns. To calculate the adjacency matrix A(i,j) = \exp{(-\|\bm{M}_{i} - \bm{M}_{j}\|^2 / 2 \sigma^2)}, the raw cluster moments are first converted into z-scores.

Usage

## S4 method for signature 'array'
labelmoments(Zp = array(), cmax = integer(), Sigma = 1.0, ...)
## ... and for other signatures

Arguments

Zp

a 2D array of size width \times height or a 3D array of size width \times height \times depth containing the predictive cluster membership \bm{\Omega}_{l}, where l \in \{ 0, 1, \ldots, c\}. The cluster l = 0 may contain the pixels for 2D images or the voxels for 3D images, which are ignored by this method.

cmax

maximum number of clusters c_{\mathrm{max}} \geq c.

Sigma

scale parameter \sigma for the Gaussian kernel function \exp{(-\|\bm{M}_{i} - \bm{M}_{j}\|^2 / 2 \sigma^2)}. The default value is 1.0.

...

currently not used.

Methods

signature(Zp = "array")

an array.

Author(s)

Marko Nagode, Branislav Panic

References

A. Ng, M. Jordan and Y. Weiss. On spectral clustering: Analysis and an algorithm. Advances in Neural Information Processing Systems 14 (NIPS 2001).

Examples

Zp <- matrix(rep(0, 100), nrow = 10, ncol = 10)

Zp[2, 2:4] <- 1; 
Zp[2:4, 5] <- 2; 
Zp[8, 7:10] <- 3; 
Zp[9, 6] <- 4; Zp[10, 5] <- 4
Zp[10, 1:4] <- 5
Zp[6:9, 1] <- 6

labelmoments <- labelmoments(Zp, cmax = 6, Sigma = 1.0)

set.seed(12)

mergelabels <- mergelabels(list(labelmoments$A), w = 1.0, k = 2, nstart = 3)

Zp

mergelabels

rebmix documentation built on Feb. 9, 2024, 3:01 p.m.