Created
May 14, 2020 16:34
-
-
Save joecastelo/eecb1119ee4f63af761cd717d08f036a to your computer and use it in GitHub Desktop.
Executable Program to Print Beam Descriptions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using ExecutableLogic; | |
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
using System.Text; | |
using System.Threading.Tasks; | |
using VMS.TPS.Common.Model.API; | |
namespace LogPatientFields | |
{ | |
class Program | |
{ | |
[STAThread] | |
public static void Main(string[] args) | |
{ | |
try | |
{ | |
using (Application app = Application.CreateApplication()) | |
{ | |
Perform(app, args); | |
} | |
} | |
catch (Exception e) | |
{ | |
Console.Error.WriteLine(e.ToString()); | |
Console.Read(); | |
// MessageBox.Show(e.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); | |
} | |
} | |
public static void Perform(Application app, string[] args) | |
{ | |
var ctx = ScriptContextArgs.From(args); | |
Console.WriteLine(ctx.PlanSetupId); | |
//Console.Read(); | |
var patient = app.OpenPatientById(ctx.PatientId); | |
var course = patient.Courses.First(e => e.Id == ctx.CourseId); | |
var plan = course.PlanSetups.First(e => e.Id == ctx.PlanSetupId); | |
var fieldDesc = plan.Beams.Where(e => !e.IsSetupField).Select(e => BeamsDescription(e)); | |
Console.WriteLine(string.Join("\n", fieldDesc)); | |
Console.ReadKey(); | |
app.ClosePatient(); | |
} | |
public static string BeamsDescription(Beam beam) | |
{ | |
return $"{beam.Id} | {beam.Meterset} | {beam.MLCPlanType} | {beam.SSD}"; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment