MRIaggr-calcGroupsW: Compute spatial groups

Description Usage Arguments Details Value Examples

Description

Compute the spatial groups using a neighbourhood matrix.

Usage

1
2
calcGroupsW(W, subset = NULL, max_groups = 10000, 
         verbose = optionsMRIaggr("verbose"))

Arguments

W

the neighbourhood matrix. dgCMatrix. REQUIRED.

subset

the subset of observations to use. positive integer vector or NULL leading to use all observations.

max_groups

the maximum number of groups. postive integer.

verbose

should the execution of the function be traced ? logical.

Details

This function requires to have installed the Matrix and the spam package to work.

Value

An list containing :

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
## 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])

bozenne/MRIaggr documentation built on May 13, 2019, 1:39 a.m.