Description Usage Arguments Details Value See Also Examples
Perform a spatial regularization of a binary mask.
1 2 3 4 5 6 7 | ## S4 method for signature 'MRIaggr'
calcSmoothMask(object, mask = "mask", numeric2logical = FALSE,
size_2Dgroup = 50, Neighborhood_2D = "3D_N8", rm.2Dhole = FALSE,
size_3Dgroup = "unique", Neighborhood_3D = "3D_N10", rm.3Dhole = TRUE,
erosion.th = 0.75, Vmask_min = 0.25, Vbackground_max = 0.75,
Neighborhood_V = "3D_N10", verbose = optionsMRIaggr("verbose"),
update.object = FALSE, overwrite = FALSE)
|
object |
an object of class |
mask |
the binary contrast parameter that should be smoothed. character. |
numeric2logical |
should |
size_2Dgroup |
the minimum size of the 2D groups. positive integer or |
Neighborhood_2D |
the type of 2D neighbourhood. character. |
rm.2Dhole |
should the 2D wholes inside the mask be removed ? logical. |
size_3Dgroup |
the minimum size of the 3D groups. positive integer or |
Neighborhood_3D |
the type of 3D neighbourhood. character. |
rm.3Dhole |
should the 3D wholes inside the mask be removed ? logical. |
erosion.th |
the threshold below which the observations will be removed by the erosion. numeric between 0 and 1. |
Vmask_min |
mask observations with a proportion of neighbors belonging to the mask lower than |
Vbackground_max |
background observations with a proportion of neighbors belonging to the mask higher than |
Neighborhood_V |
the type of neighbourhood to use for the spatial regularization. character. |
verbose |
should the execution of the function be traced ? logical. |
update.object |
should the resulting regularized mask be stored in |
overwrite |
if a mask is already stored in |
ARGUMENTS:
the Neighborhood_2D
or Neighborhood_3D
arguments 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 applies 6 smoothing steps :
exclusion of the small 2D groups from the mask (to skip set size_2Dgroup
to FALSE
). Note that size_2Dgroup = "unique"
lead to keep the largest 2D group of each slice.
filling of the small 2D holes in the mask (to skip set rm.2Dhole
to FALSE
).
exclusion of the small 3D groups from the mask (to skip set size_3Dgroup
to FALSE
). Note that size_3Dgroup = "unique"
lead to keep only the largest 3D group.
erosion that first temporarily remove observations from the mask that have less than erosion.th
percent of their neighbourhood in the mask.
Then it computes the new 3D groups and remove permanently all the new 3D groups from the mask. To skip set erosion.th
to FALSE
.
filling of the small 3D holes in the mask (to skip set rm.3Dhole
to FALSE
).
spatial regularization that homogenize the local neighbourhood (to skip set both Vmask_min
and Vbackground_max
to FALSE
).
An data.frame containing the mask and the coordinates in columns.
selectContrast
to select the smoothed mask.
calcBrainMask
to compute an indicator of the brain observations.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | ## load data and build MRIaggr
path.Pat1 <- system.file(file.path("nifti"), package = "MRIaggr")
ls.array <- list(readMRI(file.path(path.Pat1,"T2_GRE_t0"), format = "nifti"))
MRIaggr.Pat1 <- constMRIaggr(ls.array,identifier="Pat1", param = "T2_GRE_t0")
## create the cerebral mask
res <- calcBrainMask(MRIaggr.Pat1, param = "T2_GRE_t0", type = "kmeans",
kmeans.n_groups = 2:4,
update.object = TRUE, overwrite = TRUE)
## smooth the cerebral mask
res <- calcSmoothMask(MRIaggr.Pat1, update.object = TRUE, overwrite = TRUE)
## display
multiplot(MRIaggr.Pat1,param = "mask", legend = FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.