MRIaggr-calcDistMask: Euclidean distance to a spatial group

Description Usage Arguments Details Value Examples

Description

Compute the euclidean distance to a spatial group.

Usage

1
2
3
4
## S4 method for signature 'MRIaggr'
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.

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.

Value

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

Examples

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

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