## 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
## Not run:
# 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)
# ## End(Not run)
## 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