dicompyler / dicompyler-core

A library of core radiation therapy modules for DICOM RT used by dicompyler
https://dicompyler-core.readthedocs.io
Other
146 stars 68 forks source link

Dose Grid Comparison #8

Open robmarkcole opened 7 years ago

robmarkcole commented 7 years ago

I have loaded data from a single plan which has been calculated with AAA and again with AXB. Since it is the same plan I expect the dose grid size to be identical. However I have found that the grid shape and scaling is different. How could this be? Is there a way to check the dicom files to see these factors? Cheers Robin

image

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/38300141-dose-grid-comparison?utm_campaign=plugin&utm_content=tracker%2F30933069&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F30933069&utm_medium=issues&utm_source=github).
robmarkcole commented 7 years ago

I found a workaround, my working is on https://github.com/robmarkcole/Useful-python-for-medical-physics/blob/master/Experiments%20in%20ipython%20notebooks/dicompyler-core%20experiments/AXB%20project/Lung%20plan%2030%20exported%2011-10-2016/Case_30%20explore%2011-10-2016.ipynb

bastula commented 7 years ago

Great that you found a workaround. I poked around in your notebook and resizing the image is one way to achieve the desired result.

Another way that can work is resizing the whole dose grid to match via interpolation. You can see that approach here: https://github.com/dicompyler/dicompyler-plugins/blob/master/plugins/plansum/plansum.py

Although it is more complicated, it might produce a more consistent result.

Also to answer your original question, you can look into the the Image Position Patient tag as well as the Pixel Spacing tag to see what the discrepancies are. It's most likely due to the way that AXB might score voxels leading to 1 more row (or column) than AAA.

robmarkcole commented 7 years ago

Great for completeness here are those tags.

image

Interestingly when I try the plansum plugin with these images I get an error, since the SeriesInstanceUID do not match in both. Cheers

robmarkcole commented 7 years ago

Adapting the function in plansum for my purpose has been successful, and I have modified it to calculate the dose difference. Next step, gamma analysis. Cheers

https://github.com/robmarkcole/Useful-python-for-medical-physics/blob/master/Experiments%20in%20ipython%20notebooks/dicompyler-core%20experiments/AXB%20project/Lung%20plan%2030%20exported%2011-10-2016/Case_30%20Lung%20PTV%2012-10-2016.ipynb

bastula commented 7 years ago

Wow that is great! I am glad you were able to repurpose the code!

It would be interesting to roll this code back into dicompyler-core somehow. Maybe a new module for dose grid comparison?

robmarkcole commented 7 years ago

Happy to contribute a module once everything is working well :-) I still have an issue with the resized image, not sure why it appears blocky, see below. Perhaps using scipy would produce a better result? e.g. https://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html#two-dimensional-spline-representation-procedural-bisplrep

image

Latest code on https://github.com/robmarkcole/Useful-python-for-medical-physics/blob/master/Experiments%20in%20ipython%20notebooks/dicompyler-core%20experiments/AXB%20project/Lung%20plan%2030%20exported%2011-10-2016/Case_30%20Lung%20PTV%2013-10-2016.ipynb

robmarkcole commented 7 years ago

Made some more progress, and have 3d gamma working too, although with a slight fudge on the array size for the time being.. Cheers

https://github.com/robmarkcole/Useful-python-for-medical-physics/blob/master/Experiments%20in%20ipython%20notebooks/dicompyler-core%20experiments/AXB%20project/Lung%20plan%2030%20exported%2011-10-2016/Case_30%20Lung%20PTV%2026-10-2016.ipynb

robmarkcole commented 7 years ago

image

bastula commented 7 years ago

Wow that is great! We'll have to see how to integrate this.

cutright commented 3 years ago

Maybe now that we've added dose.py we can revisit this?