Web Based MCX

71 views
Skip to first unread message

Kenneth Witte

unread,
Sep 7, 2021, 3:40:36 PM9/7/21
to mcx-users
Dr. Fang,

I use mcxlab and have developed my analysis tools using the output structures from calls like this

[fluxs,detps,vol,seed]=mcxlab(cfg)

How can I convert the .json output from the Web application to the structures I know and sort of love?

Thank you
Ken

Fang, Qianqian

unread,
Sep 7, 2021, 5:43:51 PM9/7/21
to mcx-...@googlegroups.com, Kenneth Witte

hi Ken


the JSON/JNIfTI output (output.json) from MCX Cloud can be loaded to matlab using JSONLab toolbox (see https://github.com/fangq/mcx#volumetric-output)

dat=loadjson('output.json');

the 3/4D array in dat.NIFTIData is the same as flux.data in mcxlab.


currently, MCX Cloud does not yet allow users to download the detps (output_jdet.jdat) file but we are working on this and will enable users to access that output. Once this can be downloaded, you can use loadjson to also load such JSON file to matlab. the field names (data.MCXData.PhotonData) will be similar to detps output of mcxlab, see

https://github.com/fangq/mcx#jdat-files


Qianqian



Thank you
Ken

--
You received this message because you are subscribed to the Google Groups "mcx-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mcx-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mcx-users/ae99d677-c454-4e49-9f59-46552d58b4adn%40googlegroups.com.


Michal B

unread,
Oct 4, 2021, 2:59:08 PM10/4/21
to mcx-users
Dr. Fang,
The MCX-cloud is a real asset. Thanks for making it available to the community.
When do you expect that downloading the detected photons option will be available? 
Thanks, 
Michal

Fang, Qianqian

unread,
Oct 5, 2021, 12:36:33 PM10/5/21
to mcx-...@googlegroups.com, Michal B
hi everyone,

with the below 30-line patch (and a lot of planning), downloading detected photon data is now officially supported in mcxcloud :)


a new button "Download Detected Photon" is added below the "Download Output" button in the Preview tab.

when a simulation is successfully returned from the Run tab, if there were detected photon data output (output_detp.jdat), the button automatically changed to "Click to Retrieve Detected Photon Data", clicking that once, it retrieves the data, and the button becomes "Click to Save Detected Photon Data", click again, it saves the data as output_detp.json (.jdat file is the same as .json). A screenshot is attached.

You can handle the json file the same way as you did for the .jdat file, see instructions here


if the simulation does not have detectors, the button will gray out.

let me know if you see any problem.

cheers!

Qianqian
mcxcloud_detphoton.png

Michal B

unread,
Oct 6, 2021, 12:09:39 PM10/6/21
to mcx-users
Dr. Fang,
Thank you for the valuable addition, and for the quick reply.
I played with it a bit today and noticed that I had to refresh the browser for every change in the configuration. Otherwise, the output_detp.json file was not updated between runs. 
In addition, is it possible to place detectors inside the "tissue"? or only on the edges? when I tried placing a detector "inside" the shape, I didn't get any photons "reaching" that detector. 
Thanks again for all the tremendous work, 
Michal

Qianqian Fang

unread,
Oct 6, 2021, 12:49:38 PM10/6/21
to mcx-...@googlegroups.com, Michal B
On 10/6/21 12:09 PM, Michal B wrote:
Dr. Fang,
Thank you for the valuable addition, and for the quick reply.
I played with it a bit today and noticed that I had to refresh the browser for every change in the configuration. Otherwise, the output_detp.json file was not updated between runs.


should be solved now, see the below patch and refresh your page

https://github.com/fangq/mcx/commit/ae9216de1800bdf3067df696612d670939089807


In addition, is it possible to place detectors inside the "tissue"? or only on the edges? when I tried placing a detector "inside" the shape, I didn't get any photons "reaching" that detector.


no, mcx can't detected photons if it will continue propagating - otherwise, it can result in multiple detection, which does not make sense.

if your detector is indeed inside the domain, you must add at least a layer of zero-valued voxels along the detector aperture (as a 1-voxel wide cavity) so that photons will be terminated when it hits the zero-valued voxels.

let me know if this makes sense (or suggest better ways to handle this).


Qianqian


Reply all
Reply to author
Forward
0 new messages