(*********************************************************************** Mathematica-Compatible Notebook This notebook can be used on any computer system with Mathematica 3.0, MathReader 3.0, or any compatible application. The data for the notebook starts with the line of stars above. To get the notebook into a Mathematica-compatible application, do one of the following: * Save the data starting with the line of stars above into a file with a name ending in .nb, then open the file inside the application; * Copy the data starting with the line of stars above to the clipboard, then use the Paste menu command inside the application. Data for notebooks contains only printable 7-bit ASCII and can be sent directly in email or through ftp in text mode. Newlines can be CR, LF or CRLF (Unix, Macintosh or MS-DOS style). NOTE: If you modify the data for this notebook not in a Mathematica- compatible application, you must delete the line below containing the word CacheID, otherwise Mathematica-compatible applications may try to use invalid cache data. For more information on notebooks and Mathematica-compatible applications, contact Wolfram Research: web: http://www.wolfram.com email: info@wolfram.com phone: +1-217-398-0700 (U.S.) Notebook reader applications are available free of charge from Wolfram Research. ***********************************************************************) (*CacheID: 232*) (*NotebookFileLineBreakTest NotebookFileLineBreakTest*) (*NotebookOptionsPosition[ 8691, 206]*) (*NotebookOutlinePosition[ 9339, 229]*) (* CellTagsIndexPosition[ 9295, 225]*) (*WindowFrame->Normal*) Notebook[{ Cell[TextData[{ "This Notebook was written under ", StyleBox["Mathematica", FontSlant->"Italic"], " 3.01 to calculate the total transmission\nand reflection of a stack of an \ arbitrary number of layers of different thickness, absorption\nand scattering \ coefficient as well as scattering anisotropy by Martin Hammer \ (hammer@bach.med.uni-jena.de).\nThe basic algorithm is the Adding-Doubling \ method first described by H.C.van de Hulst (1963, A New Look at\nMultiple \ Scattering. Unnumbered mimeographed report, NASA Institute for Space \ SciencesNew York). \nThis Program follows the description by Scott A. Prahl \ (in: Optical-\nThermal Response of Laser-Irradiated Tissue. ed.:A.J. Welch \ and M.J.C. van Gemert,\nPlenum Press New York, 1995). The Henyey-Greenstein \ function is used as phase function.\nIn this version of the program neither \ internal sources nor \nreflecting layers (i.e. differences of the real part \ of the refractive index of the layers) are\nincluded. In the example given \ here, the optical properties of the ocular fundus at 560 nm \n(Hammer et al., \ Optical properties of ocular fundus tissue..., Phys. Med. Biol. 40 (1995)\n\ pp. 963-978) are used." }], "Text"], Cell[BoxData[{ \(n = 8\ \ \ (*number\ of\ quadrature\ angles*) \), \(Quadrature = 1\ \ \ (*Quadrature\ \(scheme : \ Gaussian\) = 0, \ Radau = 1*) \), \(layers = 4\ \ \ \ \ (*number\ of\ layers\ in\ the\ stack*) \)}], "Input"], Cell[BoxData[ \(<< NumericalMath`GaussianQuadrature`\)], "Input"], Cell[BoxData[ \(\( (*calculation\ of\ the\ quadrature\ angles\ and\ weights*) \n If[Quadrature == 0, G = GaussianQuadratureWeights[n, \ 0, \ 1], { X = N[Solve[ LegendreP[n - 1, x] + \(x - 1\)\/n*Dt[LegendreP[n - 1, x], x] == 0, \ x]], G = Table[{If[i < n, \ 1/2 - 1/2\ Re[x] /. X[\([n - i]\)], 1], 1\/\(2\ \((1 - Re[x])\)\ Dt[LegendreP[n - 1, Re[x]], x]^2\) /. If[i < n, X[\([n - i]\)], x -> \(-1. \)]}, \ {i, n}]}]\)\)], "Input"], Cell[BoxData[ \(<< DiscreteMath`KroneckerDelta`\)], "Input"], Cell[BoxData[{ \(II = Table[KroneckerDelta[i - j]\ , \ {i, n}, \ {j, n}]\), \(EE = Table[KroneckerDelta[i - j]/\((2\ G[\([i, 1]\)]\ G[\([i, 2]\)])\)\ , \ {i, n}, \ {j, n}]\), \(F = Table[KroneckerDelta[i - j]\ \((2\ G[\([i, 1]\)]\ G[\([i, 2]\)])\)\ , \ {i, n}, \ {j, n}]\), \(c = Table[KroneckerDelta[i - j]\ G[\([i, 2]\)]\ , \ {i, n}, \ {j, n}]\)}], "Input"], Cell[BoxData[{ \(\n (* Optical\ properties\ of\ the\ single\ layers\ of\ the\ stack . \n\t\t\tFor\ each\ layer\ one\ entry\ has\ to\ be\ given\ in\ the\ vectors\n\t\t\td, \ \[Mu]s, \ \[Mu]a, \ and\ g . \ The\ first\ elements\ of\ these\ vectors\n\t\t\tbelongs\ to\ the\ first\ layer\ of\ the\ stack\ which\ is\ \n\t\t\texposed\ to\ the \ \(irradiance . \)*) \nd = {0.2, \ 0.01, \ 0.25, \ 0.7}\), \(\[Mu]s = {2.4, \ 144. , \ 46. , \ 70. }\), \(\[Mu]a = {0.11, \ 17. , \ 3.5, \ 0.18}\), \(g = {0.97, \ 0.84, \ 0.945, \ 0.9}\), \(a = \[Mu]s/\((\[Mu]s + \[Mu]a)\)\), \(tau = \((\[Mu]s + \[Mu]a)\)*d\), \(ttau = \((1 - a\ g\^n)\)\ tau\), \(aa = \(a\ \((1 - g\^n)\)\)\/\(1 - a\ g\^n\)\), \(deltatau = ttau\)}], "Input", PageWidth->Infinity], Cell[BoxData[ \(\(m = Table[0, \ {i, layers}]\ (* initialization\ of\ the\ number\ of\ doubling\ steps\ per\ layer*) \)\)], "Input"], Cell[BoxData[ \(\( (*\ Calculation\ of\ the\ optical\ depth\ of\ the\ initial\ layers, \n\tthe\ doubling\ steps\ per\ layer, \ the\ redistribution\ matrices, \ and\ the\ reflection\ and\ transmission\ matrices\ of\ the\ single\ layers*) \n\t For[l = 1, \ l <= layers, \ \(l++\), \n{While[deltatau[\([l]\)] >= G[\([1, 1]\)], {deltatau[\([l]\)] *= 1/2, \ \(m[\([l]\)]++\)}], \n hpp = Table[ \[Sum]\+\(k = 0\)\%\(n - 1\)\((2\ k + 1)\)* \((g[\([l]\)]^k - g[\([l]\)]^n)\)/\((1 - g[\([l]\)]^n)\)* LegendreP[k, G[\([i, 1]\)]]*LegendreP[k, G[\([j, 1]\)]], \ {i, n}, \ {j, n}], \n hpm = Table[ \[Sum]\+\(k = 0\)\%\(n - 1\)\((2\ k + 1)\)* \((g[\([l]\)]^k - g[\([l]\)]^n)\)/\((1 - g[\([l]\)]^n)\)* LegendreP[k, G[\([i, 1]\)]]*LegendreP[k, \(-G[\([j, 1]\)]\)], \ {i, n}, \ {j, n}], \n A = Table[KroneckerDelta[i - j]/G[\([i, 1]\)], \ {i, n}, \ {j, n}] . \((II - aa[\([l]\)]\/2\ hpp . c)\)*deltatau[\([l]\)]/2, \n B = aa[\([l]\)]\/2* Table[KroneckerDelta[i - j]/G[\([i, 1]\)], \ {i, n}, \ {j, n}] . hpm . c*deltatau[\([l]\)]/2, \n GG = Inverse[II + A - B . Inverse[II + A] . B], \n R1 = 2*GG . B . Inverse[II + A], \n R = Table[R1[\([i, j]\)]/\((2\ G[\([j, 1]\)]\ G[\([j, 2]\)])\), \ {i, n}, {j, n}], \nT1 = 2\ GG - II, \n T = Table[T1[\([i, j]\)]/\((2\ G[\([j, 1]\)]\ G[\([j, 2]\)])\), \ {i, n}, {j, n}], \n For[i = 1, \ i <= m[\([l]\)], \ \(i++\), \n \t{R1 = R + T . Inverse[EE - R . F . R] . R . F . T, \n\ \ T1 = T . Inverse[EE - R . F . R] . T, \n\tR = R1, \n\tT = T1}], \n TT[l - 1, l] = \(TT[l, l - 1] = T1\), \n RR[l - 1, l] = \(RR[l, l - 1] = R1\), \n}]\)\)], "Input"], Cell[BoxData[ \(\( (* Calculating\ the\ reflection\ and\ transmission\ matrices\n\t\t\tof\ the \ whole\ stack\ by\ adding\ the\ single\ layers*) \n For[i = 2, \ i <= layers, \ \(i++\), \n \t{RR[i, 0] = RR[i, i - 1] + TT[i - 1, i] . Inverse[EE - RR[i - 1, 0] . F . RR[i - 1, i]] . RR[i - 1, 0] . F . TT[i, i - 1], \n\ \ RR[0, i] = RR[0, i - 1] + TT[i - 1, 0] . Inverse[EE - RR[i - 1, i] . F . RR[i - 1, 0]] . RR[i - 1, i] . F . TT[0, i - 1], \n\t\ TT[i, 0] = TT[i - 1, 0] . Inverse[EE - RR[i - 1, i] . F . RR[i - 1, 0]] . TT[i, i - 1], \n\t\ TT[0, i] = TT[i - 1, i] . Inverse[EE - RR[i - 1, 0] . F . RR[i - 1, i]] . TT[0, i - 1]}]\)\)], "Input"], Cell[BoxData[{ \( (*Calculation\ of\ the\ total\ reflection\ and\ transmission\ of\n \t\t\tthe\ stack\ for\ irradiance\ normal\ to\ the\ surface\ \((Radau - \n\t\t\t\tquadrature)\)\ or\ under\ the\ smallest\ quadrature\ angle\ \n\t\t\t\((Gauss - quadrature)\)*) \nRc = 0\), \(For[i = 1, \ i <= n, \ \(i++\), \ Rc += 2\ G[\([i, 1]\)]\ G[\([i, 2]\)]\ \(RR[0, layers]\)[\([i, n]\)]] \)}], "Input"], Cell[BoxData[ \(Rc\)], "Input"], Cell[BoxData[{ \(Tc = 0\), \(For[i = 1, \ i <= n, \ \(i++\), \ Tc += 2\ G[\([i, 1]\)]\ G[\([i, 2]\)]\ \(TT[layers, 0]\)[\([i, n]\)]] \)}], "Input"], Cell[BoxData[ \(Tc\)], "Input"] }, FrontEndVersion->"Microsoft Windows 3.0", ScreenRectangle->{{0, 800}, {0, 534}}, WindowSize->{772, 458}, WindowMargins->{{2, Automatic}, {Automatic, 2}} ] (*********************************************************************** Cached data follows. If you edit this Notebook file directly, not using Mathematica, you must remove the line containing CacheID at the top of the file. The cache data will then be recreated when you save this file from within Mathematica. ***********************************************************************) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[1709, 49, 1212, 19, 261, "Text"], Cell[2924, 70, 252, 5, 70, "Input"], Cell[3179, 77, 69, 1, 30, "Input"], Cell[3251, 80, 530, 10, 163, "Input"], Cell[3784, 92, 64, 1, 30, "Input"], Cell[3851, 95, 420, 10, 90, "Input"], Cell[4274, 107, 828, 16, 327, "Input"], Cell[5105, 125, 150, 3, 30, "Input"], Cell[5258, 130, 1908, 33, 573, "Input"], Cell[7169, 165, 825, 18, 150, "Input"], Cell[7997, 185, 442, 7, 130, "Input"], Cell[8442, 194, 35, 1, 30, "Input"], Cell[8480, 197, 169, 4, 50, "Input"], Cell[8652, 203, 35, 1, 30, "Input"] } ] *) (*********************************************************************** End of Mathematica Notebook file. ***********************************************************************)