logo

Monte Carlo Simulations


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.

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!

tiny_mc.c
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.
small_mc.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.
time_mc.c
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.
mc321.c

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.

trmc.c
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.

mcsub.c

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.

mcxyz.c

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:

  1. Palette of tissue types. The MATLAB program generates the palette of tissue types (i.e., the optical properties) for a chosen wavelength of light.
  2. 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).
  3. 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 which has been distributed on the Internet since 1992 and successfully modified by many groups. Some references on this method are:

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 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:

lookmcml.m
getmcml.m
makec2f.m


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

© 2007 Scott Prahl