## load a MRIaggr object
data(MRIaggr.Pat1_red, package = "MRIaggr")
calcThresholdMRIaggr(MRIaggr.Pat1_red, param = c("TTP_t0","MTT_t0"), threshold = 1:10,
name_newparam = c("TTP.th_t0","MTT.th_t0"),
update.object = TRUE, overwrite = TRUE)
## display raw parameter
multiplot(MRIaggr.Pat1_red, param = "TTP.th_t0", num = 3, numeric2logical = TRUE,
index1 = list(coords = "MASK_DWI_t0", outline = TRUE))
## extract raw parameter, coordinates and compute the neighbourhood matrix
carto <- selectContrast(MRIaggr.Pat1_red, num = 3, hemisphere = "lesion",
param = c("TTP.th_t0","TTP_t0","MASK_DWI_t0"))
coords <- selectCoords(MRIaggr.Pat1_red, num = 3, hemisphere = "lesion")
W <- calcW(coords, range = sqrt(2))$W
## the seed is taken to be the point with the largest TTP in the lesion mask
indexN <- which(carto$MASK_DWI_t0 == 1)
seed <- indexN[which.max(carto[indexN,"TTP_t0"])]
## Display step by step the GR algorithm with sigma = 1
for(iter in c(0,1,2,5,10)){
resGR1 <- calcGR(contrast = carto$TTP.th_t0, W = W,
seed = seed, sigma_max = 1, iter_max = iter, verbose = FALSE)
multiplot(MRIaggr.Pat1_red, param = "TTP.th_t0", num = 3,hemisphere = "lesion", legend = FALSE,
breaks = seq(0,10,0.1), numeric2logical = TRUE, cex = 2,
main = paste("iteration=",iter," - slice ", sep = ""),
index1 = list(coords = coords[resGR1$GR,], pch = 20, cex = 1),
index2 = list(coords = coords[seed,], pch = 20, cex = 1)
)
}
## Not run:
# ## GR with sigma = 2.2
# resGR2 <- calcGR(contrast = carto$TTP.th_t0, W = W,
# seed = seed, sigma_max = 2.2, iter_max = 50,
# history.step = TRUE, history.front = TRUE)
#
# ## display
# # display the GR over the raw contrast
# multiplot(MRIaggr.Pat1_red, param = "TTP.th_t0", num = 3, hemisphere = "lesion", legend = FALSE,
# breaks = seq(0,10,0.1), numeric2logical = TRUE, cex = 2,
# index1 = list(coords = coords[resGR2$GR,], pch = 20, cex = 1)
# )
#
# # display the step of inclusion in GR group for each observation
# multiplot(coords[resGR2$GR,],
# resGR2$history.step,breaks = 0:10,
# index1=list(coords = coords[seed,]),
# palette = rainbow(10)
# )
#
# # display the front propagation
# multiplot(coords[resGR2$GR,],
# resGR2$Mfront[,7],
# index1 = list(coords = coords[seed,])
# )
# ## End(Not run)
Run the code above in your browser using DataLab