Parameter estimation for single compartment models is performed using literaturebased or userspecified arterial input functions. The LevenburgMarquardt algorithm does the heavy lifting.
1 2 
conc 
is a multidimensional (1D4D) array of contrast agent concentrations. The last dimension is assumed to be temporal, while the previous dimensions are assued to be spatial. 
time 
is a vector of acquisition times (in minutes) relative to injection of the contrast agent. Negative values should be used prior to the injection. 
img.mask 
is a (logical) multidimensional array that identifies
the voxels to be analyzed. Has to have same dimension as 
model 
is a character string that identifies the type of compartmental model to be used. Acceptable models include:

aif 
is a character string that identifies the parameters of the
type of arterial input function (AIF) used with the above model.
Acceptable values are: 
nprint 
is an integer, that enables controlled printing of
iterates if it is positive. In this case, estimates of 
user 
is a list with the following paramters required: D, AB, muB, AG, muG. 
verbose 
. 
... 
Additional parameters to the function. 
Compartmental models are the solution to the modified general rate equation (Kety 1951). The specific parametric models considered here include the basic Kety model
C_t(t)=K^{trans}≤ft[C_p(t)\otimes\exp(k_{ep}t)\right],
where \otimes is the convoluation operator, and the socalled extended Kety model
C_t(t)=v_pC_p(t)+K^{trans}≤ft[C_p(t)\otimes\exp(k_{ep}t)\right].
The arterial input function must be either literaturebased (with fixed parameters) or the exponential AIF from Orton et al. (2008) with userdefined parameters.
Parameter estimates and their standard errors are provided for the masked region of the multidimensional array. They include
ktrans 
Transfer rate from plasma to the extracellular, extravascular space (EES). 
kep 
Rate parameter for transport from the EES to plasma. 
ve 
Fractional occupancy by EES (the ratio between ktrans and kep). 
vp 
Fractional occupancy by plasma. 
ktranserror 
Standard error for ktrans. 
keperror 
Standard error for kep. 
vperror 
Standard error for vp. 
The residual sumofsquares is also provided, along with the original acquisition times (for plotting purposes).
Brandon Whitcher, Volker Schmid
Ahearn, T.S., Staff, R.T., Redpath, T.W. and Semple, S.I.K. (2005) The use of the LevenburgMarquardt curvefitting algorithm in pharmacokinetic modelling of DCEMRI data, Physics in Medicine and Biology, 50, N85N92.
FritzHansen, T., Rostrup, E., Larsson, H.B.W, Sondergaard, L., Ring, P. and Henriksen, O. (1993) Measurement of the arterial concentration of GdDTPA using MRI: A step toward quantitative perfusion imaging, Magnetic Resonance in Medicine, 36, 225231.
Orton, M.R., Collins, D.J., WalkerSamuel, S., d'Arcy, J.A., Hawkes, D.J., Atkinson, D. and Leach, M.O. (2007) Bayesian estimation of pharmacokinetic parameters for DCEMRI with a robust treatment of enhancement onset time, Physics in Medicine and Biology 52, 23932408.
Orton, M.R., d'Arcy, J.A., WalkerSamuel, S., Hawkes, D.J., Atkinson, D., Collins, D.J. and Leach, M.O. (2008) Computationally efficient vascular input function models for quantitative kinetic modelling using DCEMRI, Physics in Medicine and Biology 53, 12251239.
Tofts, P.S., Brix, G, Buckley, D.L., Evelhoch, J.L., Henderson, E., Knopp, M.V., Larsson, H.B.W., Lee, T.Y., Mayr, N.A., Parker, G.J.M., Port, R.E., Taylor, J. and Weiskoff, R. (1999) Estimating kinetic parameters from dynamic contrastenhanced T_1weighted MRI of a diffusable tracer: Standardized quantities and symbols, Journal of Magnetic Resonance, 10, 223232.
Tofts, P.S. and Kermode, A.G. (1984) Measurement of the bloodbrain barrier permeability and leakage space using dynamic MR imaging. 1. Fundamental concepts, Magnetic Resonance in Medicine, 17, 357367.
Weinmann, H.J., Laniado, M. and Mutzel, W. (1984) Pharmacokinetics of GdDTPA/dimeglumine after intraveneous injection into healthy volunteers, Physiological Chemistry and Physics and Medical NMR, 16, 167172.
dcemri.bayes
, dcemri.map
,
dcemri.spline
, nls.lm
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20  data("buckley")
## Set up breast data for dcemri
xi < seq(5, 300, by=5)
img < array(t(breast$data)[,xi], c(13,1,1,60))
time < buckley$time.min[xi]
aif < buckley$input[xi]
mask < array(TRUE, dim(img)[1:3])
## Generate AIF params using the orton.exp function from Buckley's AIF
aifparams < orton.exp.lm(time, aif)
fit < dcemri.lm(img, time, mask, model="orton.exp",
aif="user", user=aifparams)
## Scatterplot comparing true and estimated Ktrans values
plot(breast$ktrans, fit$ktrans, xlim=c(0,0.75), ylim=c(0,0.75),
xlab=expression(paste("True ", K^{trans})),
ylab=expression(paste("Estimated ", K^{trans})))
abline(0, 1, lwd=1.5, col="red")
cbind(breast$ktrans, fit$ktrans[,,1])

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.
All documentation is copyright its authors; we didn't write any of that.