Code Monkey home page Code Monkey logo

moquimc's Introduction

MOnte carlo code for QUIck proton dose calculation (moqui)

Installation

Requirements

  • GDCM > 2
    • Please refer to GDCM v2 installation guide
    • You can also install GDCM v3 using package manager
  • CUDA
  • The code has been tested with GDCM v2 and CUDA v10.2 on Ubuntu 20.04
  • The code has been tested with GDCM v3 and CUDA v11.8 on Ubuntu 22.04

Obtaining the code

$ git clone https://github.com/mghro/moquimc.git

Compile the phantom case

$ cd moquimc/tests/mc/phantom
$ cmake .
$ make
  • You may need to modify the CUDA configuration on the CMakeList.txt
  • The default is to use CUDA compute capability 7.5

Running the phantom example

$ python create_phantom.py # create water phantom
$ ./phantom_env --lxyz 100 100 350 --pxyz 0.0 0.0 -175 --nxyz 200 200 350 --spot_energy 200.0 0.0 --spot_position 0 0 0.5 --spot_size 30.0 30.0 --histories 100000 --phantom_path ./water_phantom.raw --output_prefix ./ --gpu_id 0 > ./log.out

Update Dec/26/2023

  • There have been large updates in moqui and we added new features
    • Statistical uncertainty based stopping criteria (Please refer to the example input parameter Statistical stopping criteria)
    • Robust options (setup errors and density scaling, Please refer to the example input parameter Robust options)
    • Aperture handling
    • Support multiple calibration curves (You can override machine selection and define multiple calibration curves for a machine)
    • Unit weights per spot for Dij calculation (This only works for Dij scorer. The UnitWeight will be the absolute number of particles simulated)

Getting calibration curves

  • moqui uses fitted functions for calibration curves
  • You need to obtain stopping power ratio to water and radiation length per density and define compute_rsp_ and compute_rl_ functions in patient_material_t
  • To obtain the curves:
    1. Obtain material information using TOPAS
    2. Calculate correction factors for desired SPR curve
    3. Calculate fitting curves and implement them in moqui
    4. You can refer to the fit_rsp.py for the curve fitting
  • You can find the TOPAS extensions and example parameter file under treatment_machines/TOPAS
  • These are updated version of the HU extension in TOPAS (https://github.com/topasmc/extensions/tree/master/HU)

Authors

Hoyeon Lee ([email protected])
Jungwook Shin
Joost M. Verburg
Mislav Bobić
Brian Winey
Jan Schuemann
Harald Paganetti

Acknowledgements

This work is supported by NIH/NCI R01 234210 "Fast Individualized Delivery Adaptation in Proton Therapy"

moquimc's People

Contributors

leehoy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

moquimc's Issues

too many resources requested for launch

Hello
Running the example shows the following error on an NVIDIA V100 GPU. The CUDA compiler is 11.7, from NVHPC SDK. Do you have some suggestions ? Thanks.

# of arguments: 31
--lxyz : 100 100 350
--pxyz : 0.0 0.0 -175
--nxyz : 200 200 350
--spot_energy : 200.0 0.0
--spot_position : 0 0 0.5
--spot_size : 30.0 30.0
--histories : 100000
--phantom_path : ./water_phantom.raw
--output_prefix : ./
--gpu_id : 0
./
...
...
From phantom: (0, 0, 0): 0.000000
Initialization for geometry done 667.443308 ms
num spots 1
h0 0 h1 100000 28
Vertices total memory 32508 MB Free memory 31830 MB
Scorer offset total memory 32508 MB Free memory 31830 MB
After thread init total memory 32508 MB Free memory 31824 MB
blocks 197 threads 512
After run total memory 32508 MB Free memory 27530 MB
CUDA error (transport particle table): too many resources requested for launch

Bug on base/mqi_treatment_machine_pbs.hpp

Hi! Thank you for your incredible work!

I found a bug in the general PBS treatment machine class (base/mqi_treatment_machine_pbs.hpp). I provided the machine parameter from an input file and I obtained random beam positions. In the PBS definition line 105 was missing the assignment of the treatment_machine_ion::SAD

The following is my version of the corrected code.

Best, Giorgio Cartechini

pbs(const std::string filename) : cm2mm(10.0), mm2cm(0.0) {
    this->load_beamdata(filename);
    if (geometry_spec_.SAD[0] == 0)
        treatment_machine_ion<T>::SAD_[0] = std::numeric_limits<T>::infinity();
    else 
        treatment_machine_ion<T>::SAD_[0] = geometry_spec_.SAD[0];
        
    if (geometry_spec_.SAD[1] == 0)
        treatment_machine_ion<T>::SAD_[1] = std::numeric_limits<T>::infinity();
    else
        treatment_machine_ion<T>::SAD_[1] = geometry_spec_.SAD[1];
}

How is it implemented?

Hello,

First of all, many thanks for your outstanding work on the GPU MC for the quick proton dose calculation. I would love to use it to our clinical beamline at the University of Kansas Medical Center and do some other further research on this codes. I do have a few questions, though:

  1. I have completed the testing program for the water phantom. Now I want to use the codes for the CT dicom data and plan dicom data generated by our own system, both generated by RayStation. But there are obvious issues with the output results: firstly, the raw output cannot see my original CT image, and secondly, the output cannot see the dose. I would like to know how to use this code if I want to obtain the CT results with a dose as mentioned in your paper.
    Let me first explain my current approach: the main program I am using now is "tps" in the test file. The following is my input file, both CT and plan are exported from RayStation.
    图片
    By modifying the program, my “treatment machine” selected "pbs" and used the read file operation in the code to define the parameters of the "pbs" system. Below is my parameter file. Finally, there is the result graph I ran.
    图片
    图片
    I would like to know if there are any problems with my above approach and if there are any areas in the code that need to be modified or read from files?

  2. Due to the ”1.“ can't achieve good results, I chose to use the test data from the "dicom-interface" project mentioned in your article (Abdomen-1. dicom, 2. dicom, 3. dicom, rtip demo. dicom). But i found that "block(aperture)" is used in this plan, but the "block" section displayed in this code is "todo". If I want this code to be used for plans with blocks, do I need to define the block section myself? Is the test data in the "dicom-interface" project mentioned above not applicable to this code?

  3. Is the "range shift" in this code need to define parameters? As I saw in your paper that "The H&N plan has a range shift made of Lucite with density 1.191 g cm-3".

  4. In the definition file of "treatment machine", do I need to provide parameters for each energy in order to fully run the program, as shown in the following figure? I am not sure about all the energy parameters of my system at present, and is this writing the reason why it is unable to output normal results. Now I just want to preliminarily test the feasibility. Do I need all the energy parameters here to obtain the results mentioned in your paper? Is it feasible to customize some parameters?
    图片

  5. Based on your code, we would like to add a material at the output of the beam to simulate our research requirements. Can I use a method similar to "range shift" to define my type and use it in "beamline" to achieve my requirements?

I'm sorry that these are so many questions, but I would really love to use your GPU MC code to do some research. I really appreciate your work, and would be happy if you could support me.

Best,

Aoxiang

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.