30 December 2013

dcemriS4 0.51

The R package dcemriS4 provides routines for the quantitative analysis of dynamic contrast-enhanced magnetic resonance imaging (DCE-MRI), along with quantification of diffusion-weighted MRI (DWI) and quantitative T2 maps from CPMG sequences.  The latest version of dcemriS4 (0.51) contains a lot of modifications over the last 12+ months, mostly invisible to the end user.  Specific changes have been made to create a package compatible with R v3.0.x.

  • Improved usage of FORTRAN code.
  • Fixed broken links in the vignette.
  • Fixed bugs in the definition of empirical arterial input functions (AIFs).  

Estimated Ktrans values for a subject in the RIDER Neuro MRI collection from The Cancer Imaging Archive (TCIA).

Please post any questions or suggestions to dcemri-help@lists.sourceforge.net.  

29 December 2011

dcemriS4 0.46

The R package dcemriS4 provides routines for the quantitative analysis of dynamic contrast-enhanced magnetic resonance imaging (DCE-MRI), along with quantification of diffusion-weighted MRI (ADC = apparent diffusion coefficient) and quantitative T2 maps from Carr-Purcell-Meiboom-Gill (CPMG) sequences.  The latest version (0.46) has been submitted to CRAN and will hopefully be available for download soon.


Voxel-wise posterior median values of Ktrans (volume transfer constant
between the plasma and the extravascular extracellular space) using an MCMC algorithm.


Improvements or modifications from previous versions include:
  • Added dependence on R (>=2.14.0) so that the "parallel" package is used instead of the "multicore" package.
  • Added functions aifParameters() and compartmentalModel() to standardize the output in parameter estimation functions.
  • Allow the user to specify initial guesses for the Levenberg-Marquardt optimization in order to estimate the kinetic parameters.
  • Improved the implementation of CA.fast2 to estimate the T1 relaxation time and corresponding contrast agent concentration when only two flip angles are acquired.
  • Bug fix in dcemri.lm() when user-specified arterial input function (AIF) is provided.
  • Added cerebral blood volume (CBV) estimation functionality.
Please post any questions or suggestions to dcemri-help@lists.sourceforge.net.

22 December 2010

Data-driven arterial input functions

I haven't devoted any time/effort/code to the extraction and parameter estimation of arterial input functions (AIFs) for DCE-MRI in either the vignette or the submission to JSS.  Frankly, I wanted to communicate the main features of the R package dcemriS4 and data-driven AIFs just haven't made the list... up 'til now.  So let's assume one wants to fit a parametric model to observed contrast-agent concentration time curves (CTCs) obtained from a DCE-MRI acquisition.

The function extract.aif() requires a seed voxel to perform a three-dimensional region-growing algorithm based on correlation.  I use FSLView, but feel free to select the voxel using your favorite piece of software.  The code below uses the RIDER Neuro MRI data from the NBIA (National Biomedical Imaging Archive) that has been (a) converted from DICOM to NIfTI, (b) brain extracted by applying BET on the 15-degree multiple flip-angle acquisition and (c) converted from signal intensity to contrast agent concentration in all brain voxels.  The main steps in estimating a parametric AIF are
  1. Read in the contrast-agent CTCs (a four-dimensional NIfTI file)
  2. Read in the acquisition times (obtained from the DICOM data)
  3. Use extract.aif() with the seed voxel and correlation threshold
  4. Fit a parametric model (Orton et al. 2008) to the average CTC from the seed-growing algorithm



The thin black lines correspond to individual CTCs from the voxels, the red line is the average CTC used to fit the parametric model and the green curve is the fitted model. Note, in order to fit the entire time series a compromise was struck between fitting the first pass of the contrast versus the tail. It may be necessary to modify the range of acquisition times in order to emphasize the beginning or the end of the AIF, depending upon which aspect of the dynamic acquisition is more important.

Contrast-agent concentration time curves from voxel (128,75,9).

The four parameters that characterize the AIF model may be obtained via

18 November 2010

dcemriS4 0.40

The R package dcemriS4 is a collection of functions, with examples and documentation, that allows one to perform voxel-wise quantitative analysis of dynamic contrast-enhanced MRI (DCE-MRI) or diffusion-weighted imaging (DWI) data.  The primary application of this methodology is oncology, but applications to other therapeutic areas (such as neuroscience or inflammation) are equally possible. 

Estimated apparent diffusion coefficients (ADCs) from the RIDER Neuro MRI data.

The latest version of dcemriS4 (0.40) has been released on CRAN.  The source code is available for download now and compiled versions should follow shortly. New features include:
  • All compartmental model fitting procedures use the same parametric models
  • Levenberg-Marquardt and MAP routines now take advantage of the multicore package
  • Added full control of input parameters to nls.lm() when executing the Levenberg-Marquardt algorithm
  • Added quantitative T2 estimation from CPMG acquisitions
Please use the mailing list for any questions/suggestions or contact me directly at bjw34032@users.sourceforge.net.

09 October 2010

dcemriS4 0.34

The R package dcemriS4 is a collection of functions, with examples and documentation, that allows one to perform voxel-wise quantitative analysis of dynamic contrast-enhanced MRI (DCE-MRI) or diffusion-weighted imaging (DWI) data.  The primary application of this methodology is oncology, but applications to other therapeutic areas (such as neuroscience or inflammation) are equally possible. 

The latest version of dcemriS4 (0.34) has been released on CRAN. New features include:
  • Added kety.orton.exp and kety.orton.cos models to dcemri.{bayes,lm,map}()
  • Bayesian penalized splines via dcemri.spline()
  • Deviance Information Criterion (DIC) available in dcemri.bayes()
  • New prior distribution specifications for dcemri.bayes()
Please use the mailing list for any suggestions or contact bjw34032@users.sourceforge.net.

21 January 2010

writeNIfTI() is fully compatible with FSLView

With the NIfTI-1 header extensions the world is your oyster.  We decided that one use for such a capability is to keep an audit trail of all operations performed on the image data volume.  This is a key feature in the dcemriS4 package.  There are three main components to a NIfTI-1 header extension: esize, ecode and edata.  At first we arbitrarily set ecode = 1002 and further developed the software.  Turns out, FSLView is quite strict about the numbers used in ecode and it failed to accept our NIfTI-1 header extensions saved from R.  Looking at the file nifti1_io.h, the following ecodes have been defined:



Advice from the FSL team (thanks: Matt Webster and Dave Flitney) was for us to use ecode = 6 (ASCII) since the audit trail is text in XML format.  Now one can produce an example data volume



We now have a file "img_nifti.nii.gz" that is available to us and using a utility in FSL we can investigate the attributes of this file

% $FSLDIR/bin/fslhd img_nifti | grep 'vox_offset'
vox_offset     1168

and reading the file back into R allows us to interrogate the ecode via its S4 slot


20 January 2010

Remote download and viewing of brain atlas

The dcemriS4 package allows one to easily import and display NIfTI-1 class data sets. The following code takes the MNI152 brain atlas from the WWW and produces an orthographic display using the mid-axial, mid-sagittal and mid-coronal planes.