Learn R Programming

MRIaggr (version 1.1.5)

calcDistMask: Euclidean distance to a spatial group

Description

Compute the euclidean distance to a spatial group.

Usage

"calcDistMask"(object, mask, name_newparam = paste("dist", mask, sep = "_"), spatial_res = c(1,1,1), numeric2logical = FALSE, Neighborhood = "3D_N10", verbose = optionsMRIaggr("verbose"), update.object = FALSE, overwrite = FALSE)

Arguments

object
an object of class MRIaggr. REQUIRED.
mask
the binary contrast parameter(s) defining the spatial groups from which the distance will be computed. character vector. REQUIRED.
name_newparam
the name of the new distance parameters. character vector.
spatial_res
a dilatation factor for the coordinates. positive numeric vector of size 3.
numeric2logical
should mask be convert to logical ? logical.
Neighborhood
the type of neighbourhood. character.
verbose
should the execution of the function be traced ? logical.
update.object
should the resulting distance parameters be stored in object ? logical.
overwrite
if contrast parameters with the same names are already stored in object@data, can they be overwritten ? logical.

Value

An data.frame containing in row the observations and in columns the distance parameters.

Details

This function requires to have installed the RANN package to work.

ARGUMENTS: Information about the num argument can be found in the details section of initNum.

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).

FUNCTION: This function relies on the nn2 function of the RANN package.

Examples

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

## compute distance to initial and final mask
res <- calcDistMask(MRIaggr.Pat1_red, mask = c("MASK_DWI_t0","MASK_T2_FLAIR_t2"),
             update.object = TRUE, overwrite = TRUE)

multiplot(MRIaggr.Pat1_red, param = "dist_MASK_DWI_t0",
          index1 = list(coords = "MASK_DWI_t0", outline = TRUE))

## compute distance to initial and final mask correcting anisotropy
res <- calcDistMask(MRIaggr.Pat1_red, mask = c("MASK_DWI_t0","MASK_T2_FLAIR_t2"),
                    spatial_res = c(1.875,1.875,6),
                    update.object = TRUE, overwrite = TRUE)

multiplot(MRIaggr.Pat1_red, param = "dist_MASK_DWI_t0",
          index1 = list(coords = "MASK_DWI_t0", outline = TRUE))

Run the code above in your browser using DataLab