## load a NIFTI file (array format)
path.Pat1 <- system.file(file.path("nifti"), package = "MRIaggr")
nifti.Pat1_TTP_t0 <- readMRI(file.path(path.Pat1, "TTP_t0"), format = "nifti")
dim(nifti.Pat1_TTP_t0)
## conversion to data frame format
res128 <- array2df(array = nifti.Pat1_TTP_t0, name_newparam = "TTP_t0")
dim(res128)
head(res128)
## conversion to data frame format with specific coordinates
res256 <- array2df(array = nifti.Pat1_TTP_t0, name_newparam = "TTP_t0",
coords = expand.grid(129:206, 129:228, 1:3, 1))
dim(res256)
head(res256)
Run the code above in your browser using DataLab