## load a MRIaggr object
data("MRIaggr.Pat1_red", package = "MRIaggr")
optionsMRIaggr(outline.index = TRUE, num.main = FALSE)
## select data
MASK_DWI_t0 <- selectContrast(MRIaggr.Pat1_red, param = "MASK_DWI_t0")
coords <- selectCoords(MRIaggr.Pat1_red)
#### 1- compute spatial groups using coordinates ####
res3DN18 <- calcGroupsCoords(coords = coords[MASK_DWI_t0 == 1,], Neighborhood = "3D_N18")
res3DN18$group_size
## display the lesion spatial groups
multiplot(coords, contrast=MASK_DWI_t0, legend = FALSE, num=2,
index1=coords[MASK_DWI_t0 == 1,][res3DN18$ls.group[[1]],])
#### 2-compute spatial groups using an array ####
A.MASK_DWI_t0 <- df2array(MASK_DWI_t0,coords = coords)$contrast[[1]]
A.MASK_DWI_t0[A.MASK_DWI_t0 == FALSE] <- NA
## display
graphics::image(A.MASK_DWI_t0[,,3])
## computation of the spatial groups
res3DN18.bis <- calcGroupsCoords(array = A.MASK_DWI_t0, Neighborhood = "3D_N18")
res3DN18$group_size - res3DN18.bis$group_size # same result
Run the code above in your browser using DataLab