This project has moved and is read-only. For the latest updates, please go here.

Help with command line MC

Apr 25, 2012 at 12:48 AM

Hi Ive downloaded the command line MC but I must admit im a bit lost as to what to do with it.

I sort of see in the XML the various parts (optical properties etc) in the infile_*.* list you provided.  But im not completely sure how to set up my particular case.

Is there a tutorial somewhere I can follow to build up my own infile etc?  Im looking to do two layer slabs in the time domain.

thanks for the help and the codes.

 

Albert

Apr 26, 2012 at 2:35 AM

Hi Albert,

We thought your question might be one that others have too, so we have created a Documentation page describing how to edit the XML files:

http://virtualphotonics.codeplex.com/wikipage?title=Editing%20Monte%20Carlo%20Command%20Line%20infiles

The example given describes how to create a two layer slab with rho- and time-dependent reflectance results.  The resulting infile is a download at the end of the description.

Let me know if the documentation is unclear or if you would like to do something that is not described.

Thanks for your interest in our software!

Carole

Apr 29, 2012 at 2:36 PM
Thanks very much! Ill take a look through it and see if I can make the changes I need.

Albert

--

%*********************************************************************

Albert Cerussi, PhD

Associate Researcher

Beckman Laser Institute and Medical Clinic

University of California, Irvine

dosi.bli.uci.edu

%*********************************************************************




This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.
Apr 29, 2012 at 11:32 PM

OK the instructions were incredibly helpful and I was able to navigate through the example.  Im now running the simulation and it seems to be working.

Ill let you know what happens ...

 

Thanks!

May 2, 2012 at 2:22 AM

acerussi and I have discussed a few things via email/phone and to catch up this discussion, I summarize below:

acerussi is interested in having a Monte Carlo detector that provides R(rho,time) but in addition, provides a sense of the depth penetration.  We discussed trying to capture maximum depth for each photon, but a longer term solution would determine the portion of the total time spent in each layer.  One possible implementation is to define a tissue with subregions (in this case layers) and note the time spent in each subregion for each exiting photon out a rho,time bin.  So ideally it would be a R(rho,time) detector with an additional histogram for each time bin indicating the averaged cumulative time in each subregion. 

David, not sure the best implementation for this.  It might be similar to the detector modification Tyler needs.  In Tyler's case (if I understand it correctly), it would be an R(rho,MT) detector with an additional histogram for each MT bin indicating the averaged cumulative MT in each subregion.  Not sure how to contain both types of information in one detector or if a "sub-detector" histogram is possible.

Carole

May 12, 2012 at 1:30 AM

just and update: im able to run the MC examples and the post on the use of XML file was very helpful.  we are off solving problems now ...

 

For the display the MATLAB function is great to have but when I run it I have no idea what Im looking at ( no labeled axes etc).  Fortunately the MATLAB code is pretty clear to follow (thanks very much) so Im making the changes manually.

 

May 12, 2012 at 1:39 AM

Per your comment, I have updated the matlab 2D plots to have axis labels.  This too is in our repository but hasn't been pushed to codeplex yet.  I'll find out next week when we plan to update codeplex.

May 12, 2012 at 2:50 AM
thanks carole & crew

--

%*********************************************************************

Albert Cerussi, PhD

Associate Researcher

Beckman Laser Institute and Medical Clinic

University of California, Irvine

dosi.bli.uci.edu

%*********************************************************************




This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.
May 15, 2012 at 4:14 AM

Hi Albert,

I just pushed an updated Monte Carlo Command Line application to codeplex here.  This download includes the new detector ReflectedTimeOfRhoAndSubregionHist.  The following pseudo code overviews the processing:

[pseudo code]
for every photon out the surface of the tissue
   determine rho bin it is in, ir
   for every tissue subregion, isr
     determine time spent in subregion and associated time bin, it
     T[ir, isr, it] += 1 // add "1" to rho,subregion,it bin
   endfor
endfor
[end pseudo code]

There is an infile as part of the download called infile_three_layer_ReflectedTimeOfRhoAndSubregionHist.xml which specifies this detector and ROfRhoAndTime within a 5 layer system: air-layer1-layer2-layer3-air.  The associated MATLAB files with the download have also been updated to plot the results of the simulation.  Note that this detector currently puts the tally into the last bin if the tally is beyond that bin (e.g. if rho goes out to 5mm, all photons exiting the tissue beyond that value get their contribution placed in the last rho bin.  So the 2D plots might show the last bin with a lot of contribution.  This allows the integral over rho to be equal to the total diffuse reflectance and also lets you know that you might want to increase Rho.Stop.

Let me know how it goes.

Carole

May 16, 2012 at 7:59 AM
thanks Carole - we will take a look at this.

--

%*********************************************************************

Albert Cerussi, PhD

Associate Researcher

Beckman Laser Institute and Medical Clinic

University of California, Irvine

dosi.bli.uci.edu

%*********************************************************************





This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.
Jun 14, 2012 at 10:48 PM

Hi Albert and Tom,

I ran 1e5 photons for the tissue system we discussed yesterday:

layer 0 : air

layer 1: tissue with thickness [0-5]mm

layer 2: tissue with thickness [5-10]mm

layer 3: tissue with thickness [10-100]mm

layer 4: air

with optical properties in all tissue layers of mua=0.01/mm, mus'=1/mm, g=0.9, n=1.4 and got the plots shown here.  The top left plot is R(rho,time).  The bottom 3 plots are the ReflectedTimeOfRhoAndSubregionHist as described in post dated May 14 pseudo-code.  The top right plot is the fractional time spent in each region, i.e., FractionalTime[ir, isr] = T[ir, isr, it] summed over it / T[ir,isr,it] summed over it and isr.

Let me know if you have any questions or requests to try other parameters or metrics.

Carole

Jun 15, 2012 at 5:54 AM
Carole, thanks a lot. This beginning to make some sense to me; interestingly you can see that for rho~0 there still seems to be a bunch of detected photons that penetrate into region #2. That is going to be important for our new probe design.

It also looks like we have of sort a time domain curve for each region and rho. That should allow us to calculate the time/frequency dependence of the system in each region, correct?



On Thu, Jun 14, 2012 at 2:48 PM, hayakawa <notifications@codeplex.com> wrote:

From: hayakawa

Hi Albert and Tom,

I ran 1e5 photons for the tissue system we discussed yesterday:

layer 0 : air

layer 1: tissue with thickness [0-5]mm

layer 2: tissue with thickness [5-10]mm

layer 3: tissue with thickness [10-100]mm

layer 4: air

with optical properties in all tissue layers of mua=0.01/mm, mus'=1/mm, g=0.9, n=1.4 and got the plots shown here. The top left plot is R(rho,time). The bottom 3 plots are the ReflectedTimeOfRhoAndSubregionHist as described in post dated May 14 pseudo-code. The top right plot is the fractional time spent in each region, i.e., FractionalTime[ir, isr] = T[ir, isr, it] summed over it / T[ir,isr,it] summed over it and isr.

Let me know if you have any questions or requests to try other parameters or metrics.

Carole

Read the full discussion online.

To add a post to this discussion, reply to this email (virtualphotonics@discussions.codeplex.com)

To start a new discussion for this project, email virtualphotonics@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com




--

%*********************************************************************

Albert Cerussi, PhD

Associate Researcher

Beckman Laser Institute and Medical Clinic

University of California, Irvine

dosi.bli.uci.edu

%*********************************************************************




This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.
Jun 15, 2012 at 10:14 PM

Hi Albert,

Before we use any of the results shown on the 2nd row of the figure (lets call them the histogram results), I would like to make sure some aspects of the generation of those plots are clear.  It may be that we still need to make some modifications to the generation of these results so that they provide results that are meaningful.

One point is that they do not sum to R(rho,time).  So for example, If you take a particular rho, say the first rho bin, and look at its associated time results, i.e., the left-most column of the plots, and add the data in that column across the 3 tissue layers, it will not sum to the left-most column of the top left plot of R(rho,time).  There are two reasons for this:

1) the time binning for each region will not map to the total time binning, and

2) the histogram results are counts (+1 is added to the time bin), in R(rho,time) the photon weight is added to the bin.

So in the histogram plots, if a photon spends t1 time in Region 1 and t2 time in Region 2 before exiting rho0, a +1 will be added to Region 1 time bin associated with t1 and a +1 will be added to Region 2 time bin associated with t2.  But for R(rho,time), the time bin associated with t1+t2 is determined and the photon *weight* is added to the bin.

I am currently normalizing the histogram results by the rho ring area and N, the number of photons launched, as is done for R(rho,time) results.  Possibly I shouldn't divide by N in the histogram results because photon weight is not employed.

I am currently using discrete absorption weighting in the simulation that produced these results.  This may mean that I should be using the photon weight somehow in the generation of the histogram results.  Either that or I should use analog processing for now until we understand better how these histogram results should be formulated.  I think I'll switch to analog and see if the relationship between R(rho,time) and the histogram results becomes clearer.

Any comments or suggestions are welcome.

Carole

Jun 15, 2012 at 11:14 PM
yes I think that is fairly clear from our previous discussions that the time bins wont add up to the total detected photon counts. Im not sure yet what the weighting will do but for now just knowing the fractional times in each layer is immensely helpful.

the layered histograms here may "overcount" photons per se because a photon that is detected in the bottom layer will also have been in the top layer. yet your formalism might help get an idea of how much a given layer contributes to the detected signal. this has always been my dilemma with the photon hitting density maps - Im not sure how to quantitatively use them yet as predictions of sensitivity to structures in tissues.

I think it makes sense to try the other methods - the weighting of the signal may be the key to know the true sensitivity and relate contributions of a given layer/region to the total detected signal.

but for now Im pretty happy as this at least gives me an idea of things and insight i didnt have before ...

On Fri, Jun 15, 2012 at 2:14 PM, hayakawa <notifications@codeplex.com> wrote:

From: hayakawa

Hi Albert,

Before we use any of the results shown on the 2nd row of the figure (lets call them the histogram results), I would like to make sure some aspects of the generation of those plots are clear. It may be that we still need to make some modifications to the generation of these results so that they provide results that are meaningful.

One point is that they do not sum to R(rho,time). So for example, If you take a particular rho, say the first rho bin, and look at its associated time results, i.e., the left-most column of the plots, and add the data in that column across the 3 tissue layers, it will not sum to the left-most column of the top left plot of R(rho,time). There are two reasons for this:

1) the time binning for each region will not map to the total time binning, and

2) the histogram results are counts (+1 is added to the time bin), in R(rho,time) the photon weight is added to the bin.

So in the histogram plots, if a photon spends t1 time in Region 1 and t2 time in Region 2 before exiting rho0, a +1 will be added to Region 1 time bin associated with t1 and a +1 will be added to Region 2 time bin associated with t2. But for R(rho,time), the time bin associated with t1+t2 is determined and the photon *weight* is added to the bin.

I am currently normalizing the histogram results by the rho ring area and N, the number of photons launched, as is done for R(rho,time) results. Possibly I shouldn't divide by N in the histogram results because photon weight is not employed.

I am currently using discrete absorption weighting in the simulation that produced these results. This may mean that I should be using the photon weight somehow in the generation of the histogram results. Either that or I should use analog processing for now until we understand better how these histogram results should be formulated. I think I'll switch to analog and see if the relationship between R(rho,time) and the histogram results becomes clearer.

Any comments or suggestions are welcome.

Carole

Read the full discussion online.

To add a post to this discussion, reply to this email (virtualphotonics@discussions.codeplex.com)

To start a new discussion for this project, email virtualphotonics@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on CodePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at CodePlex.com




--

%*********************************************************************

Albert Cerussi, PhD

Associate Researcher

Beckman Laser Institute and Medical Clinic

University of California, Irvine

dosi.bli.uci.edu

%*********************************************************************




This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.
Oct 8, 2012 at 10:44 PM

At M&C on Friday, Sep. 28, we discussed using continuous absorption weighting (CAW) as the weighted contribution to the appropriate rho,subregion,time bin.  I ran the same set-up as described above and get the results here.  This code replaces the +1 tally described above.  I also added a SimulationInputValidation test that checks that CAW is set when specifying this detector.

Albert, let's meet soon to discuss your spectral time-dependent inverse algorithm.

Carole

Oct 13, 2012 at 6:15 PM

Albert, Robert and I met last Thursday.  During that meeting, Albert asked if the results I ran on the previous post could be re-run with increased number of photons and rho out to 12mm.  I ran N=500,000 (takes about 2.5 hours) and the results are here.  

Oct 13, 2012 at 6:43 PM
Just a few general comments from looking at the results here (not meant to be a new work-item for Carole...presumably this is all enabled for the DOSI group at this point).

- Time resolution is pretty grainy and length-scales of time vs space seem imbalanced (not long enough rho to capture spatial variation, too long time to capture curvature). Looks like like the most interesting t-psf changes are happening in the first 100ps. Hard to infer about contributions from various parts of the curve with this discretization.

- Visual comparison of the 2D graphs is difficult, as the scaling appears different for each subregion.

- Inference of quantitative values is difficult, could be enhanced with expectation values for select "mean time in rho bin," "mean rho in time bin" (the former is probably more interesting to the DOSI group).

David
Oct 13, 2012 at 9:23 PM

Good input David.  Yes, the latest MC Command Line download 1.0.8 on codeplex has the CAW update described in post Oct. 1 and associated sample infile.

Albert, if you'd like to re-run with rho and/or time binning changes, I can help you set it up so you can run yourself or I can easily re-run too.  Carole

Oct 13, 2012 at 9:25 PM
that would be great, thanks!

*******************************************
Albert Cerussi, PhD
Director, Diffuse Optical Spectroscopic Imaging (DOSI) Lab
Beckman Laser Institute and Medical Clinic
University of California, Irvine
*******************************************

From: hayakawa [notifications@codeplex.com]
Sent: Saturday, October 13, 2012 1:23 PM
To: Cerussi, Albert
Subject: Re: Help with command line MC [virtualphotonics:353452]

From: hayakawa

Good input David. Yes, the latest MC Command Line download 1.0.8 on codeplex has the CAW update described in post Oct. 1 and associated sample infile.

Albert, if you'd like to re-run with rho and/or time binning changes, I can help you set it up so you can run yourself or I can easily re-run too. Carole




This message contains confidential information and is intended only for the individual named. If you are not the named addressee you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately by e-mail if you have received this e-mail by mistake and delete this e-mail from your system. E-mail transmission cannot be guaranteed to be secure or error-free as information could be intercepted, corrupted, lost, destroyed, arrive late or incomplete, or contain viruses. The sender therefore does not accept liability for any errors or omissions in the contents of this message, which arise as a result of e-mail transmission.
Oct 13, 2012 at 9:34 PM

Regarding David's second point, the plots on same caxis are here.