VarianAPIs / Varian-Code-Samples

Code samples for ESAPI and other Varian APIs and web services.
MIT License
118 stars 107 forks source link

CreateVerificationPlan.cs controlpoints #31

Open LDClark opened 5 years ago

LDClark commented 5 years ago

Hello,

I was running CreateVerificationPlan.cs, and for a RapidArc plan I am noticing that the Gantry Rtn, Dose Rate, GantrySpeed, and MU/deg are slightly different than a manually generated plan. The start and stop angles, and the number of controlpoints are the same though. The code I am using is below. What am I doing wrong to make a discrepancy?

Thanks, Landon

            var collimatorAngle = getCollimatorAndGantryFromBeam ? originalBeam.ControlPoints.First().CollimatorAngle : 0.0;
            var gantryAngleStart = getCollimatorAndGantryFromBeam ? originalBeam.ControlPoints.First().GantryAngle : 0.0;
            var gantryAngleEnd = getCollimatorAndGantryFromBeam ? originalBeam.ControlPoints.Last().GantryAngle : 0.0;
            var gantryDirection = originalBeam.GantryDirection;
            var couchAngle = 0.0;
            var metersetWeights = originalBeam.ControlPoints.Select(cp => cp.MetersetWeight);
            var beamWeight = originalBeam.WeightFactor;
            var beam = plan.AddVMATBeam(MachineParameters, metersetWeights, collimatorAngle, gantryAngleStart,
                gantryAngleEnd, gantryDirection, couchAngle, isocenter);
            // Copy control points from the original beam.
            var editableParams = beam.GetEditableParameters();
            for (var i = 0; i < editableParams.ControlPoints.Count(); i++)
            {
                editableParams.ControlPoints.ElementAt(i).LeafPositions = originalBeam.ControlPoints.ElementAt(i).LeafPositions;
                editableParams.ControlPoints.ElementAt(i).JawPositions = originalBeam.ControlPoints.ElementAt(i).JawPositions;                                        
            }
            editableParams.WeightFactor = originalBeam.WeightFactor;
            beam.ApplyParameters(editableParams);
            return beam.Id;

Manually generated: Index Meterset Weight Gantry Rtn [deg] Dose Rate [MU/min] Gantry Speed [deg/s] MU/deg 1 0.0000 179.0
2 0.0025 178.0 600.000 3.223 3.102 3 0.0076 175.9 600.000 3.223 3.102 4 0.0126 173.9 600.000 3.223 3.102 5 0.0177 171.9 600.000 3.223 3.102 6 0.0227 169.8 600.000 3.223 3.102 7 0.0277 167.8 600.000 3.249 3.078 8 0.0327 165.8 600.000 3.249 3.078 9 0.0377 163.7 600.000 3.249 3.078 10 0.0427 161.7 600.000 3.249 3.078 11 0.0486 159.7 600.000 2.793 3.580 12 0.0544 157.6 600.000 2.793 3.580 13 0.0602 155.6 600.000 2.793 3.580 14 0.0660 153.6 600.000 2.793 3.580 15 0.0719 151.5 600.000 2.793 3.580 16 0.0777 149.5 600.000 2.793 3.580 17 0.0835 147.5 600.000 2.793 3.580 18 0.0893 145.4 600.000 2.793 3.580 19 0.0942 143.4 600.000 3.361 2.976 20 0.0990 141.4 600.000 3.361 2.976 21 0.1039 139.3 600.000 3.361 2.976 22 0.1087 137.3 600.000 3.361 2.976 23 0.1135 135.3 600.000 3.361 2.976 24 0.1184 133.2 600.000 3.361 2.976 25 0.1232 131.2 600.000 3.361 2.976 26 0.1281 129.2 600.000 3.361 2.976 27 0.1333 127.1 600.000 3.113 3.212 28 0.1385 125.1 600.000 3.113 3.212 29 0.1437 123.1 600.000 3.113 3.212 30 0.1490 121.0 600.000 3.113 3.212 31 0.1547 119.0 600.000 2.860 3.497 32 0.1603 117.0 600.000 2.860 3.497 33 0.1660 114.9 600.000 2.860 3.497 34 0.1715 112.9 600.000 2.976 3.360 35 0.1761 110.9 600.000 3.566 2.804 36 0.1806 108.8 600.000 3.566 2.804 37 0.1852 106.8 600.000 3.566 2.804 38 0.1897 104.8 600.000 3.566 2.804 39 0.1943 102.7 600.000 3.566 2.804 40 0.1989 100.7 600.000 3.566 2.804 41 0.2034 98.7 600.000 3.566 2.804 42 0.2080 96.6 600.000 3.566 2.804 43 0.2125 94.6 600.000 3.629 2.755 44 0.2170 92.6 600.000 3.629 2.755 45 0.2214 90.5 600.000 3.629 2.755 46 0.2259 88.5 600.000 3.629 2.755 47 0.2302 86.4 600.000 3.836 2.607 48 0.2344 84.4 600.000 3.836 2.607 49 0.2386 82.4 600.000 3.836 2.607 50 0.2436 80.3 600.000 3.280 3.048 51 0.2498 78.3 600.000 2.606 3.837 52 0.2567 76.3 600.000 2.359 4.239 53 0.2636 74.2 600.000 2.359 4.239 54 0.2705 72.2 600.000 2.359 4.239 55 0.2774 70.2 600.000 2.359 4.239 56 0.2843 68.1 600.000 2.359 4.239 57 0.2912 66.1 600.000 2.359 4.239 58 0.2981 64.1 600.000 2.359 4.239 59 0.3046 62.0 600.000 2.523 3.964 60 0.3110 60.0 600.000 2.523 3.964 61 0.3175 58.0 600.000 2.523 3.964 62 0.3239 55.9 600.000 2.523 3.964 63 0.3305 53.9 600.000 2.488 4.020 64 0.3370 51.9 600.000 2.488 4.020 65 0.3435 49.8 600.000 2.488 4.020 66 0.3498 47.8 600.000 2.589 3.862 67 0.3560 45.8 600.000 2.635 3.794 68 0.3620 43.7 600.000 2.713 3.687 69 0.3680 41.7 600.000 2.713 3.687 70 0.3740 39.7 600.000 2.713 3.687 71 0.3800 37.6 600.000 2.713 3.687 72 0.3860 35.6 600.000 2.713 3.687 73 0.3920 33.6 600.000 2.713 3.687 74 0.3980 31.5 600.000 2.713 3.687 75 0.4043 29.5 600.000 2.568 3.894 76 0.4106 27.5 600.000 2.568 3.894 77 0.4170 25.4 600.000 2.568 3.894 78 0.4233 23.4 600.000 2.568 3.894 79 0.4297 21.4 600.000 2.568 3.894 80 0.4360 19.3 600.000 2.568 3.894 81 0.4423 17.3 600.000 2.568 3.894 82 0.4487 15.3 600.000 2.568 3.894 83 0.4554 13.2 600.000 2.416 4.139 84 0.4621 11.2 600.000 2.416 4.139 85 0.4689 9.2 600.000 2.416 4.139 86 0.4756 7.1 600.000 2.416 4.139 87 0.4823 5.1 600.000 2.421 4.130 88 0.4890 3.1 600.000 2.421 4.130 89 0.4957 1.0 600.000 2.421 4.130 90 0.5025 359.0 600.000 2.421 4.130 91 0.5096 356.9 600.000 2.270 4.405 92 0.5168 354.9 600.000 2.270 4.405 93 0.5240 352.9 600.000 2.270 4.405 94 0.5311 350.8 600.000 2.270 4.405 95 0.5388 348.8 600.000 2.133 4.689 96 0.5464 346.8 600.000 2.133 4.689 97 0.5540 344.7 600.000 2.133 4.689 98 0.5608 342.7 600.000 2.393 4.178 99 0.5663 340.7 600.000 2.977 3.359 100 0.5717 338.6 600.000 2.977 3.359 101 0.5772 336.6 600.000 2.977 3.359 102 0.5827 334.6 600.000 2.977 3.359 103 0.5881 332.5 600.000 2.977 3.359 104 0.5936 330.5 600.000 2.977 3.359 105 0.5991 328.5 600.000 2.977 3.359 106 0.6045 326.4 600.000 2.977 3.359 107 0.6104 324.4 600.000 2.765 3.616 108 0.6163 322.4 600.000 2.765 3.616 109 0.6222 320.3 600.000 2.765 3.616 110 0.6281 318.3 600.000 2.765 3.616 111 0.6339 316.3 600.000 2.765 3.616 112 0.6398 314.2 600.000 2.765 3.616 113 0.6453 312.2 600.000 2.971 3.366 114 0.6502 310.2 600.000 3.327 3.005 115 0.6562 308.1 600.000 2.727 3.667 116 0.6625 306.1 600.000 2.554 3.916 117 0.6689 304.1 600.000 2.554 3.916 118 0.6753 302.0 600.000 2.554 3.916 119 0.6832 300.0 600.000 2.062 4.851 120 0.6910 298.0 600.000 2.062 4.851 121 0.6989 295.9 600.000 2.062 4.851 122 0.7063 293.9 600.000 2.200 4.546 123 0.7122 291.9 600.000 2.770 3.611 124 0.7180 289.8 600.000 2.823 3.542 125 0.7237 287.8 600.000 2.823 3.542 126 0.7295 285.8 600.000 2.823 3.542 127 0.7357 283.7 600.000 2.603 3.842 128 0.7420 281.7 600.000 2.603 3.842 129 0.7482 279.7 600.000 2.603 3.842 130 0.7547 277.6 600.000 2.505 3.991 131 0.7600 275.6 600.000 3.076 3.251 132 0.7653 273.6 600.000 3.076 3.251 133 0.7706 271.5 600.000 3.076 3.251 134 0.7759 269.5 600.000 3.076 3.251 135 0.7812 267.4 600.000 3.076 3.251 136 0.7865 265.4 600.000 3.076 3.251 137 0.7918 263.4 600.000 3.076 3.251 138 0.7971 261.3 600.000 3.076 3.251 139 0.8026 259.3 600.000 2.922 3.423 140 0.8082 257.3 600.000 2.922 3.423 141 0.8138 255.2 600.000 2.922 3.423 142 0.8193 253.2 600.000 2.922 3.423 143 0.8243 251.2 600.000 3.264 3.063 144 0.8293 249.1 600.000 3.264 3.063 145 0.8343 247.1 600.000 3.264 3.063 146 0.8393 245.1 600.000 3.264 3.063 147 0.8445 243.0 600.000 3.094 3.232 148 0.8498 241.0 600.000 3.094 3.232 149 0.8550 239.0 600.000 3.094 3.232 150 0.8603 236.9 600.000 3.094 3.232 151 0.8655 234.9 600.000 3.104 3.221 152 0.8708 232.9 600.000 3.104 3.221 153 0.8760 230.8 600.000 3.104 3.221 154 0.8813 228.8 600.000 3.104 3.221 155 0.8870 226.8 600.000 2.853 3.505 156 0.8927 224.7 600.000 2.853 3.505 157 0.8984 222.7 600.000 2.853 3.505 158 0.9041 220.7 600.000 2.853 3.505 159 0.9098 218.6 600.000 2.853 3.505 160 0.9155 216.6 600.000 2.853 3.505 161 0.9212 214.6 600.000 2.853 3.505 162 0.9266 212.5 600.000 3.007 3.325 163 0.9311 210.5 600.000 3.590 2.786 164 0.9355 208.5 600.000 3.701 2.702 165 0.9399 206.4 600.000 3.701 2.702 166 0.9443 204.4 600.000 3.701 2.702 167 0.9488 202.4 600.000 3.596 2.781 168 0.9533 200.3 600.000 3.596 2.781 169 0.9579 198.3 600.000 3.596 2.781 170 0.9624 196.3 600.000 3.596 2.781 171 0.9673 194.2 600.000 3.344 2.991 172 0.9721 192.2 600.000 3.344 2.991 173 0.9770 190.2 600.000 3.344 2.991 174 0.9819 188.1 600.000 3.344 2.991 175 0.9870 186.1 600.000 3.139 3.186 176 0.9922 184.1 600.000 3.139 3.186 177 0.9974 182.0 600.000 3.139 3.186 178 1.0000 181.0 600.000 3.139 3.186

Scripted: Index Meterset Weight Gantry Rtn [deg] Dose Rate [MU/min] Gantry Speed [deg/s] MU/deg 1 0.0000 179.0
2 0.0025 177.0 449.263 4.800 1.560 3 0.0076 175.0 600.000 3.205 3.120 4 0.0126 172.9 600.000 3.205 3.120 5 0.0177 170.9 600.000 3.205 3.120 6 0.0227 168.9 600.000 3.205 3.120 7 0.0277 166.9 600.000 3.230 3.096 8 0.0327 164.8 600.000 3.230 3.096 9 0.0377 162.8 600.000 3.230 3.096 10 0.0427 160.8 600.000 3.230 3.096 11 0.0486 158.8 600.000 2.777 3.601 12 0.0544 156.8 600.000 2.777 3.601 13 0.0602 154.7 600.000 2.777 3.601 14 0.0660 152.7 600.000 2.777 3.601 15 0.0719 150.7 600.000 2.777 3.601 16 0.0777 148.7 600.000 2.777 3.601 17 0.0835 146.6 600.000 2.777 3.601 18 0.0893 144.6 600.000 2.777 3.601 19 0.0942 142.6 600.000 3.342 2.993 20 0.0990 140.6 600.000 3.342 2.993 21 0.1039 138.5 600.000 3.342 2.993 22 0.1087 136.5 600.000 3.342 2.993 23 0.1135 134.5 600.000 3.342 2.993 24 0.1184 132.5 600.000 3.342 2.993 25 0.1232 130.5 600.000 3.342 2.993 26 0.1281 128.4 600.000 3.342 2.993 27 0.1333 126.4 600.000 3.096 3.230 28 0.1385 124.4 600.000 3.096 3.230 29 0.1437 122.4 600.000 3.096 3.230 30 0.1490 120.3 600.000 3.096 3.230 31 0.1547 118.3 600.000 2.844 3.517 32 0.1603 116.3 600.000 2.844 3.517 33 0.1660 114.3 600.000 2.844 3.517 34 0.1715 112.3 600.000 2.959 3.379 35 0.1761 110.2 600.000 3.546 2.820 36 0.1806 108.2 600.000 3.546 2.820 37 0.1852 106.2 600.000 3.546 2.820 38 0.1897 104.2 600.000 3.546 2.820 39 0.1943 102.1 600.000 3.546 2.820 40 0.1989 100.1 600.000 3.546 2.820 41 0.2034 98.1 600.000 3.546 2.820 42 0.2080 96.1 600.000 3.546 2.820 43 0.2125 94.1 600.000 3.609 2.771 44 0.2170 92.0 600.000 3.609 2.771 45 0.2214 90.0 600.000 3.609 2.771 46 0.2259 88.0 600.000 3.609 2.771 47 0.2302 86.0 600.000 3.814 2.622 48 0.2344 83.9 600.000 3.814 2.622 49 0.2386 81.9 600.000 3.814 2.622 50 0.2436 79.9 600.000 3.262 3.066 51 0.2498 77.9 600.000 2.592 3.858 52 0.2567 75.8 600.000 2.346 4.263 53 0.2636 73.8 600.000 2.346 4.263 54 0.2705 71.8 600.000 2.346 4.263 55 0.2774 69.8 600.000 2.346 4.263 56 0.2843 67.8 600.000 2.346 4.263 57 0.2912 65.7 600.000 2.346 4.263 58 0.2981 63.7 600.000 2.346 4.263 59 0.3046 61.7 600.000 2.509 3.986 60 0.3110 59.7 600.000 2.509 3.986 61 0.3175 57.6 600.000 2.509 3.986 62 0.3239 55.6 600.000 2.509 3.986 63 0.3305 53.6 600.000 2.473 4.043 64 0.3370 51.6 600.000 2.473 4.043 65 0.3435 49.6 600.000 2.473 4.043 66 0.3498 47.5 600.000 2.575 3.884 67 0.3560 45.5 600.000 2.621 3.816 68 0.3620 43.5 600.000 2.697 3.707 69 0.3680 41.5 600.000 2.697 3.707 70 0.3740 39.4 600.000 2.697 3.707 71 0.3800 37.4 600.000 2.697 3.707 72 0.3860 35.4 600.000 2.697 3.707 73 0.3920 33.4 600.000 2.697 3.707 74 0.3980 31.4 600.000 2.697 3.707 75 0.4043 29.3 600.000 2.553 3.917 76 0.4106 27.3 600.000 2.553 3.917 77 0.4170 25.3 600.000 2.553 3.917 78 0.4233 23.3 600.000 2.553 3.917 79 0.4297 21.2 600.000 2.553 3.917 80 0.4360 19.2 600.000 2.553 3.917 81 0.4423 17.2 600.000 2.553 3.917 82 0.4487 15.2 600.000 2.553 3.917 83 0.4554 13.1 600.000 2.403 4.162 84 0.4621 11.1 600.000 2.403 4.162 85 0.4689 9.1 600.000 2.403 4.162 86 0.4756 7.1 600.000 2.403 4.162 87 0.4823 5.1 600.000 2.408 4.154 88 0.4890 3.0 600.000 2.408 4.154 89 0.4957 1.0 600.000 2.408 4.154 90 0.5025 359.0 600.000 2.408 4.154 91 0.5096 357.0 600.000 2.258 4.430 92 0.5168 354.9 600.000 2.258 4.430 93 0.5240 352.9 600.000 2.258 4.430 94 0.5311 350.9 600.000 2.258 4.430 95 0.5388 348.9 600.000 2.121 4.716 96 0.5464 346.9 600.000 2.121 4.716 97 0.5540 344.8 600.000 2.121 4.716 98 0.5608 342.8 600.000 2.380 4.202 99 0.5663 340.8 600.000 2.960 3.378 100 0.5717 338.8 600.000 2.960 3.378 101 0.5772 336.7 600.000 2.960 3.378 102 0.5827 334.7 600.000 2.960 3.378 103 0.5881 332.7 600.000 2.960 3.378 104 0.5936 330.7 600.000 2.960 3.378 105 0.5991 328.6 600.000 2.960 3.378 106 0.6045 326.6 600.000 2.960 3.378 107 0.6104 324.6 600.000 2.750 3.637 108 0.6163 322.6 600.000 2.750 3.637 109 0.6222 320.6 600.000 2.750 3.637 110 0.6281 318.5 600.000 2.750 3.637 111 0.6339 316.5 600.000 2.750 3.637 112 0.6398 314.5 600.000 2.750 3.637 113 0.6453 312.5 600.000 2.954 3.385 114 0.6502 310.4 600.000 3.309 3.022 115 0.6562 308.4 600.000 2.712 3.687 116 0.6625 306.4 600.000 2.539 3.938 117 0.6689 304.4 600.000 2.539 3.938 118 0.6753 302.4 600.000 2.539 3.938 119 0.6832 300.3 600.000 2.050 4.878 120 0.6910 298.3 600.000 2.050 4.878 121 0.6989 296.3 600.000 2.050 4.878 122 0.7063 294.3 600.000 2.187 4.572 123 0.7122 292.2 600.000 2.754 3.631 124 0.7180 290.2 600.000 2.807 3.563 125 0.7237 288.2 600.000 2.807 3.563 126 0.7295 286.2 600.000 2.807 3.563 127 0.7357 284.2 600.000 2.588 3.864 128 0.7420 282.1 600.000 2.588 3.864 129 0.7482 280.1 600.000 2.588 3.864 130 0.7547 278.1 600.000 2.491 4.014 131 0.7600 276.1 600.000 3.059 3.269 132 0.7653 274.0 600.000 3.059 3.269 133 0.7706 272.0 600.000 3.059 3.269 134 0.7759 270.0 600.000 3.059 3.269 135 0.7812 268.0 600.000 3.059 3.269 136 0.7865 265.9 600.000 3.059 3.269 137 0.7918 263.9 600.000 3.059 3.269 138 0.7971 261.9 600.000 3.059 3.269 139 0.8026 259.9 600.000 2.905 3.442 140 0.8082 257.9 600.000 2.905 3.442 141 0.8138 255.8 600.000 2.905 3.442 142 0.8193 253.8 600.000 2.905 3.442 143 0.8243 251.8 600.000 3.246 3.081 144 0.8293 249.8 600.000 3.246 3.081 145 0.8343 247.7 600.000 3.246 3.081 146 0.8393 245.7 600.000 3.246 3.081 147 0.8445 243.7 600.000 3.076 3.251 148 0.8498 241.7 600.000 3.076 3.251 149 0.8550 239.7 600.000 3.076 3.251 150 0.8603 237.6 600.000 3.076 3.251 151 0.8655 235.6 600.000 3.087 3.240 152 0.8708 233.6 600.000 3.087 3.240 153 0.8760 231.6 600.000 3.087 3.240 154 0.8813 229.5 600.000 3.087 3.240 155 0.8870 227.5 600.000 2.837 3.525 156 0.8927 225.5 600.000 2.837 3.525 157 0.8984 223.5 600.000 2.837 3.525 158 0.9041 221.5 600.000 2.837 3.525 159 0.9098 219.4 600.000 2.837 3.525 160 0.9155 217.4 600.000 2.837 3.525 161 0.9212 215.4 600.000 2.837 3.525 162 0.9266 213.4 600.000 2.990 3.344 163 0.9311 211.3 600.000 3.569 2.802 164 0.9355 209.3 600.000 3.680 2.718 165 0.9399 207.3 600.000 3.680 2.718 166 0.9443 205.3 600.000 3.680 2.718 167 0.9488 203.2 600.000 3.576 2.797 168 0.9533 201.2 600.000 3.576 2.797 169 0.9579 199.2 600.000 3.576 2.797 170 0.9624 197.2 600.000 3.576 2.797 171 0.9673 195.2 600.000 3.325 3.008 172 0.9721 193.1 600.000 3.325 3.008 173 0.9770 191.1 600.000 3.325 3.008 174 0.9819 189.1 600.000 3.325 3.008 175 0.9870 187.1 600.000 3.121 3.204 176 0.9922 185.0 600.000 3.121 3.204 177 0.9974 183.0 600.000 3.121 3.204 178 1.0000 181.0 461.412 4.800 1.602

mattcschmidt commented 5 years ago

I see the same thing. It maybe seems obvious for me to assume that an even 178 control point spacing is the same dosimetrically as 178 control points that are unevenly spaced in the first and last control points, but its maybe not the safest thing for me to be assuming things like this. I believe it would be worth a discussion to determine if there is any dosimetric or delivery significance to this change in control point spacing when generating VMAT plans with automation. Has anyone done any extensive comparisons here?

LDClark commented 5 years ago

Could course.CopyPlanSetup(verifiedPlan, verificationStructures, outputDiagnostics) be used instead? That seems much simpler. CopyPlanSetup creates a PlanSetup, but I think one could cast it to an ExternalPlanSetup?

I did look into the dosimetric results of the above differences, and they were large enough to affect our QA distributions of 2%/2mm.

LDClark commented 5 years ago

Apparently CopyPlanSetup does the same thing. The gantry rotation and MU/deg are slightly different in the control point list.

joecastelo commented 4 years ago

This behavior is happening to me as well. But If you check the Script Information, the gantryangle and meterset weight are the same.

Code

namespace VMS.TPS
{
    public class Script
    {
        public static void Execute(ScriptContext context)
        {
            ExternalPlanSetup qa = (ExternalPlanSetup)context.PlanSetup;
            ExternalPlanSetup verified = (ExternalPlanSetup)qa.VerifiedPlan;
            var msg = PrintControlPointsVS(qa, verified);
            ExtractCSV("MUW.csv",msg);
        }
        public static IEnumerable<string> PrintControlPoints(ExternalPlanSetup plan)
        {
            var fields = plan.Beams;
            var ctrs = fields.Select(f => f.ControlPoints);
            var final = new List<string> { "BeamId,Index,CollimatorAngle,GantryAngle,MUWeight" };
            foreach (var ctr in ctrs)
            {
                foreach (var point in ctr)
                {
                    final.Add(point.Beam.Id + "," + point.Index + "," + point.CollimatorAngle + "," + point.GantryAngle + "," + point.MetersetWeight);

                }
            }
            return final;
        }
        public static IEnumerable<string> PrintControlPointsVS(ExternalPlanSetup plan1,ExternalPlanSetup plan2)
        {
            var fields1 = plan1.Beams;
            var fields2 = plan2.Beams;
            var ctrs1 = fields1.Select(f => f.ControlPoints);
            var ctrs2 = fields1.Select(f => f.ControlPoints);

            var final = new List<string> { "Index,BeamId1,BeamId2,MUWeight1,MUWeight2,GantryAngle1,GantryAngle2" };

            for (int i = 0; i < ctrs1.Count(); i++)
            {
                var ctr1 = ctrs1.ElementAt(i);
                var ctr2 = ctrs2.ElementAt(i);
                for (int j = 0; j < ctr1.Count; j++)
                {
                    var point1 = ctr1.ElementAt(j);
                    var point2 = ctr2.ElementAt(j);

                    final.Add(point1.Index + "," + point1.Beam.Id + "," + point2.Beam.Id + "," + point1.MetersetWeight + "," + point2.MetersetWeight + "," + point1.GantryAngle + "," + point2.GantryAngle);
                }
                final.Add("\n");
            }
            return final;
        }
        public static void ExtractCSV(string filename, IEnumerable<string> results)
        {
            var temp = Path.GetTempPath();
            var fl = Path.Combine(temp + filename);
            File.WriteAllLines(fl, results);
            System.Diagnostics.Process.Start(fl);
        }
    }
}
tkstevens commented 4 years ago

I've found the same issue as @LDClark, with the resultant dosimetric differences being enough to cause worry. Is it possible to just add GantryAngle to the admissable list of EditableParameters so the values can be corrected following beam creation?

tkstevens commented 4 years ago

As a followup tidbit, VMAT beams created via scripting are represented in Eclipse (e.g. in transverse view for GantryAngle=0 beam) by a yellow arc with a smaller (17 cm) radius than those of CP-matched VMAT beams created through the GUI (shown arc has radius of 34 cm). Seems like Eclipse recognizes some difference with scripted VMAT beams.

joecastelo commented 4 years ago

Any news ?

LDClark commented 4 years ago

I think this solution works: CreateVerificationPlan.

It is not the most elegant solution, but it fixed the controlpoint issue for VMAT (issue that I had created in modifying it from IMRT). The version I had modified before wasn't applying the editable parameters to the beam, in the method CopyBeam().

This version does this: -Add beam to verification plan, and apply machineparameters, metersetweights, collimatorangle, gantry angle, etc. -Makes the treat plan and verif plan beam names the same -Goes through each plan's beams and makes the editable parameters the same and applies them

I checked the control points after, and they match now.

Landon

joecastelo commented 4 years ago

Hey guys this problem seems to be not difficult to solve, IMRT example made us lose track.

42 has the answer

LDClark commented 3 years ago

I think I have a workaround that gives an exact match on the dose distribution. Here is a matching issue that had the same problem:

https://github.com/x2sky/Esapi_CreateQAPlan/issues/1

If you modify the AddVMATBeam() method as so, the resulting new plan doesn't have start/stop angles that match, but the isodoses from the QA plan match up. I think the way the API adds VMAT beams gives it an extra 1 degree of padding at the start/stop, compared to how the manually created beam in Eclipse is added. Can anyone verify that this works on their system?