PyESAPI
PyESAPI copied to clipboard
CalculateDVHEstimates in pyESAPI throws "Cannot locate TPS Core" Error
trafficstars
Hello,
We are trying to call the CalculateDVHEstimates via pyESAPI (ESAPI version = 15.6.) gets an "Cannot locate TPS core" error. The error message is listed as below:
Traceback (most recent call last):
File "C:/Users/xxx/Desktop/test_rapidplan.py", line 34, in <module>
plan.CalculateDVHEstimates(rp_model_name, targetdose_dict, Match_dict)
System.ApplicationException: Cannot locate TPS Core from 'D:\anaconda\'.
at VMS.TPS.Common.Model.TpsCorePathResolver.ResolveTpsCorePathViaApplicationSettings()
at VMS.TPS.Common.Model.ObjectFactory.CreateObject[TObject](String assemblyFileName, String classFullName, Func\1 tpsCoreBinPathResolver)
at VMS.TPS.Common.Calculation.DVHEstimationClient.AddStructureObjectivesToModule(DCRVAConstraintModule* module)
at VMS.TPS.Common.Calculation.DVHEstimationClient.InitDataInterface()
at VMS.TPS.Common.Calculation.CalculationClientBase.Initialize()
at VMS.TPS.Common.Model.API.ExternalPlanSetup.CalculateDVHEstimates(String modelId, Dictionary\2 targetDoseLevels, Dictionary2 structureMatches)
Because the python original dict is not directly recognizable for the CalculateDVHEstimates function,
we have tried to convert the python dict with the pythonnet Dictionary like
td = [('CTV', api.DoseValue(41.8, "Gy")), ('PTV', api.DoseValue(41.8, "Gy")))]
targetdose_dict = Dictionary[str, api.DoseValue]()
for k,v in td:
targetdose_dict[k] = v
match = [('CTV', 'CTV'), ('PTV', 'PTV'), ('FemoralHead', 'FemoralHead')]
Match_dict = Dictionary[str, str]()
for k, v in match:
Match_dict[k] = v
rp_model_name = "000 Rectum 41.8-50.6 V2019.1"
plan.SetCalculationModel(api.CalculationType.DVHEstimation, "DVH Estimation Algorithm [15.6.03]")
plan.SetCalculationModel(api.CalculationType.PhotonLeafMotions, "Varian Leaf Motion Calculator [15.1.51]")
plan.CalculateDVHEstimates(rp_model_name, targetdose_dict, Match_dict)
This seems to cause a confusion for the TPS Core resolution.
I have tried to use the Dictionary and String types in pyesapi.stubs, but they do not seem to be functional.
Any idea how to circumvent this issue?