MRIaggr-outline: Outline a region on a slice

Description Usage Arguments Details Value Examples

Description

Tool for graphical definition of a spatial region on an image.

Usage

1
2
outline(n=50,sequential = TRUE, min_dist = 1,
         col = c("blue","red","grey"), pch = 20, cex = c(0.75,1,0.75))

Arguments

n

maximum number of points to define the outline. integer.

sequential

should the region edge be updated on the graphical device after each point ? logical.

min_dist

if the distance between the new point and the initial point is inferior to min_dist, then the definition of the region ends. numeric. Only active if sequential is TRUE.

col

the colors in which the user-defined edge points, the interpolated edge points and the interior points should be ploted. character vector of size 3.

pch

the symbol with which the observations will be displayed. positive integer.

cex

the expansion factor used to plot the edge points, the interpolated edge points and the interior points. positive numeric vector of size 3.

Details

FUNCTION:
This function uses the locator function to obtain the coordinates of the cursor. It enable a point by point definition of a region where a linear interpolation is used between user-defined points to define the edge of the region.
In the non sequential mode, the definition of the points stop if the number of points exceed n or using Echap. In the sequential mode, the definition of the points stop if the number of points exceed n or if the new point is close enough to the initial point.

After defining the edge, the region is filled.

Value

A list of two elements :

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
29
30
31
32
33
## Not run:  
## load a MRIaggr object
data("MRIaggr.Pat1_red", package = "MRIaggr")
num <- 3

## display 1
multiplot(MRIaggr.Pat1_red, param = "T2_FLAIR_t2",              
             num = num, legend = FALSE, window = FALSE)

## outline on display 1
res <- outline(sequential=TRUE,min_dist=3)

## display the results
multiplot(MRIaggr.Pat1_red, param = "T2_FLAIR_t2",              
             num = num, legend = FALSE,
             index1 = data.frame(k = num, res$edge[,c("i","j")]),
             index2 = data.frame(k = num, res$surface[,c("i","j")]),
             window = FALSE)

carto <- selectContrast(MRIaggr.Pat1_red, param = c("MASK_T2_FLAIR_t2","index"),
             num = num, coords = TRUE)
carto <- merge(carto, cbind(res$surface, outline = TRUE), all = TRUE)
carto[is.na(carto$outline),"outline"] <- FALSE
head(carto)

## display the results next to MASK_T2_FLAIR_t2
multiplot(MRIaggr.Pat1_red, param = "T2_FLAIR_t2",              
             num = num, legend = FALSE,
             index1 = carto[carto$MASK_T2_FLAIR_t2,c("i","j","k")],
             index2 = carto[carto$outline,c("i","j","k")],
             window = FALSE)

## End(Not run)

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