EvaluationTestKind.MaxGamma
gdauro opened this issue · comments
Hi, I would like to write a list with MaxGamma test result.
In the next code I am able to get the GammaAreaLessThanOne but not the MaxGamma value:
public void Execute(ScriptContext context)
{
List<EvaluationTestDesc> TestsList = new List<EvaluationTestDesc>();
EvaluationTestDesc TestGamma = new EvaluationTestDesc(EvaluationTestKind.GammaAreaLessThanOne, double.NaN, 0.95, true);
TestsList.Add(TestGamma);
EvaluationTestDesc TestMaxGamma = new EvaluationTestDesc(EvaluationTestKind.MaxGamma, double.NaN, 0.95, true);
TestsList.Add(TestMaxGamma);
PDTemplate pDTemplate = new PDTemplate(false, false, false, false, AnalysisMode.CU, NormalizationMethod.MaxEachDose, true, 0.1, ROIType.Field, 10, 0.03, 2, false, TestsList);
Patient Paciente = context.Patient;
List<string> salida = new List<string>();
salida.Add("ID;Nombre;Plan;Camop;Fecha;Resultado");
File.AppendAllText(@"\\Ariadb-cdt\va_transfer\18_Informes PortalDosimetry\" + Paciente.Id + " " + Paciente.Name + ".txt", "ID" + ";" + "Nombre" + ";" + "Plan" + ";" + "Campo" + ";" + "Fecha" + ";" + "Gamma" + ";" + "GammaMax" + Environment.NewLine);
if (Paciente.PDPlanSetups.Count() > 0)
{
foreach (PDPlanSetup pDPlanSetup in Paciente.PDPlanSetups)
{
if (!pDPlanSetup.PlanSetup.Course.Id.Contains("QA") && pDPlanSetup.Beams.Count > 0)
{
foreach (PDBeam campo in pDPlanSetup.Beams)
{
foreach (PortalDoseImage imagen in campo.PortalDoseImages)
{
try
{
PDAnalysis pDAnalysis = imagen.CreateTransientAnalysis(pDTemplate, campo.PortalDoseImages.First());
string aux = Paciente.Id + ";" + Paciente.Name + ";" + pDPlanSetup.Id + ";" + campo.Id + ";" + imagen.Session.SessionDate.ToShortDateString() + ";" + pDAnalysis.EvaluationTests.First().TestValue.ToString();
salida.Add(aux);
double ResultGamma = 100 * pDAnalysis.EvaluationTests.First().TestValue;
File.AppendAllText(@"\\Ariadb-cdt\va_transfer\18_Informes PortalDosimetry\" + Paciente.Id + " " + Paciente.Name + ".txt", aux + Environment.NewLine);
}
catch (Exception e)
{
MessageBox.Show("Error: " + e.ToString());
}
}
}
}
}
}
}
As a result, a get a text file that looks like this:
ID;Nombre;Plan;Campo;Fecha;Gamma;GammaMax
1-93529-0;MOSCOSO;Plan1;Field 1;8/2/2021;1
1-93529-0;MOSCOSO;Plan1;Field 1;8/3/2021;0.99963818107687
1-93529-0;MOSCOSO;Plan1;Field 1;8/4/2021;0.992102086939147
1-93529-0;MOSCOSO;Plan1;Field 1;8/5/2021;0.997594174175309
...
...
... and so on.
As you cand see, I'm not getting the MaxGamma value but I can't figure out where is the issue.
If someone could help me out I'll be very grateful.
Hi, I don't have any solution to your problem but your code helped me start on a project I'm working on. Couple of questions: It looks like you're comparing each measured image with the 1st measured image rather than the predicted image - not sure if this is what you intended. Also, when I ran the code with the same parameters as in our PD application template, I get small differences between the gamma area<1 percentage. Not sure if there are any other parameters to set. Do you have any ideas?
I think you're not able to see max gamma since you're only looking for the evaluation test's first result:
pDAnalysis.EvaluationTests.First().TestValue.ToString()
I tried EvaluationTests.ElementAt(1) and got the max gamma result.
Hope this helps - Anand.