Parameter estimation (intensity, relaxation rate, proportion of fluid) in Inversion Recovery MRI data.

estimateIR(IRdataobj, TEScale = 100, dataScale = 1000, method = c("NLR", "QL"),
           varest = c("RSS","data"), fixed = TRUE, smoothMethod=c("PAWS","Depth"),
           kstar = 24, alpha = .025, bysegment = TRUE, verbose = TRUE)

Arguments

IRdataobj

4D array of IRMRI signals. First dimension corresponds to Inversion times (InvTime).

TEScale

Internal scale factor for Echo Times. This influences parameter scales in numerical calculations.

dataScale

Internal scale factor for MR signals. This influences parameter scales in numerical calculations.

method

Either "NLS" for nonlinear least squares (ignores Rician bias) or "QL" for Quasi-Likelihood. The second option is more accurate but requires additional information and is computationally more expensive.

varest

Method to, in case of method="QR", estimate sigmaif not provided. Either from residual sums of squares ("RSS") or MR signals ("data") using function varest from package aws. Only to be used in case that no image registration was needed as preprocessing.

fixed

Should adaptive smoothing performed for Sx and Rx maps and fx maps reestimated afterwards ?

smoothMethod

Either "PAWS" or "Depth". the second option is not yet implemented.

kstar

number of steps used in PAWS

alpha

significance level for decisions in aws algorithm (suggestion: between 1e-5 and 0.025)

bysegment

TRUE: restrict smoothing to segments from segmentation, FALSE: restrict smoothing to solid mask.

verbose

Logical. Provide some runtime diagnostics.

Details

This function implements the complete pipeline of IRMRI anlysis.

Value

List of class "IRmixed" with components

IRdata

4D array containing the IRMRI data, first dimension refers to inversion times

InvTimes

vector of inversion times

segm

segmentation codes, 1 for CSF, 2 for GM, 3 for WM, 0 for out of brain

sigma

noise standard deviation, if not specified estimated fron CSF areas in image with largest inversion time

L

effective number of coils

fx

Array of fluid proportions

Sx

Array of maximal signals

Rx

Array of relaxation rates

Sf

Global estimate of maximal fluid signal

Rf

Global estimate of fluid relaxation rate

ICovx

Covariance matrix of estimates fx, Sx and Rx.

sigma

Array of provided or estimated noise standard deviations

Convx

Array of convergence indicators

rsdx

Residual standard deviations

The arrays contain entries for all voxel with segments%in%1:3.

References

J. Polzehl and K. Tabelow (2023), Magnetic Resonance Brain Imaging: Modeling and Data Analysis Using R, 2nd Edition, Chapter 7, Springer, Use R! Series. <doi:10.1007/978-3-031-38949-8_7>.

J. Polzehl and K. Tabelow (2023), Magnetic Resonance Brain Imaging - Modeling and Data Analysis Using R: Code and Data. <doi:10.20347/WIAS.DATA.6>.

Author

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

Examples

# \donttest{
## runs about 30 seconds
dataDir0 <- system.file("extdataIR", package = "qMRI")
dataDir <- tempdir()
library(oro.nifti)
#> oro.nifti 0.11.5
library(qMRI)
segm <- readNIfTI(file.path(dataDir0,"Brainweb_segm"))
Sf <- 900
Rf <- 0.000285
Sgm <- 400
Rgm <- 0.00075
fgm <- .15
Swm <- 370
Rwm <- 0.0011
fwm <- .05
InvTimes0 <- c(100, 200, 400, 600, 800, 1200, 1600, 2000, 2500, 3000, 
              3500, 4000, 4500, 5000, 6000, 15000)
nTimes <- length(InvTimes0)
sigma <- 40
## generate IR signal
IRdata <- generateIRData(segm, c(Sf,Rf), c(fgm,Rgm,Sgm), c(fwm,Rwm,Swm), InvTimes0, sigma)
for(i in 1:9) writeNIfTI(as.nifti(IRdata[i,,,]), 
                         file.path(dataDir,paste0("IR0",i)))
for(i in 10:nTimes) writeNIfTI(as.nifti(IRdata[i,,,]), 
                         file.path(dataDir,paste0("IR",i)))
## generate IRdata object
t1Files <- list.files(dataDir,"*.nii.gz",full.names=TRUE)
segmFile <- file.path(dataDir0,"Brainweb_segm")
IRdata <- readIRData(t1Files, InvTimes0, segmFile, sigma=sigma,
                     L=1, segmCodes=c("CSF","GM","WM"))
## estimate all
sIRmix <- estimateIR(IRdata, method="QL")
#> Start estimation in 520 voxel at 2025-06-09 19:22:48 
#> 
  |                                                                            
  |                                                                      |   0%
#> Finished estimation 2025-06-09 19:22:50 
#>  Sf 0.9928842 Rf 0.07222809 
#> Start estimation in 3439 voxel at 2025-06-09 19:22:50 
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |====================                                                  |  29%
  |                                                                            
  |=========================================                             |  58%
  |                                                                            
  |=============================================================         |  87%
#> Finished estimation 2025-06-09 19:23:27 
#> using lambda= 72.2501  patchsize= 1 
#> Progress:step 1 hakt 1.010094 time 2025-06-09 19:23:27 
#> 0.12%  mean(bi) 1.08  step 2 hakt 1.022112 time 2025-06-09 19:23:27 
#> 0.27%  mean(bi) 1.15  step 3 hakt 1.036734 time 2025-06-09 19:23:27 
#> 0.45%  mean(bi) 1.25  step 4 hakt 1.055089 time 2025-06-09 19:23:27 
#> 0.68%  mean(bi) 1.37  step 5 hakt 1.079244 time 2025-06-09 19:23:27 
#> 0.97%  mean(bi) 1.52  step 6 hakt 1.113575 time 2025-06-09 19:23:27 
#> 1.3%  mean(bi) 1.71  step 7 hakt 1.169864 time 2025-06-09 19:23:27 
#> 1.8%  mean(bi) 1.99  step 8 hakt 1.301837 time 2025-06-09 19:23:27 
#> 2.4%  mean(bi) 2.52  step 9 hakt 1.43298 time 2025-06-09 19:23:27 
#> 3.1%  mean(bi) 3.05  step 10 hakt 1.46908 time 2025-06-09 19:23:27 
#> 3.9%  mean(bi) 3.41  step 11 hakt 1.5238 time 2025-06-09 19:23:28 
#> 5%  mean(bi) 3.9  step 12 hakt 1.62706 time 2025-06-09 19:23:28 
#> 6.4%  mean(bi) 4.7  step 13 hakt 1.781311 time 2025-06-09 19:23:28 
#> 8.2%  mean(bi) 5.81  step 14 hakt 1.971094 time 2025-06-09 19:23:28 
#> 10%  mean(bi) 7.19  step 15 hakt 2.23693 time 2025-06-09 19:23:28 
#> 13%  mean(bi) 9.09  step 16 hakt 2.333935 time 2025-06-09 19:23:28 
#> 16%  mean(bi) 10.3  step 17 hakt 2.47514 time 2025-06-09 19:23:28 
#> 21%  mean(bi) 12  step 18 hakt 2.602458 time 2025-06-09 19:23:28 
#> 26%  mean(bi) 13.8  step 19 hakt 2.867929 time 2025-06-09 19:23:28 
#> 32%  mean(bi) 16.9  step 20 hakt 3.117881 time 2025-06-09 19:23:28 
#> 41%  mean(bi) 20  step 21 hakt 3.333294 time 2025-06-09 19:23:28 
#> 51%  mean(bi) 23.2  step 22 hakt 3.588524 time 2025-06-09 19:23:29 
#> 64%  mean(bi) 27.2  step 23 hakt 3.846104 time 2025-06-09 19:23:29 
#> 80%  mean(bi) 31.4  step 24 hakt 4.182155 time 2025-06-09 19:23:29 
#> 100%  mean(bi) 36.7  
#> Progress:step 1 hakt 1.010094 time 2025-06-09 19:23:29 
#> 0.12%  mean(bi) 1.09  step 2 hakt 1.022112 time 2025-06-09 19:23:29 
#> 0.27%  mean(bi) 1  step 3 hakt 1.036734 time 2025-06-09 19:23:29 
#> 0.45%  mean(bi) 1.01  step 4 hakt 1.055089 time 2025-06-09 19:23:29 
#> 0.68%  mean(bi) 1.01  step 5 hakt 1.079244 time 2025-06-09 19:23:29 
#> 0.97%  mean(bi) 1.01  step 6 hakt 1.113575 time 2025-06-09 19:23:29 
#> 1.3%  mean(bi) 1.02  step 7 hakt 1.169864 time 2025-06-09 19:23:29 
#> 1.8%  mean(bi) 1.02  step 8 hakt 1.301837 time 2025-06-09 19:23:29 
#> 2.4%  mean(bi) 1.03  step 9 hakt 1.43298 time 2025-06-09 19:23:29 
#> 3.1%  mean(bi) 1.05  step 10 hakt 1.46908 time 2025-06-09 19:23:30 
#> 3.9%  mean(bi) 1.06  step 11 hakt 1.5238 time 2025-06-09 19:23:30 
#> 5%  mean(bi) 1.07  step 12 hakt 1.62706 time 2025-06-09 19:23:30 
#> 6.4%  mean(bi) 1.09  step 13 hakt 1.781311 time 2025-06-09 19:23:30 
#> 8.2%  mean(bi) 1.11  step 14 hakt 1.971094 time 2025-06-09 19:23:30 
#> 10%  mean(bi) 1.15  step 15 hakt 2.23693 time 2025-06-09 19:23:30 
#> 13%  mean(bi) 1.21  step 16 hakt 2.333935 time 2025-06-09 19:23:30 
#> 16%  mean(bi) 1.25  step 17 hakt 2.47514 time 2025-06-09 19:23:30 
#> 21%  mean(bi) 1.3  step 18 hakt 2.602458 time 2025-06-09 19:23:30 
#> 26%  mean(bi) 1.36  step 19 hakt 2.867929 time 2025-06-09 19:23:30 
#> 32%  mean(bi) 1.47  step 20 hakt 3.117881 time 2025-06-09 19:23:30 
#> 41%  mean(bi) 1.57  step 21 hakt 3.333294 time 2025-06-09 19:23:30 
#> 51%  mean(bi) 1.66  step 22 hakt 3.588524 time 2025-06-09 19:23:31 
#> 64%  mean(bi) 1.76  step 23 hakt 3.846104 time 2025-06-09 19:23:31 
#> 80%  mean(bi) 1.88  step 24 hakt 4.182155 time 2025-06-09 19:23:31 
#> 100%  mean(bi) 2  
#> Start estimation in 3439 voxel at 2025-06-09 19:23:31 
#> 
  |                                                                            
  |                                                                      |   0%
  |                                                                            
  |====================                                                  |  29%
  |                                                                            
  |=========================================                             |  58%
  |                                                                            
  |=============================================================         |  87%
#> Finished estimation 2025-06-09 19:23:34 
# }