writeESTATICS: Write maps of ESTATICS parameters in standardized form as...

View source: R/mpmESTATICS.r

writeESTATICSR Documentation

Write maps of ESTATICS parameters in standardized form as NIfTI files.

Description

R2, ST1, SPD and, if available, SMT-maps are written as compressed NIfTI files into directory the speecified directory. If class(mpmESTATICSModel) == "sESTATICSModel" and an smoothed data are stored in mpmESTATICSModel$smoothedData the smoothed data are stored as ompressed NIfTI files in dir with filenames assembled using prefix and the names of the data source files.

Usage

writeESTATICS(mpmESTATICSModel, dir = NULL, prefix = "estatics", verbose = TRUE)

Arguments

mpmESTATICSModel

Object of class 'ESTATICSModel' or 'sESTATICSModel' as returned from function estimateESTATICS or smoothESTATICS.

dir

Directory name (or path) for output.

prefix

Prefix for file names

verbose

logical - provide information on progress

Value

The function returns NULL

Author(s)

Karsten Tabelow tabelow@wias-berlin.de
J\"org Polzehl polzehl@wias-berlin.de

See Also

readMPMData, estimateESTATICS, smoothESTATICS

Examples

dataDir <- system.file("extdata",package="qMRI")
outDir <- tempdir()
#
#  set file names for T1w, MTw and PDw images
#
t1Names <- paste0("t1w_",1:8,".nii.gz")
mtNames <- paste0("mtw_",1:6,".nii.gz")
pdNames <- paste0("pdw_",1:8,".nii.gz")
t1Files <- file.path(dataDir, t1Names)
mtFiles <- file.path(dataDir, mtNames)
pdFiles <- file.path(dataDir, pdNames)
#
#  file names of mask and B1 field map
#
B1File <- file.path(dataDir, "B1map.nii.gz")
maskFile <- file.path(dataDir, "mask0.nii.gz")
#
#  Acquisition parameters (TE, TR, Flip Angle) for T1w, MTw and PDw images
#
TE <- c(2.3, 4.6, 6.9, 9.2, 11.5, 13.8, 16.1, 18.4,
        2.3, 4.6, 6.9, 9.2, 11.5, 13.8,
        2.3, 4.6, 6.9, 9.2, 11.5, 13.8, 16.1, 18.4)
TR <- rep(25, 22)
FA <- c(rep(21, 8), rep(6, 6), rep(6, 8))
#
#   read MPM example data
#
library(qMRI)
mpm <- readMPMData(t1Files, pdFiles, mtFiles,
                   maskFile, TR = TR, TE = TE,
                   FA = FA, verbose = FALSE)
#
#  Estimate Parameters in the ESTATICS model
#
modelMPM <- estimateESTATICS(mpm, method = "NLR")
#
#  resulting ESTATICS parameter maps for central coronal slice
#
if(require(adimpro)){
rimage.options(zquantiles=c(.01,.99), ylab="z")
oldpar <- par(mfrow=c(2,2),mar=c(3,3,3,1),mgp=c(2,1,0))
on.exit(par(oldpar))
pnames <- c("T1","MT","PD","R2star")
modelCoeff <- extract(modelMPM,"modelCoeff")
for(i in 1:4){
   rimage(modelCoeff[i,,11,])
   title(pnames[i])
   }
}
#
#  write ESTATICS parameter maps
#
writeESTATICS(modelMPM, dir=outDir, prefix="estatics")
par(oldpar)

WIAS-BERLIN/qMRI documentation built on March 28, 2024, 5:33 a.m.