Problem using CalculateDoseWithPresetValues()

Aug 6, 2015 at 8:02 AM
Hi

I have been trying to use CalculateDoseWithPresetValues() function in Research ESAPI 13.5, however am getting following exception:

Application Exception:
Message Calculation with fixed MUs is not possible.
Source: VMS.TPS.Common.Model.API
Offending Module:
VMS.TPS.Common.Model.API.CalculationResult CalculateDose()

The weirder thing is that even if I try to print the MeterSet values for various beams through scripts, most of the times they are being output as NaN. In cases when the script is giving out correct MeterSet values even then the above exception is occurring. These plans are VMAT.

Any help would be greatly appreciated.

Cheers
Prab
Coordinator
Aug 7, 2015 at 5:21 PM
Dose calculation with preset values in scripting is supported only for IMRT beams that have no actual fluences calculated (and in that case that is the only supported dose calculation mode).

For non-IMRT fields, you can adjust the field weight. First calculate dose, then
      Beam beam = ps.Beams.First();
      double mu = beam.Meterset.Value;
      double newMu = 100;
      BeamParameters parameters = beam.GetEditableParameters();
      parameters.WeightFactor = beam.WeightFactor * newMu / mu;
      beam.ApplyParameters(parameters);
Aug 11, 2015 at 4:25 AM
Thank you this is helpful. However, while using calculate dose another issue is coming up.

Unknown Error: Debug PROSTATE
Application Exception:
Message Plan does not have a dose matrix. Dose calculation is not supported from plugin script in this case.
Source: VMS.TPS.Common.Model.API
Offending Module:
VMS.TPS.Common.Model.API.CalculationResult CalculateDose()

There is a default dose calculation model setup. which is activated when the dose calculation is performed through Eclipse options instead of scripting. However, those setting are not being used through scripts. Not sure why?
In case, I setup the dose calculation algorithm. Then only the algorithm is being setup with above error. Is there a script function to specify dose matrix/grid.

Cheers
Prab
Coordinator
Aug 11, 2015 at 9:19 PM
Your plan is an imported plan, in which case it does not yet have a dose matrix object. In Eclipse UI, the context window / focus window does not display the "Dose" icon.

I could not find a script method that would add it to the plan. You can create it in Eclipse UI though: Click "Show/Edit Calculation Volume" on the toolbar. The Dose icon appears to focus window. Then save the plan before running the script. Hope this helps.
Aug 12, 2015 at 2:08 AM
Thank you again for prompt response. You are right, I could that to resolve it however then I loose the preset MUs for the beams.

The work around for me then is to read and store preset MU before setting up the "Dose" icon and call them during the scripts.

Regards
Prab