Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

get absorbed energy by object #205

Closed
PyMarc2 opened this issue Feb 13, 2024 · 8 comments
Closed

get absorbed energy by object #205

PyMarc2 opened this issue Feb 13, 2024 · 8 comments

Comments

@PyMarc2
Copy link

PyMarc2 commented Feb 13, 2024

Feature Request

I have a simple simulation with 3 layers as boxes. I would like to get the total absorbed energy by each object (in this case for each box).
Is there a simple way to acheive this ? I added the input file in attachements (Change the extension to .mcxp to loadit in MCXStudio.
Thank you!

myproject_1.json

MCXStudio Nigthly Build 2024-02-12 06:55
Window 11
NVIDIA GTX 1080 3GB

@fangq
Copy link
Owner

fangq commented Feb 13, 2024

@PyMarc2, you can set the outputtype to 'energy' and sum the values in the output array for each label mask.

@fangq fangq closed this as completed Feb 13, 2024
@PyMarc2
Copy link
Author

PyMarc2 commented Feb 14, 2024

@fangq

I get this error when outputting in ASCII or BIN in MCX, and MCX-CL
MCXCL ERROR(-2):the specified output data type is not recognized in unit mcx_utils.c:4108

The other output types all work but seem unintelligeable from a human standpoint.

@fangq
Copy link
Owner

fangq commented Feb 14, 2024

mcx/mcxcl has --outputtype and --outputformat. it sounds like you set --outputformat instead of --outputtype that I suggested above. can you confirm?

please see the accepted options in the command line

https://github.com/fangq/mcx/blob/v2023/src/mcx_utils.c#L5133-L5137
https://github.com/fangq/mcx/blob/v2023/src/mcx_utils.c#L5163-L5169

in the command line, you set -O E. in the JSON file, you set Session.OutputFormat key to "energy"; in mcxlab, you set cfg.outputtype to 'energy'

for the proper flags to use, see
https://github.com/fangq/mcx/blob/v2023/doc/mcx_command_option_cheatsheet.xlsx

@PyMarc2
Copy link
Author

PyMarc2 commented Feb 14, 2024

Thank you for your swift answer!
However, I must precise my question.

My question is
How do I get the output arrays.

I thought I had to set the output format to ascii to be able to read the arrays by eye, or with a python script.

What I did
I use the compiled MCXStudio version.

First parameters
Output Type: E- energy density
Output Format: nii

image

When the simulation is run:

mcxcl --session 1 --input C:\Users\marc-\MCXOutput\mcxclsessions\1\1.json --root C:\Users\marc-\MCXOutput\mcxclsessions\1 --outputformat nii --gpu 10000000 --autopilot 1 --photon 1000000 --normalize 1 --save2pt 1 --reflect 1 --savedet 0 --unitinmm 1,00 --seed 1648335518 --atomic 1 --specular 0 --array 0 --dumpmask 0 --repeat 1

This works and outputs the correct file.

Second parameters
Output Type: E- energy density
Output Format: ascii
image

This is the terminal output:

mcxcl --session 1 --input C:\Users\marc-\MCXOutput\mcxclsessions\1\1.json --root C:\Users\marc-\MCXOutput\mcxclsessions\1 --outputformat ascii --gpu 10000000 --autopilot 1 --photon 1000000 --normalize 1 --save2pt 1 --reflect 1 --savedet 0 --unitinmm 1,00 --seed 1648335518 --atomic 1 --specular 0 --array 0 --dumpmask 0 --repeat 1
EXEPATH=C:\ProgramData\MCXStudio\MCXSuite\mcxcl\bin\mcxcl.exe
EXEPATH=C:\ProgramData\MCXStudio\MCXSuite\mcxcl\bin\mcxcl.exe
"-- Executing Simulation --"
"-- Task completed --"


MCXCL ERROR(-2):the specified output data type is not recognized in unit mcx_utils.c:4108

The error is the same with MCX.

** Finally **
Maybe there is another way of getting the output arrays that I am not aware of.

@fangq
Copy link
Owner

fangq commented Feb 14, 2024

bin and ascii are only valid output formats if you run mmc. see
https://github.com/fangq/mmc/blob/v2023/src/mmc_utils.c#L3094

if you use mcx or mcxcl, they are not supported. please use the recommended jnii or nii format.

https://github.com/fangq/mcx?tab=readme-ov-file#volumetric-output

was there a particular reason you don't want to use nii or jnii?

@PyMarc2
Copy link
Author

PyMarc2 commented Feb 14, 2024

Oh! Okay!

No, I just naively wanted the ASCII since I thought it would be more direct/fast to do.
I did not notice the section in the readme about the jnii format, that looks interesting.

Thank you for taking the time to point it out. I'll use this format since its aim seem to be focused at being easy to use and generic. Thank you for the jnii initiative, it looks interesting.

Marc

@PyMarc2
Copy link
Author

PyMarc2 commented Feb 16, 2024

@fangq
Sorry for the question, but how are the layers labelled?
I have 3 boxes with different materials.
In the output jnii file, I cannot see any label.
The NIFTIData field seem to be populated with the voxel data.

Is there any documentation that teach me how to do so? I couldn't find anything that explain in details.

@PyMarc2
Copy link
Author

PyMarc2 commented Feb 21, 2024

Hello @fangq

Still couldn't find a way to add labels to the output array.
Any help would appreciated.

I considered manually remembering the indices of the objects I create.
But in the case of spherical shells, I think it would be much easier if there is a label mask.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants