by Scott Prahl

The Monte Carlo technique is a flexible method for simulating light propagation in tissue. The simulation is based on the random walks that photons make as they travel through tissue, which are chosen by statistically sampling the probability distributions for step size and angular deflection per scattering event. After propagating many photons, the net distribution of all the photon paths yields an accurate approximation to reality.

There are a variety of ways to implement Monte Carlo simulations of light transport. One approach is to predict steady-state light distributions. Below we provide a steady-state model (MCML) for multi-layered media that is well developed and documented and has been used by many groups. The other approach is to predict time-resolved light distributions.

Download a 2011 PDF of a book chapter on the Monte Carlo method: Jacques Monte Carlo in Welch & van Gemert.

Drop-Dead Simple Monte Carlo Codes

by Scott Prahl

Despite appearances to the contrary (e.g., MCML), Monte Carlo code does not need to be long and complicated. To emphasize this idea of the inherent simplicity of the Monte Carlo approach, I have written three short programs. Enjoy!

Simulates light propagation from a point source in an infinite medium with isotropic scattering. The entire source for this program fits on a single page and is a good way to get an overview of the entire Monte Carlo process. One of my graduate students put together this page of comments about trying to use mc_tiny.c.
Simulates light propagation from normal irradiation of a semi-infinite medium with anisotropic scattering. It calculates the volumetric heating as a function of depth. This program takes two whole pages, but is very handy for a bunch of problems.
Simulates the time resolved backscattering of a semi-infinite medium with anisotropic scattering. This program is adapted from small_mc.c above, and shows how simply time resolved simulations can be done.

Simple Monte Carlo

by Steven Jacques

Class on Monte Carlo.
An introduction to the Monte Carlo technique and some simple programs.

Simple steady-state Monte Carlo in spherical, cylindrical and planar coordinates. (ANSI standard C.) Used in the article:

SL Jacques, Light distributions from point, line and plane sources for photochemical reactions and fluorescence in turbid biological tissues. Photochem. Photobiol. 67:23-32, 1998.

Simple time-resolved Monte Carlo in spherical coordinates. (ANSI standard C.)

Fluorescent Monte Carlo

by Steven Jacques

Simulation of fluorescence in scattering medium.
Uses the subroutine mcsub.c to simulate
  1. the penetration and escape of excitation light from a semi-infinite medium,
  2. the distribution and escape of fluorescence from a uniform fluorophore in the medium, and
  3. the distribution and escape of fluorescence from a localized heterogeneity in the medium.

Originally described in the article:

SL Jacques, Monte Carlo simulations of fluorescence in turbid media, Ch. 6 in Handbook of Biomedical Fluorescence, M.A. Mycek, B.W. Pogue, publ. Marcel-Dekker, New York, NY, 2003.


by Steven Jacques

A Monte Carlo subroutine in ANSI-standard C

A Monte Carlo subroutine written in C that can be called by another C program, for example callmcsub.c.

The subroutine mcsub.c simulates

  1. the penetration and escape of light from a slab of absorbing/scattering medium,
  2. allows light delivery by collimated or focused beam, either uniform or Gaussian in shape,
  3. homogeneous tissue slab.

Also includes MATLAB program for viewing results of simulation.


by Steven Jacques, Ting Li, Scott Prahl

mcxyz.c, a 3D Monte Carlo simulation of heterogeneous tissues

mcxyz.c is a computer simulation of light transport in a heterogenous medium with varying absorption and scattering properties.

The medium is defined as a cube with cube-shaped voxels, typically a 400x400x400 voxel cube. Each voxel is assigned an integer value which identifies a particular type of tissue with unique optical properties of µa, µs, and g. The simulation yields a map of the relative fluence rate φ [W/cm2 per W delivered] or [cm-2] throughout the cube.

The software also includes a MATLAB program that generates the input files to mcxyz.c:

Palette of tissue types.
The MATLAB program generates the palette of tissue types (i.e., the optical properties) for a chosen wavelength of light.
Simulation parameters.
The program allows the user to create an input file that directs mcxyz.c with regard to the parameters governing the simulation (size of cube, number of voxels, duration of simulation, etc.), and how the light is delivered (collimated beam, focused beam, uniform irradiance, Gaussian beam shape, isotropic point source).
3D structure of tissue.
The progam allows the user to create the 3D structure of the desired heterogeneous tissue.

mcxyz.c can read input files generated by alternative software that follows the same simple format used by the MATLAB program. So the MATLAB program is a current working version that could be replaced by alternative software.

Polarized Light Monte Carlo

by Jessica Ramella-Roman, Scott Prahl, Steven Jacques

Polarized Light Monte Carlo software.

The movement of polarized light is treated as the propagation of a Stokes Vector of intensity, [I Q U V]T, for each of 4 sources of light, H, V, P, and R (H = linearly polarized parallel to scattering plane, V = linearly polarized perpendicular to scattering plane, P = linearly polarized at +45°, R = right circular polarized). Hence, 16 output files are generates, HI, HQ, HU, HV, PI, PQ, PU, PV, etc., where each is the x-y map of escaping reflectance from a planar slab of tissue of specified thickness.

(MCML) Monte Carlo for Multi-Layered media

by Lihong Wang (Texas A&M) and Steven L. Jacques

MCML is a steady-state Monte Carlo simulation program for multi-layered turbid media with an infinitely narrow photon beam as the light source. Each layer has its own optical properties of absorption, scattering, anisotropy, and refractive index. The simulation is 3D, but the results are stored in an r-z array in cylindrical coordinates denoting radial and depth positions. Outputs include the radial position and angular dependence of local reflectance and transmittance, and the internal distribution of energy deposition and fluence rate within the multilayered medium. The program can be easily modified.

The simulation is specified by an input text file called, for example, "sample.mci", which can be altered by any simple text editor. The output is another text file called, for example, "sample.mco". (The names are arbitrary.)

This program was originally implemented by Marleen Keijzer, Scott Prahl, and Steven Jacques in Pascal. A later version was written in Standard ANSI C by Lihong Wang and Steven Jacques implementing multiply layered tissue, which has been distributed on the Internet since 1992 and successfully modified by many groups.

More on the history of mcml and downloads.

Some references on this method are:

  • Keijzer, M., S.L. Jacques, S.A. Prahl, A.J. Welch: Light distributions in artery tissue: Monte Carlo simulations for finite-diameter lasers beams. Lasers in Medicine and Surgery 9:148-154, 1989.
  • Prahl, S.A., M. Keijzer, S.L. Jacques, A.J. Welch: A Monte Carlo model of light propagation in tissue. In Dosimetry of Laser Radiation in Medicine and Biology, G. Mueller, D. Sliney, Eds., SPIE Series Vol. IS 5:102-111, 1989.
  • Keijzer, M., R. Richards-Kortum, S.L. Jacques, M.S. Feld: Fluorescence spectroscopy of turbid media: Autofluorescence of the human aorta, Applied Optics 28:4286-4292, 1989.
  • Jacques, S.L.: Time-resolved propagation of ultra-short laser pulses within turbid tissues. Applied Optics 28:2223-2229, 1989.
  • Jacques, S.L.: Time-resolved reflectance spectroscopy in turbid tissues. Transactions IEEE on Biomedical Engineering 36:1155-1161, 1989.
  • Wang, L-H, S.L. Jacques: Hybrid model of Monte Carlo simulation and diffusion theory for light reflectance by turbid media. J. Optical Soc. Am. A 10:1746-1752, 1993.
  • Wang, L-H, S.L. Jacques: Optimized radial and angular positions in Monte Carlo modeling. Med. Phys. 21:1081-1083, 1994.
  • Wang, L-H, S.L. Jacques, L-Q Zheng: MCML - Monte Carlo modeling of photon transport in multi-layered tissues. Computer Methods and Programs in Biomedicine 47:131-146, 1995. download pdf
  • L.-H. Wang, S. L. Jacques, and L.-Q. Zheng: CONV - Convolution for responses to a finite diameter photon beam incident on multi-layered tissues, Computer Methods and Programs in Biomedicine 54:141-150, 1997. download pdf

The details of the light propagation model are given in Prahl et al. 1989 which can be downloaded. This paper is a terse but complete description of the Monte Carlo simulation and convolution. The report by Wang et al. 1995 is the latest summary of the current MCML method.

You can download the MCML source code as ASCII text files, as an encoded source.tar.gz file, and as pre-compiled versions for the PC, Macintosh and SUN. A full 117-page manual and a brief ASCII manual are also provided.

Download MCML manual: man_mcml.pdf

Download MCML source code: ASCII source code | Source-code.tar.gz

Download original precompiled PC version of MCML: precompiled mcml.exe for PC

Download manual: MCML & CONV Manual | Mini Manual in ASCII

Lihong Wang's source code site: ASCII source code

A MATLAB program called lookmcml.m will read the output file of MCML, using a subroutine called getmcml.m and a colormap called makec2f.m. These can be downloaded at:


GPU Monte Carlo for Graphics Cards

by E. Alerstam, T. Svensson, and S. Andersson-Engels

CUDAMCML is an excellent implementation of MCML that takes advantage of the presence of NVIDIA graphics cards to run much faster.

The details of the light propagation model are given in E. Alerstam, T. Svensson, and S. Andersson-Engels J. Biomedical Optics Letters 13, 060504 (2008) .

You can download the GPU MCML source code from the Lund University Biophotonics site

(CONV) Finite Beam Calculations

by Lihong Wang (Texas A&M) and Steven L. Jacques

CONV is a convolution program which uses the MCML output file to convolve for photon beams of variable size or shape (Gaussian or flat field). CONV can provide a variety of output formats (reflectance, transmission, iso-fluence contours, etc.) which are compatible with standard graphics applications.

Download CONV source code: ASCII source code | Source-code.tar.gz

Download compiled code: PC | Mac | Sun

Download manual: MCML & CONV Manual | Mini Manual in ASCII