You are on page 1of 37

NIRFAST

September 9, 2009

Contents
1 Introduction 2 Installation 3 Using NIRFAST 4 Inputs 4.1 Meshes . . . . . . . 4.1.1 *.node . . . 4.1.2 *.elem . . . 4.1.3 *.param . . 4.1.4 *.source . . 4.1.5 *.meas . . . 4.1.6 *.link . . . . 4.1.7 *.region . . 4.2 Data . . . . . . . . 4.2.1 standard . . 4.2.2 uorescence 4.2.3 spectral . . 2 2 2 6 6 7 7 7 9 10 10 10 10 11 11 11 12 12 17 23 29 34

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

. . . . . . . . . . . .

5 Tutorials 5.1 Standard Single Wavelength Simulation . . . . . . . . . . . . . 5.2 Fluorescence Simulation . . . . . . . . . . . . . . . . . . . . . 5.3 Spectral Simulation . . . . . . . . . . . . . . . . . . . . . . . . 5.4 Spectral Calibration and Reconstruction of Experimental Data 5.5 Fluorescence Reconstruction of Calibrated Experimental Data

Introduction

NIRFAST is an open source FEM based software package designed for modeling Near Infrared Frequency domain light transport in tissue. The types of problems available include: 1. Standard single wavelength absorption and reduced scatter 2. Multi-wavelength spectral models 3. Fluorescence models For a good description of the underlying theory, see the following paper. Please reference this paper if you use NIRFAST in a published work. http://www.cs.bham.ac.uk/~dehghanh/research/downloads/Dehghani_CNM_2008.pdf

Installation

Unzip NIRFAST.zip onto your computer. Open Matlab, go to File Set Path Add with Subfolders, and select the NIRFAST folder.

Using NIRFAST

To run NIRFAST, open MATLAB and type nirfast in the prompt (without the quotes). This will open up the graphic user interface.

From here you can run NIRFAST functions by selecting them in the mesh, data, reconstruct, and solution menus.

Follow the prompts and type in the inputs for the function.

Then click Done. Your function will be run in matlab, and the code will appear in the nirfast window.

You can select multiple functions in this manner, and then run them all at once using the Batch Mode checkbox in NIRFAST. You can even save the code that is generated as a script le to run later by going to File Save. Scripts can be loaded using File Open, and you can start a new script using File New.

4
4.1

Inputs
Meshes

NIRFAST loads a mesh from 7 input les. They all have the same prex. For example: mymesh.node, mymesh.elem, etc.

4.1.1

*.node

Contains the 3D locations of the nodes. For a 2D mesh, the last column will be zeroes. The 1st column is a ag of either 0 (internal node) or 1 (external boundary node). The 2nd column is the x coordinate of each node. The 3rd column is the y coordinate of each node. The 4th column is the z coordinate of each node. Example: 1 0 . . . 1 x1 x2 . . . xN y1 y2 . . . yN z1 z2 . . . zN

4.1.2

*.elem

Contains the element connectivity list. Each row contains the numbers of the nodes that make up an element. In 2D this is an M x 3 matrix (3 nodes make one triangle), where M is the total number of elements. In 3D this is an M x 4 matrix (4 nodes make one tetrahedral), where M is the total number of elements. The element numbering system begins with node 1. Example: 1 3 . . . 44 4.1.3 2 5 . . . 51 11 6 . . . 9 4 7 . . . 1

*.param

standard For a standard mesh, this contains the nodal optical parameter values. The rst line in this le is the mesh type, stnd. Then there follows an N x

3 matrix, where N is the total number of nodes. The 1st column is the absorption coecient of each node. The 2nd column is the diusion coecient of each node. The 3rd column is the Refractive Index of each node. The units of absorption are in mm-1 and diusion coecient in mm. Example: stnd a1 a2 . . . aN 1 2 . . . N RI1 RI2 . . . RIN

uorescence For a uorescence mesh, the mesh type will be uor. Then there follows a N x 8 matrix, where N is the total number of nodes. The The The The The The The The 1st column is the absorption coecient at excitation wavelength 2nd column is the diusion coecient at excitation wavelength 3rd is the Refractive Index 4th column is the absorption coecient at emission wavelength 5th column is the diusion coecient at emission wavelength 6th column is the uorophore absorption 7th column is the quantum yield of uorophore 8th column is the half-life of uorophore

Example: uor ax1 ax2 . . . axN x1 x2 . . . xN RI1 RI2 . . . RIN am1 am2 . . . amN m1 m2 . . . mN af1 af2 . . . afN 1 2 . . . N 1 2 . . . N

spectral For a spectral mesh, this contains the nodal chromophore parameter values. The mesh type will be spec. Then follows, on each line, the name of each chromophore. This is limited to HbO, deoxyHb, Water, S-Amplitude, and S-Power. 8

An optional le to include is the *.excoef le, which contains the names of user specied chormophores, and their associated extinction coecients. NIRFAST comes with a standard *.excoef le, called excoef.txt (See this le for format). Example: spec HbO deoxyHb Water S-Amplitude S-Power C1,1 C1,2 . . . C1,N

C2,1 C2,2 . . . C2,N

C3,1 C3,2 . . . C3,N

SA1 SA2 . . . SAN

SP1 SP2 . . . SPN

spectral uorescence For a spectral uorescence mesh, the param le should contain the spectral information (and have the type spec). Then make a second param le (*.param for instance) containing the uorescence information. 4.1.4 *.source

Contains the coordinates of each optical source. The sources need to be assigned as near to the external boundary as possible. During mesh load-up, the software automatically nds the nearest boundary, nds the associated reduced scatter value at that region and places the source at 1 scattering distance inside the boundary. For a 2D mesh, this will be an N x 2 matrix, where N is the number of nodes. For a 3D mesh, this will be an N x 3 matrix, where N is the number of nodes. NOTE: The moving of the sources to the boundary assumes a convex hull! At the beginning of the *source le, if the term xed is specied, the program will not adjust source positions (best for non-symmetric and non-circular models). 9

4.1.5

*.meas

Contains the coordinates of each optical detector. The detectors need to be assigned as near to the external boundary as possible. During mesh load-up, the software automatically neds nearest boundary, and places the detectors on the boundary. For a 2D mesh, this will be an N x 2 matrix, where N is the number of nodes. For a 3D mesh, this will be an N x 3 matrix, where N is the number of nodes. NOTE: The moving of the sources to the boundary assumes a convex hull! At the beginning of the *source le, if the term xed is specied, the program will not adjust source positions (best for non-symmetric and non-circular models). 4.1.6 *.link

Contains the linking protocal for the sources and detectors. This is a matrix of size S x D-1, where S is the number of sources and D is the number of detectors. For each row (each source), the order and detector numbers are entered. Example: 2 3 4 5 6 7 1 3 4 5 6 7 1 2 4 5 6 7 1 2 3 5 6 7 1 2 3 4 6 7 1 2 3 4 5 7 1 2 3 4 5 6

4.1.7

*.region

This le is optional. For each node, a numerical label can be associated. This is an N x 1 matrix, where N is the number of nodes.

4.2

Data

All data is stored in a single *.paa le.

10

4.2.1

standard

Standard data is stored in two columns. The rst column contains amplitude values and the second column contains phase information. Example: a1 a2 . . . aB p1 p2 . . . pB

Here B = S(D-1), where S is the number of sources and D is the number of detectors. 4.2.2 uorescence

Fluoresence data should have whichever of the following labels are appropriate on the rst line, followed by the corresponding amplitude and phase columns (x = excitation and mm = emission): xamplitude xphase amplitude phase mmamplitude mmphase Example: xamplitude xa1 xa2 . . . xaB xphase amplitude xp1 a1 xp2 a2 . . . xpB aB phase p1 p2 pB

Here B = S(D-1), where S is the number of sources and D is the number of detectors. 4.2.3 spectral

Spectral data should have wavelength labels on the rst line, followed by the corresponding amplitude and phase columns. Example:

11

w661 w661a 1 w661a 2 . . . w661a B

w661 w661p 1 w661p 2 . . . w661p B

w705 w705a 1 w705a 2 w705a B

w705 w705p 1 w705p 2 w705p B

Here B = S(D-1), where S is the number of sources and D is the number of detectors.

5
5.1

Tutorials
Standard Single Wavelength Simulation

This tutorial explains how to run an example standard simulation. Open nirfast by typing nirfast in matlab (without the quotes). Load the mesh by selecting Mesh Load Mesh.

Click Browse and nd circle2000 86 stnd.node in NIRFAST/meshes/standard. Then click Done.

12

NIRFAST has loaded the mesh, and the code is in the NIRFAST window. Add an anomaly to the mesh by selecting Mesh Add Anomaly Standard. For the Input Mesh, use the arrow to select our mesh: circle2000 86 stnd. Use the following values for the anomaly properties:

13

Run the forward model on the anomaly mesh by selecting Mesh Forward Solver Standard. For the Input Mesh, use the arrow to select the anomaly mesh: circle2000 86 stnd anom. Use a modulation frequency of 100.

14

Run a reconstruction of the data by selecting Reconstruct Standard. Use circle2000 86 stnd as the Input Mesh and circle2000 86 stnd anom data as the Input Data. Beside Save Solution To, click the Browse button and select a place to save the output solution of the reconstruction. Use the following values for the reconstruction properties:

15

NIRFAST will run the reconstruction. When it has nished, it will show you the solution at the last iteration.

16

5.2

Fluorescence Simulation

This tutorial explains how to run an example uorescence simulation. Open nirfast by typing nirfast in matlab (without the quotes). Load the mesh by selecting Mesh Load Mesh.

17

Click Browse and nd circle2000 86 .node in NIRFAST/meshes/. Then click Done.

18

NIRFAST has loaded the mesh, and the code is in the NIRFAST window. Add an anomaly to the mesh by selecting Mesh Add Anomaly Fluorescence. For the Input Mesh, use the arrow to select our mesh: circle2000 86 . Use the following values for the anomaly properties:

19

Run the forward model on the anomaly mesh by selecting Mesh Forward Solver Fluorescence. For the Input Mesh, use the arrow to select the anomaly mesh: circle2000 86 anom. Use a modulation frequency of 100.

20

Run a reconstruction of the data by selecting Reconstruct Fluorescence. Use circle2000 86 as the Input Mesh and circle2000 86 anom data as the Input Data. Beside Save Solution To, click the Browse button and select a place to save the output solution of the reconstruction. Use the following values for the reconstruction properties:

21

NIRFAST will run the reconstruction. When it has nished, it will show you the solution at the last iteration.

22

5.3

Spectral Simulation

This tutorial explains how to run an example spectral (multi-wavelength) simulation. Open nirfast by typing nirfast in matlab (without the quotes). Load the mesh by selecting Mesh Load Mesh.

23

Click Browse and nd circle2000 86 spec.node in NIRFAST/meshes/spectral. Then click Done.

24

NIRFAST has loaded the mesh, and the code is in the NIRFAST window. Add an anomaly to the mesh by selecting Mesh Add Anomaly Spectral. For the Input Mesh, use the arrow to select our mesh: circle2000 86 spec. Use the following values for the anomaly properties:

25

Run the forward model on the anomaly mesh by selecting Mesh Forward Solver Spectral. For the Input Mesh, use the arrow to select the anomaly mesh: circle2000 86 spec anom. Use a modulation frequency of 100.

26

Run a reconstruction of the data by selecting Reconstruct Spectral. Use circle2000 86 spec as the Input Mesh and circle2000 86 spec anom data as the Input Data. Beside Save Solution To, click the Browse button and select a place to save the output solution of the reconstruction. Use the following values for the reconstruction properties:

27

NIRFAST will run the reconstruction. When it has nished, it will show you the solution at the last iteration.

28

5.4

Spectral Calibration and Reconstruction of Experimental Data

This tutorial explains how to run an example spectral (multi-wavelength) calibration and reconstruction of experimental data. Open nirfast by typing nirfast in matlab (without the quotes). Calibrate the experimental data by selecting Data Calibrate Spectral.

29

For the Homogeneous Mesh, click Browse and nd circle2000 spec.node in NIRFAST/data/circle spec. Do the same for Anomaly Mesh. For Homogeneous Data, browse to homog.paa in NIRFAST/data/circle spec. For Anomaly Data, browse to anom.paa in NIRFAST/data/circle spec. Then click Done.

30

NIRFAST has calibrated the data, and the code is in the NIRFAST window. Notice that the calibrated data has been named data cal and the calibrated mesh has been named mesh cal.

31

Run a reconstruction of the data by selecting Reconstruct Spectral. Use mesh cal as the Input Mesh and data cal as the Input Data. Beside Save Solution To, click the Browse button and select a place to save the output solution of the reconstruction. Use the following values for the reconstruction properties:

32

NIRFAST will run the reconstruction. When it has nished, it will show you the solution at the last iteration.

33

5.5

Fluorescence Reconstruction of Calibrated Experimental Data

This tutorial explains how to run an example uorescence reconstruction of experimental data. Open nirfast by typing nirfast in matlab (without the quotes). Run a reconstruction of the data by selecting Reconstruct Fluorescence.

34

For the Input Mesh, click Browse and nd mouse 48hrpostinjection.node in NIRFAST/data/mouse 48hrpostinjection. For the Input Data, click Browse and nd Calib BH2 mouse 48hrpostinjection.paa in NIRFAST/data/mouse 48hrposti Beside Save Solution To, click the Browse button and select a place to save the output solution of the reconstruction. Use the following values for the reconstruction properties:

35

NIRFAST will run the reconstruction. When it has nished, it will show you the solution at the last iteration.

36

37