MRIaggr-calcGroupsCoords: Compute spatial groups

Description Usage Arguments Details Value See Also Examples

Description

Compute the spatial groups using the coordinates of the observations.

Usage

1
2
calcGroupsCoords(coords, array = NULL, Neighborhood, max_groups = 10000, 
         verbose = optionsMRIaggr("verbose"))

Arguments

coords

the spatial coordinates of the observations. data.frame. REQUIRED.

array

alternative specification of the spatial coordinates using an array where the non-NA values indicates the points of interest. array or NULL leading to consider the coords argument.

Neighborhood

the type of neighbourhood. character.

max_groups

the maximum number of groups. postive integer.

verbose

should the execution of the function be traced ? logical.

Details

ARGUMENTS:
the Neighborhood argument can be a matrix or an array defining directly the neighbourhood to use (i.e the weight of each neighbor) or a name indicating which type of neighbourhood should be used (see the details section of initNeighborhood).

Value

An list containing :

See Also

initFilter for various pre-stored filters.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## 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 <- dt2array(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

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