Skip to content

Commit

Permalink
Add dose calculation for scheduling plans
Browse files Browse the repository at this point in the history
  • Loading branch information
nlambriICH committed Oct 23, 2024
1 parent 450f474 commit 63ee4dd
Showing 1 changed file with 21 additions and 2 deletions.
23 changes: 21 additions & 2 deletions TMIAutomation/Model/Schedule/Schedule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,13 @@ public Task ComputeAsync(IProgress<double> progress, IProgress<string> message)

message.Report("Generating schedule plans upper-body...");
AddSchedulePlans(upperPlan, scheduleCourse, scheduleSS.Where(ss => ss.Image.ImagingOrientation == PatientOrientation.HeadFirstSupine));
progress.Report(0.4);
progress.Report(0.2);
CalculateDoseSchedulePlans(upperPlan, scheduleCourse, progress, message);

message.Report("Generating schedule plans lower-extremities...");
AddSchedulePlans(lowerPlan, scheduleCourse, scheduleSS.Where(ss => ss.Image.ImagingOrientation == PatientOrientation.FeetFirstSupine));
progress.Report(0.4);
progress.Report(0.2);
CalculateDoseSchedulePlans(lowerPlan, scheduleCourse, progress, message);
});
}

Expand Down Expand Up @@ -206,5 +209,21 @@ private static VRect<double> GetMaximumAperture(IEnumerable<ControlPoint> contro
return new VRect<double>(maxX1, maxY1, maxX2, maxY2);
}
#endif

private void CalculateDoseSchedulePlans(PlanSetup sourcePlan,
Course newCourse,
IProgress<double> progress,
IProgress<string> message)
{
List<ExternalPlanSetup> schedulePlans = newCourse.ExternalPlanSetups.Where(ps => ps.TreatmentOrientation == sourcePlan.TreatmentOrientation).ToList();
foreach (ExternalPlanSetup schedulePlan in schedulePlans)
{
progress.Report(0.2 / schedulePlans.Count);
message.Report($"Calculating dose of plan {schedulePlan.Id}. Progress: {schedulePlans.IndexOf(schedulePlan) + 1}/{schedulePlans.Count}");
schedulePlan.SetupOptimization();
schedulePlan.CalculatePlanDose();
schedulePlan.PlanNormalizationValue = sourcePlan.PlanNormalizationValue;
}
}
}
}

0 comments on commit 63ee4dd

Please sign in to comment.