pymedphys / pymedphys

A community effort to develop an open standard library for Medical Physics in Python. Building quality transparent software together via peer review and open source distribution. Open code is better science.
https://docs.pymedphys.com
Apache License 2.0
296 stars 71 forks source link

export pinnacle plan mlc boundaries is wrong #1809

Open KeoJam opened 11 months ago

KeoJam commented 11 months ago

hi,when i use pymedphys._experimental.pinnacle to export the pinnacleplan, i find the LeafPositionBoundaries is write by code in rtplan.py from -200 to 200 ,it is a 60 pairs mlc,but my linac in the pinnacle ,mlc just 40 pairs. i find the linac config in store in plan.Pinnacle.Machines. why not to read the real mlc boundaries from plan.Pinnacle.Machines file? in plan.Pinnacle.Machines file has info like: MultiLeaf ={ LeafPairList ={ MLCLeafPair ={ YCenterPosition = -19.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 16.4; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -18.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 17.5; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -17.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 18.4; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -16.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 19.5; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -15.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -14.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -13.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -12.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -11.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -10.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -9.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -8.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -7.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -6.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -5.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -4.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -3.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -2.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -1.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = -0.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 0.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 1.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 2.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 3.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 4.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 5.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 6.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 7.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 8.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 9.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 10.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 11.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 12.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 13.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 14.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 15.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 20; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 16.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 19.5; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 17.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 18.4; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 18.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 17.5; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; MLCLeafPair ={ YCenterPosition = 19.5; NegateLeafCoordinate = 0; Width = 1; MinTipPosition = -12.5; MaxTipPosition = 16.4; SideLeakageWidth = 0.1; TipLeakageWidth = 0.1; }; };

pchlap commented 11 months ago

Hi @KeoJam, the PinnaclePlan export is known to have some issues with it (this is displayed in a warning message when you run the tool). For our use case we didn't need the plan exported (we are running data mining projects using only the structures and dose) so there wasn't any need to correct these problems with the plan file.

If there is someone who would pick up this task to work on solving the plan module export issues that would be fantastic. But unfortunately this isn't something we have the capacity for.

KeoJam commented 10 months ago

Hi @pchlap i have fixed the problem by myself. Here is the code,if you need , you can merge it to the project. And i also solved the ds.dosegridscaling length is to long.usually it's length is 11. code for rtplan&rtdose.zip

crcrewso commented 10 months ago

I'll take a look this weekend and put together the pull request.

pchlap commented 10 months ago

Thanks for your efforts here @KeoJam and @crcrewso! Much appreciated.

crcrewso commented 10 months ago

@KeoJam One question came up when reviewing the code, what issue is solved by removing the rounding of DoseGridScaling?