Learn R Programming

MRIaggr (version 1.1.5)

calcHemisphere: Find the mid-sagittal plan

Description

Find a plane that distinguish the two cerebral hemispheres.

Usage

"calcHemisphere"(object, param, num = NULL, p = 1, subset = NULL, penalty = "symmetry", mask = NULL, numeric2logical = FALSE, n.points = 100, gridSearch = TRUE, i_test = seq(-20, 20, by = 5), angle.test = seq(-30, 30, by = 5), unit_angle = "degree", NelderMead = TRUE, maxit = 100, reltol = 0.001, plot = TRUE, filename = paste(object@identifier, "_calcHemisphere", sep = ""), update.object = FALSE, overwrite = FALSE, ...)

Arguments

object
an object of class MRIaggr. REQUIRED.
param
the contrast parameter that should be used to distinguish the two hemispheres. character. REQUIRED.
num
the slices to use. numeric vector or NULL.
p
the type of distance for the penalization. positive numeric.
subset
the subset of observations to use. positive integer vector or NULL leading to use all observations.
penalty
the type of objective function. Can be "symmetry" or "asymmetry".
mask
the binary contrast parameter(s) indicating the lesion. character vector or NULL if no mask is available.
numeric2logical
should mask be convert to logical ? logical.
gridSearch
Should grid search be used to find the mid-sagittal plane ? logical.
i_test
the abscissa or the number of abscissa to test. numeric vector or positive integer.
angle.test
the angle or the number of angle to test. numeric vector or postive integer.
unit_angle
the unit in which the angle is given. Can be "radian" or "degree".
n.points
the number of points that represent the mid-sagittal plan to computed. positive integer.
NelderMead
Should the center of the grid search be searched using Nelder-Mead algorithm or set to the center of the image ? logical.
maxit
The maximum number of iterations. postive integer. See the details section of optim.
reltol
Relative convergence tolerance. positive numeric. See the details section of optim.
plot
should the results be plotted ? logical.
filename
the name of the file used to export the plot. character.
update.object
should the resulting midplane be stored in object ? logical.
overwrite
if a midplane is already stored in object@midplane, can it be overwritten ? logical.
...
additional arguments to be passed to optionsMRIaggr for specifying the graphical parameters.

Value

An list containing :
  • [[penalty]] : an array containing the objective function for the various configurations.
  • [[nb]] : an array containing the number of observations used to compute the penalty function for the various configurations.
  • [[moy]] : an array containing the mean value of the objective function for the various configurations.
  • [[optimum]] : the parameters of the optimal midplane. numeric vector
  • [[midplane]] : the position of the midplane points. matrix.
  • [[data]] : the position of the observations with respect to the mid-sagittal plane. matrix.
  • [[cv]] : Was the optimum reached inside the parameter space and not at a border ? logical.

Details

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

Setting p to 1 leads to use the absolute difference ; setting p to 2 leads to use the euclidean distance.

Arguments ... must correspond to some of the following arguments : height, numeric2logical, path, res, unit, verbose, width, window.

FUNCTION: This function seeks the plane that minimize the difference between contralateral values of the two hemispheres or maximize the similarity between the two hemispheres. There are 2 degree of freedom : one for the position of the center and one for the angle. The separation between the hemisphere is assumed to be identical for all slices. From our experience, using an objective function based on symmetry gives better results compared to asymmetry.

See Also

selectParameter to select the midplane.

Examples

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



## Not run: 
# res <- calcHemisphere(MRIaggr.Pat1_red, param = "T2_GRE_t0",
#                       verbose = TRUE, update.object = TRUE, overwrite = TRUE)
# 
# ## display the mid-sagittal plan
# multiplot(MRIaggr.Pat1_red, param = "T2_GRE_t0", num = 3, legend = FALSE,
#              midplane = TRUE, main = "original coordinates - slice ")
# 
# ## display with the new coordinates
# multiplot(selectContrast(MRIaggr.Pat1_red, param = c("i_hemisphere","j_hemisphere","k")),
#           contrast=selectContrast(MRIaggr.Pat1_red, param = "T2_GRE_t0"), num = 3,
#           index1=cbind(0, seq(-50,50), 3), main = "new coordinates - slice ", legend = FALSE)
# 
# ## compute the mid-sagittal plan and mark lesion and healthy hemispheres
# res <- calcHemisphere(MRIaggr.Pat1_red, param = "T2_GRE_t0",
#          mask = c("MASK_DWI_t0","MASK_T2_FLAIR_t2"), numeric2logical = TRUE,
#          verbose = TRUE, update.object = TRUE, overwrite = TRUE)
# ## End(Not run)

Run the code above in your browser using DataLab