Description Usage Arguments Details Value Examples
Tool for graphical definition of a spatial region on an image.
1 2 |
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 |
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. |
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.
A list of two elements :
[[edge]]
: a data.frame containing the position ("i"
"j"
) of the edge of the region, the edge number ("edge"
), whether its user-specified point or interpolated point ("points"
) and whether it was removed for the filling precedure ("valid"
).
[[surface]]
: a data.frame containing the position ("i"
"j"
) of the points belonging to the region.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.