Learn R Programming

MRIaggr (version 1.1.5)

calcGroupsMask: Compute spatial groups

Description

Compute the spatial groups defined by a binary parameter.

Usage

"calcGroupsMask"(object, mask, numeric2logical = FALSE, W = "ifany", W.range, W.spatial_res = c(1,1,1), verbose = optionsMRIaggr("verbose"), update.object = FALSE, overwrite = TRUE)

Arguments

object
an object of class MRIaggr. REQUIRED.
mask
the binary contrast parameter that should be used to identifying the spatial groups. character. REQUIRED.
numeric2logical
should mask be convert to logical ? logical.
W
the neighbourhood matrix. dgCMatrix or "ifany" leading to use the neighbourhood matrix stored in the object if any and else computate this matrix.
W.range
the neighbourhood range. postive numeric. REQUIRED.
W.spatial_res
a dilatation factor for the coordinates. positive numeric vector of size 3.
verbose
should the execution of the function be traced ? logical.
update.object
should the resulting spatial groups be stored in object ? logical.
overwrite
if spatial groups are already stored in object@ls_descStats, can they be overwritten ? logical.

Value

An list containing for each parameter:
  • [[group]] : a vector containing the group index for each observation.
  • [[group_size]] : a vector with the size of each spatial group.
  • [[group_number]] : the number of spatial groups. integer vector.
  • [[group_max]] : the index of the largest group. integer vector.

Details

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

FUNCTION: Call the calcGroupsW function.

See Also

selectDescStats to select the spatial groups. calcW to compute the neighbourhood matrix.

Examples

Run this code
## load a MRIaggr object
data("MRIaggr.Pat1_red", package = "MRIaggr")

## compute spatial groups
calcGroupsMask(MRIaggr.Pat1_red, mask = c("MASK_DWI_t0","MASK_T2_FLAIR_t2"),
               W.range = 6, W.spatial_res = c(1.875,1.875,6),
               update.object = TRUE, overwrite = TRUE)

## extract spatial groups
selectDescStats(MRIaggr.Pat1_red, "GroupsLesion")

Run the code above in your browser using DataLab