Git Product home page Git Product logo

pytg43's Introduction

pyTG43

pyTG43 uses user-defined source specification data as well as TPS-defined dwell positions and times to calculate dose at a specific point using the 2D formalism outlined in AAPM TG-43.

pyTG43 has only been tested on files from Eclipse treatment planning systems. No warranty or support is provided.

Installation

git clone https://github.com/livingag/pyTG43.git
cd pyTG43
python setup.py install

Calculation details

The co-ordinate system used by the software is IEC 61217, which is used by most planning systems. Keep in mind this is different from the DICOM co-ordinate system.

Dwell point co-ordinates and times are extracted from the DICOM plan file, along with the applicator structures from the DICOM structure set file.

For each dwell point, the orientation of the line source is determined by the vector of the two nearest points of the applicator structure for that dwell point. The relevant angles and distances required by the TG-43 formalism are then easily determined through vector calculus.

Rotated data sets

For DVH calculation of rotated co-ordinate systems (e.g. when planning on rotated/manipulated CT datasets), the co-ordinates of the structures are transformed into an intermediate co-ordinate system so that dose data can be easily collected from the calculation grid.

Source specification data

All source specification data can be downloaded in spreadsheet form from the ESTRO website. Just specify the directory in which you have placed the HDR and/or PDR spreadsheets, and pyTG43 will extract the relevant data.

Example calculations

Point dose comparison

Examples are provided for both HDR and PDR treatment plans, and can be run using python examples.py

$ python examples.py
----------------------------------------
 Eclipse (HDR)
----------------------------------------
┌───────────┬───────┬───────┬──────┬──────────┬───────────┬──────────┐
│ Name      │ X     │ Y     │ Z    │ TPS (Gy) │ Calc (Gy) │ Diff (%) │
├───────────┼───────┼───────┼──────┼──────────┼───────────┼──────────┤
│ PtA_left  │ 1.91  │ -1.25 │ 2.28 │ 6.002    │ 5.998     │ 0.066    │
│ PtA_right │ -2.09 │ -1.25 │ 2.11 │ 6.136    │ 6.132     │ 0.065    │
└───────────┴───────┴───────┴──────┴──────────┴───────────┴──────────┘
----------------------------------------
 Eclipse (PDR)
----------------------------------------
┌────────────┬───────┬────────┬────────┬──────────┬───────────┬──────────┐
│ Name       │ X     │ Y      │ Z      │ TPS (Gy) │ Calc (Gy) │ Diff (%) │
├────────────┼───────┼────────┼────────┼──────────┼───────────┼──────────┤
│ PT A RIGHT │ -4.60 │ -17.25 │ -54.81 │ 22.537   │ 22.571    │ -0.151   │
│ PT A LEFT  │ -0.62 │ -17.30 │ -54.72 │ 23.173   │ 23.178    │ -0.024   │
└────────────┴───────┴────────┴────────┴──────────┴───────────┴──────────┘

DVH calculation

An example PDR plan DVH comparison can be run using python dvhcomp.py

$ python dvhcomp.py

PDR DVH Comparison

pytg43's People

Contributors

livingag avatar danielsbridges avatar samuelpeet avatar

Stargazers

 avatar  avatar  avatar Yogaraja D avatar hujinyan avatar Rafe McBeth avatar Hongdong Liu avatar Michael Kudla  avatar  avatar  avatar  avatar Simon Biggs avatar

Watchers

 avatar KevinHe avatar  avatar  avatar

pytg43's Issues

plt.show()

I needed to add plt.show() to the end of the dvhcomp.py file to see the final dvh curves (based on the most recent push)
may be worth adding in. Thanks for all your work!!!

Using Oncentra Prostate plan

Hi
I've been trying to use an Oncentra prostate patient plan and structure file for a HDR treatment. The plans I am using are completed on the Oncentra Prostate treatment planning program. However, I am running into an error potentially related to some of DICOM tags being used that are specific to Oncentra Brachytherapy system.

The initial error I was getting indicated the "app" variable is refrenced before the assignment, but I think its related to the fact that some of the Tags such as [0x300F,0x1000] is not present in the plan or structure files when using Oncentra Prostate.

I was wondering if there is a solution to allow for the plans created in Oncentra prostate to function, or what could be the potential cause of the errors?

If you have any advice or need anthing more from me to better understand the problem, let me know.

Thanks

Error with matplotlib when installing through Anaconda Prompt

Executing python setup.py install in the Anaconda Prompt, everything appeared to be working until it began searching for matplotlib:

Installed c:\programdata\anaconda3\envs\medphys\lib\site-packages\pytg43-0.3.0-py3.7.egg
Processing dependencies for pyTG43==0.3.0
Searching for matplotlib==2.2.0+601.g197bb59
Reading https://pypi.org/simple/matplotlib/
No local packages or working download links found for matplotlib==2.2.0+601.g197bb59
error: Could not find suitable distribution for Requirement.parse('matplotlib==2.2.0+601.g197bb59')

conda install matplotlib installed pkgs/main/win-64::matplotlib-3.1.3-py37_0 and pkgs/main/win-64::matplotlib-base-3.1.3-py37h64f37c6_0 among other packages, but does pyTG43 require the deprecated 2.2.0 version of matplotlib? Can this be updated?

Handling holes in structures incorrectly

Holes aren't treated as holes and are included in the DVH calculation.

Also incorrectly handling multiple shapes on the same slice (essentially "connects" them and includes points between them in the DVH calculation.

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.