#Example 1
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")
y <- T1[mask==1]
initial <- initOtsu(y, 2)
prop <- initial$prop
mu <- initial$mu
sigma <- initial$sigma
tc.em <- mritc.em(y, prop, mu, sigma, verbose=TRUE)
# \donttest{
mrispatial <- makeMRIspatial(mask, nnei=6, sub=FALSE)
tc.icm <- mritc.icm(y, mrispatial$neighbors, mrispatial$blocks,
mu=mu, sigma=sigma, verbose=TRUE)
tc.hmrfem <- mritc.hmrfem(y, mrispatial$neighbors, mrispatial$blocks,
mu=mu, sigma=sigma, verbose=TRUE)
tc.pvhmrfem <- mritc.pvhmrfem(y, mrispatial$neighbors, mrispatial$blocks,
mu=mu, sigma=sigma, verbose=TRUE)
tc.mcmc <- mritc.bayes(y, mrispatial$neighbors, mrispatial$blocks,
mrispatial$sub, mrispatial$subvox,
mu=mu, sigma=sigma, verbose=TRUE)
mrispatial <- makeMRIspatial(mask, nnei=6, sub=TRUE)
tc.mcmcsub <- mritc.bayes(y, mrispatial$neighbors, mrispatial$blocks,
mrispatial$sub, mrispatial$subvox,
mu=mu, sigma=sigma, verbose=TRUE)
mrispatial26 <- makeMRIspatial(mask, nnei=26, sub=TRUE, bias=TRUE)
tc.mcmcsubbias <- mritc.bayes(y, mrispatial$neighbors, mrispatial$blocks,
mrispatial$sub, mrispatial$subvox,
subbias=TRUE, mrispatial26$neighbors,
mrispatial26$blocks,mrispatial26$weineighbors,
mrispatial26$weights, mu=mu, sigma=sigma, verbose=TRUE)
# }
#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")
Run the code above in your browser using DataLab