Learn R Programming

MRIaggr (version 1.1.3)

constReduceMRIaggr: Reduce a MRIaggr

Description

Construct a MRIaggr object restricted to a subset of observations.

Usage

## S3 method for class 'MRIaggr':
constReduceMRIaggr(object, mask, numeric2logical = FALSE, keep.index = TRUE)

Arguments

object
an object of class MRIaggr. REQUIRED.
mask
the binary contrast parameter or a vector indicating the observations to be kept. character or logical vector with length equal to the number of observations in object. REQUIRED.
numeric2logical
should mask be converted to logical ? logical.
keep.index
should the previous index parameter be saved in the ls_descStats slot ? logical.

Value

  • a MRIaggr object.

concept

const.

See Also

calcBrainMask to compute an indicator of the brain observations.

Examples

Run this code
## load NIFTI files and convert them to 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 = "threshold",
                     th.select_optima = 2, update.object = TRUE, overwrite = TRUE)
res <- calcBrainMask(MRIaggr.Pat1, param = "T2_GRE_t0", type = "kmeans",
                     kmeans.n_groups = 2:4,
                     update.object = TRUE, overwrite = TRUE)

res <- calcSmoothMask(MRIaggr.Pat1, update.object = TRUE, overwrite = TRUE)
## display
multiplot(MRIaggr.Pat1, param = "mask", legend = FALSE)					  

## construct the reduced object
MRIaggr.Pat1_red <- constReduceMRIaggr(MRIaggr.Pat1, mask = "mask")

## display
par(mfrow = c(2,4), mar = rep(1.75, 4), mgp = c(2,0.75,0))
multiplot(MRIaggr.Pat1, param = "T2_GRE_t0",
             window = NULL,breaks = seq(0, 300, 1), legend = FALSE)
multiplot(MRIaggr.Pat1_red, param = "T2_GRE_t0",
             window = NULL, breaks = seq(0, 300, 1), legend = FALSE)

Run the code above in your browser using DataLab