AndrewWAlexander / Pinnacle-tar-DICOM

Converting Pinnacle tar files to DICOM files
MIT License
23 stars 14 forks source link

MU Determination for Motorized Wedge / Mixed Models #14

Open lswootton opened 4 years ago

lswootton commented 4 years ago

The CollimatorOutputFactor extracted from the plan.Trial file for the MU calculation is incorrect in the plan.Trial file and will result in wrong MU for beams with mixed models (e.g. motorized wedges with one open and one wedged segment, or interpolated beam models). As such the MU calculation at present is invalid for these cases. No workaround currently apparent.

crcrewso commented 4 years ago

It would be amazing if you please post one example of the description in the plan.Trial file, the expected output factor, and the calculated output factor. I'd be happy to figure out how to patch the library at some point in the not to distant future.

lswootton commented 4 years ago

image

Here's an example of an IMRT beam where the MU calculated using the formula provided in the window by Pinnacle (and the one being used by this project) results in an MU that is ~20% different the actual MU in Pinnacle (536.9 MU calculated vs 649.7 actual). The plan.Trial file has the same values as this window and the resulting calculation is also incorrect.

Here's an example for a beam with a motorized wedge with the same problem:

image

In this case it seems if you replace OFc with wedged OFc you get the right number of MU, even though the beam is a mixture of open/wedged field. You can see the wedged OFc by clicking 'View Output Factor Table...'. I haven't found this data in the files in the machine/patient database yet although presumably it's somewhere.

image

image

lswootton commented 4 years ago

...which in this case (the second calculation for the wedged field), the interpolated wedged OFc is 0.78436, accidentally cut that bit of data off in the screenshot.

crcrewso commented 4 years ago

That's a great amount of detail. I cannot guarantee I'll be able to find the bug quickly but It's now on my ToDo list!

pchlap commented 4 years ago

Hi @lswootton

I have been porting a lot of this code into the pymedphys library: https://github.com/pymedphys/pymedphys/tree/master/pymedphys/labs/pinnacle

One thing we actually changed was how the MU is calculated. We could never get the dose grid output completely accurate (compared to the RTDOSE exported in Pinnacle) so the approach we took was to compute the MU based on the value at the prescription point. This solved the issues we were having and I think it would also solve the issue you described above (since we don't even need the CollimatorOutputFactor to do this).

I made a command line interface for this tool so you should be able to give it a try pretty easily (https://docs.pymedphys.com/ref/cli/pinnacle.html). I'm curious to hear how it goes.

Phil