VarianAPIs / PyESAPI

Python interface to Eclipse Scripting API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

EvaluationDose and GetDoseAtVoxel, GetVoxelAtDose, GetDVHCumulativeData

mfizyczka opened this issue · comments

There is option to add EvaluationDose to plan (or to import dose in Eclipse TPS). In Eclipse it is possible to evaluate this dose, look into DVHs, compare with Clinical Goals etc. But if I try doing the same with scripting GetDoseAtVoxel, GetVoxelAtDose, GetDVHCumulativeData methods return nan. The Dose.DoseMax3D.Dose method still returns max dose.

PatientID = "MyPatientID"

# open patient
patient = app.OpenPatientById(PatientID)

patient.BeginModifications()

# select course
course = patient.CoursesLot('CourseName')

# select plan
plan = course.PlanSetupsLot('Test')

# select structure sets:
structureSet = patient.StructureSetsLot()[0]

# change dose presentation to absolute:
plan.DoseValuePresentation = 1

tempPlan = course.AddExternalPlanSetup(plan.StructureSet)
tempDose = tempPlan.CopyEvaluationDose(plan.Dose)

structure = structureSet.StructuresLot()[27]

# set step of exported lines:
step = 0.7

dvh = plan.GetDVHCumulativeData(structure, pyesapi.DoseValuePresentation.Absolute, pyesapi.VolumePresentation.Relative, step)
dvh2 = tempPlan.GetDVHCumulativeData(structure, pyesapi.DoseValuePresentation.Absolute, pyesapi.VolumePresentation.Relative, step)
dose = plan.GetDoseAtVolume(structure, 50, pyesapi.VolumePresentation.Relative, pyesapi.DoseValuePresentation.Absolute).Dose
dose2 = tempPlan.GetDoseAtVolume(structure, 50, pyesapi.VolumePresentation.Relative, pyesapi.DoseValuePresentation.Absolute).Dose

print('dvh', dvh)
print('dvh2', dvh2)
print('dose', dose)
print('dose2', dose2)

print('tempPlan max dose:', tempPlan.Dose.DoseMax3D.Dose)
The output is:
dvh VMS.TPS.Common.Model.API.DVHData
dvh2 None
dose 14.776034807492234
dose2 nan
tempPlan max dose: 103.92649999999999

How can I use Evaluation methods on EvaluationDose not on CalculatedDose?