measureMRI | R Documentation |
Calculate and demonstrate different measures for classification results based on the truth.
measureMRI(intvec, actual, pre)
intvec |
a vector of intensity values. If it is not |
actual |
matrix of the true classification result. Each row corresponds to one voxel. Column i represents the probabilities that all voxels are allocated to tissue type i. |
pre |
matrix of the predicted classification result. Each row corresponds to one voxel. Column i represents the probabilities that all voxels are allocated to tissue type i. |
mse |
mean square error. |
misclass |
mis-classification rate. |
rseVolume |
root square error of volume with respect to reference tissue volume. |
DSM |
Dice Similary Measure of each tissue type. DSM_{a,b}^{t}=\frac{2 \times N_{a \cap b}^t}{N_a^t+N_b^t} where N_a^t and N_b^t are the number of voxels classified as tissue type t by method a and b respectively, and N_{a \cap b}^t is the number of voxels classified as tissue type t by both methods a and b. The larger the DSM, the more similar the results from the two methods. |
conTable |
confusion table. Each column of the table represents the instances in an actual class, while each row represents the instances in a predicted class. |
#Example 1 prop <- c(.3, .4, .3) mu <- c(-4, 0, 4) sigma <- rep(1, 3) y <- rnormmix(n=1e4, prop, mu, sigma) intvec <- y[,1] actual <- y[,2] pre <- actual pre[sample(1:1e4, 100, replace=FALSE)] <- sample(1:3, 100, replace=TRUE) actual <- do.call(cbind, lapply(1:3, function(i) ifelse(actual==i, 1, 0))) pre <- do.call(cbind, lapply(1:3, function(i) ifelse(pre==i, 1, 0))) measureMRI(intvec, actual, pre) #Example 2 T1 <- readMRI(system.file("extdata/t1.rawb.gz", package="mritc"), c(91,109,91), format="rawb.gz") mask <-readMRI(system.file("extdata/mask.rawb.gz", package="mritc"), c(91,109,91), format="rawb.gz") tc.icm <- mritc(T1, mask, method="ICM") csf <- readMRI(system.file("extdata/csf.rawb.gz", package="mritc"), c(91,109,91), format="rawb.gz") gm <- readMRI(system.file("extdata/gm.rawb.gz", package="mritc"), c(91,109,91), format="rawb.gz") wm <- readMRI(system.file("extdata/wm.rawb.gz", package="mritc"), c(91,109,91), format="rawb.gz") truth <- cbind(csf[mask==1], gm[mask==1], wm[mask==1]) truth <- truth/255 measureMRI(T1[mask==1], truth, tc.icm$prob)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.