## load a MRIaggr object
data("MRIaggr.Pat1_red", package = "MRIaggr")
## select data
MASK_DWI_t0 <- selectContrast(MRIaggr.Pat1_red, param = "MASK_DWI_t0")
coords <- selectCoords(MRIaggr.Pat1_red)
## select compute W
W <- calcW(object = as.data.frame(coords[MASK_DWI_t0 == 1,]),
range = sqrt(2), row.norm = TRUE)$W
## find spatial groups
res.Groups <- calcGroupsW(W)
res.Groups$group_size
## display
multiplot(coords[MASK_DWI_t0 == 1,], contrast = res.Groups$group,
legend = FALSE, cex=0.5,
palette=rainbow(10)[-1])
Run the code above in your browser using DataLab