MCCL Editing infiles

hayakawa16 edited this page Jun 30, 2017 · 3 revisions

Editing Monte Carlo Command Line infiles

The Monte Carlo Command Line Application download (see Downloads link on right hand side panel) comes bundled with sample input files, infile_xxx.txt, where 'xxx' describes the tissue and detector(s) specified (the source is a collimated point source). These files might not contain the particular source, tissue and detector(s) combination you are interested in, so this page describes how to edit an txt infile for your particular need.

Editing the txt file

Now say you would like an infile that specifies a collimated point source, 2 layer tissue and a reflectance detector that is a function of source-detector separation (rho). The download includes a sample file called infile_one_layer_all_detectors.txt. Lets start with that file because it has the detector already specified and we can easily modify the one layer tissue to two layers.

Open the file with any text editor

Deleting extra detectors

The various detectors are specified in the 'DetectorInputs' section toward the end of the file. Each detector is included within two curly brackets '{' and '}'. The first detector input is for 'AOfRhoAndZ'. At the top of this detector specification, there is a 'Rho' and a 'Z' section defining the range of these independent variables. To delete this detector, delete all text starting with the '{' before the 'Rho' line, and up to and including the final '},' after 'IsNotImplementedYet' : false }'.

Editing the detector bin specifications

To specify the rho bins, The values listed to the right indicate a 'Count' of 101, 'Start' of 0 and 'Stop' of 10. The 'Start' and 'Stop' are in units of mm. Note that these selections specify 100 contiguous rho bins (1 less than 'Count') of size 0.1 mm, with the first bin set to [0, 0.1]mm, second [0.1,0.2]mm, up to the last bin [9.9, 10]mm. Edit these values according to your problem specifications.

Adding a tissue layer

The tissue is specified within the 'TissueInput' section and 'Regions' subsection. You will see 3 'Regions' because this input specifies a one layer tissue with air above and below, i.e. a 3-layer system. In the first 'layer', you will see that its 'ZRange' goes from -INF (negative infinity) to 0 and that it has optical properties of air. Similarly, for the last 'layer', the 'ZRange' goes from 100mm to INF (positive infinity) with optical properties of air. The second 'layer' specifies a tissue layer that is 100mm thick and infinite in the x- and y- axis directions.

We would like a 4-layer system with 2 layers of tissue. So copy the second tissue 'TissueRegionType' including the surrounding '{' '},'. Then paste this copy below it.

Edit the 2nd and 3nd layers' 'RegionOP' (optical properties) and 'ZRange' for the two tissue layers making sure that the 'Stop' value of each layer matches the 'Start' value of the next layer. No editing is required for the 1st and 4th air layers. Note that the default optical properties for the tissue layers are g=0.8, mua=0.01/mm, mus=5/mm, mus'=1/mm and n=1.4.

Specifying the output folder

As a final step, edit the 'OutputName' from 'one_layer_all_detectors' to 'two_layer_ROfRhoAndTime'. This 'OutputName' is used to specify the output folder where the results will reside.

Executing the edited infile

Save the file to say 'infile_two_layer_ROfRhoAndTime.txt' and keep 'N' (the number of photons to launch) set to 100 for now. Open a command line window, 'cd' to the download folder and try executing it with

mc.exe infile=infile_two_layer_ROfRhoAndTime.txt

Refer to Monte Carlo Command line Documentation for other options. We have some validation software in place that will hopefully catch if incorrect inputs are specified.

Viewing the results using Matlab

After the simulation has executed successfully, you can view the results using Matlab. Edit the file 'load_results_script.m' that is part of the download, and modify 'datanames' to be the name of the output folder, 'two_layer_ROfRhoAndTime'. Execute this file in Matlab and a 2D plot of reflectance as a function of rho and time will be shown. Note that these are the results of 100 photons.

So increase N and run again. The choice of an appropriate 'N' is dependent on the optical properties and thickness of the tissue, and the size of the bins (in this case rho and time). You can check the relative error (standard deviation divided by the mean) of the bin results and increase N so that the relative error is less than 0.05 (MCNP manual recommendation). To do this, set 'Options', 'TallySecondMoment' to true in the input file. Then edit the Matlab file 'load_results_script.m' to display 'ROfRhoAndTime.Stdev./ROfRhoAndTime.Mean'.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.