Learn R Programming

MRIaggr (version 1.1.5)

outlineMRIaggr: Outline a region on a slice

Description

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

Usage

"outlineMRIaggr"(object, param, index1 = NULL, num = NULL, hemisphere = "both", numeric2logical = FALSE, xlim = NULL, ylim = NULL, legend = FALSE, palette = "terrain.colors", col = NULL, breaks = 25, fill = TRUE, n = 50, sequential = TRUE, min_dist = 1, operator_index1 = "none", col.outline = c("blue","red","grey"), pch = 20, cex = c(0.75,1,0.75), name_newparam = "userMask", verbose = optionsMRIaggr("verbose"), update.object = FALSE, overwrite = FALSE)

Arguments

object
an object of class MRIaggr. REQUIRED.
param
the contrast parameter map on which the outline will be drawn. character. REQUIRED.
index1
the coordinates of additionnal points to display. data.frame or list or NULL.
num
the slices on which the outline will be drawn. numeric vector or NULL.
hemisphere
the hemisphere to consider. character.
numeric2logical
if a parameter is specified for the index argument, should it be converted to logical ? logical.
xlim
the y limits of the plot. numeric vector of size 2 or NULL leading to automatic setting of the x limits.
ylim
the y limits of the plot. numeric vector of size 2 or NULL leading to automatic setting of the y limits.
legend
how should the legend be displayed ? logical or NULL.
palette
the colors or the palette to use when associating colors to observation intensities. character vector or character.
col
the color to use to plot the observations. character vector or NULL leading to automatic generation of the colors using the breaks and palette arguments.
breaks
the break points or the number of breakpoints to use to generate the color intervals . numeric vector or postive integer.
fill
should the spatial region be filled ? Otherwise only the edge is used. logical.
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.
operator_index1
the operator to apply between the index1 observations and the outlined observations. Can be "none" "intersection" "difference" or "union".
col.outline
the colors in which the user-defined edge points, the interpolated edge points and the interior points should be ploted. character vector[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.
verbose
should the execution of the function be traced ? logical.
name_newparam
the name of the new parameter. character.
update.object
should the new parameter be stored in object ? logical.
overwrite
if a contrast parameter with the same names is already stored in object@data, can it be overwritten ? logical.

Value

A matrix containing in columns :
  • [,c("i","j","k")] : the coordinates of the observations.
  • [,"index"] : the index of the observation in object.
  • [,"edge"] : whether each observation is on an edge.
  • [,"surface"] : whether each observation is in the interior.
  • [,"userMask"] : whether each observation belong to index1 (if no not defined, always FALSE).

Details

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

Information about the index1 argument can be found in the details section of initIndex (argument index).

Information about the hemisphere argument can be found in the details section of selectContrast.

Information about the palette and legend arguments can be found in the details section of initCol.

FUNCTION: This function uses the locator function to obtain the coordinates of the cursor. See outline for more details. It will display slice by slice the parameter map and on each slice a region should be drawn. Press Echap and 1 to restart the draw on the same slice. Press Echap and 0 to skip a slice.

Examples

Run this code
## Not run:  
# ## load a MRIaggr object
# data("MRIaggr.Pat1_red", package = "MRIaggr")
# 
# ## outline the area of interest
# res <- outlineMRIaggr(MRIaggr.Pat1_red, param = "DWI_t0",
#              num = 1:3, sequential = TRUE, overwrite = TRUE, update.object = TRUE)
# 
# multiplot(MRIaggr.Pat1_red, param = "userMask",              
#              num = 1:3)
# 
# 
# ## outline an edge of interest 
# res <- outlineMRIaggr(MRIaggr.Pat1_red, param = "DWI_t0", index1 = "MASK_DWI_t0",
#             fill = FALSE, num = 1:3, sequential = TRUE, overwrite = TRUE, update.object = TRUE)
# 
# multiplot(MRIaggr.Pat1_red, param = "userMask", num = 1:3)
# 
# ## define an new area as the union of the outlined area and the initial lesion mask
# res <- outlineMRIaggr(MRIaggr.Pat1_red, param = "DWI_t0", index1 = "MASK_DWI_t0",
#             operator_index1 = "union", num = 3, sequential = TRUE, 
# 			overwrite = TRUE, update.object = TRUE)
# 
# multiplot(MRIaggr.Pat1_red, param = "userMask", num = 3)
# 
# ## define an new area as the intersection of the outlined area and the initial lesion mask
# res <- outlineMRIaggr(MRIaggr.Pat1_red, param = "DWI_t0", index1 = "MASK_DWI_t0",
#             operator_index1 = "intersection", num = 3, sequential = TRUE, 
# 			overwrite = TRUE, update.object = TRUE)
# 
# multiplot(MRIaggr.Pat1_red, param = "userMask", num = 3)
# 
# ## define an new area as the difference between the outlined area and the initial lesion mask
# res <- outlineMRIaggr(MRIaggr.Pat1_red, param = "DWI_t0", index1 = "MASK_DWI_t0",
#             operator_index1 = "difference", num = 3, sequential = TRUE,
# 			overwrite = TRUE, update.object = TRUE)
# 
# multiplot(MRIaggr.Pat1_red, param = "userMask", num=3)
# ## End(Not run)

Run the code above in your browser using DataLab