static void Execute(VMS.TPS.Common.Model.API.Application app) { // Open the report file string temp = System.Environment.GetEnvironmentVariable("TEMP"); string dataFilePath = temp + @"\DataMiningOutput.txt"; PrintStartupMsg(dataFilePath); using (StreamWriter reportFile = new StreamWriter(dataFilePath, false)) { // Iterate over all patients in the database. foreach (PatientSummary patsum in app.PatientSummaries) { // Check if the user has hit a key. if (StopNow()) { break; } // Open a patient, report on the treatment history for that patient, and close the patient. // If there is no treatment history, nothing is reported. Patient pat = app.OpenPatient(patsum); ReportOnePatient(pat, reportFile); app.ClosePatient(); } reportFile.Flush(); } MessageBox.Show("the results to the simple report '" + dataFilePath + "'."); // Open the folder with explore.exe. System.Diagnostics.Process.Start(temp); }
public Form2(Plantilla _plantilla, bool _hayContext = false, Patient _pacienteContext = null, PlanningItem _planContext = null, User _usuarioContext = null) { InitializeComponent(); plantilla = _plantilla; this.Text = plantilla.nombre; hayContext = _hayContext; if (_hayContext) { paciente = _pacienteContext; plan = _planContext; usuario = _usuarioContext; prepararControlesContext(); llenarDGVEstructuras(); llenarDGVPrescripciones(); BT_Analizar.Enabled = true; L_NombrePaciente.Text = paciente.LastName + ", " + paciente.FirstName; L_NombrePaciente.Visible = true; this.Text += " - " + paciente.LastName + ", " + paciente.FirstName; } else { try { app = VMS.TPS.Common.Model.API.Application.CreateApplication(); } catch (Exception e) { MessageBox.Show("No se puede acceder a Eclipse.\n Compruebe que está en una PC con acceso al TPS" + e.ToString()); } } }
//////////////////////////////////////////////////////////// // This is where the code begins when run as a standalone // //////////////////////////////////////////////////////////// private void App_OnStartup(object sender, StartupEventArgs e) { //// Manually define plan to be opened when run as a standalone app //// SomeProperties.PatientId = "QA_ESAPI"; // Set patient ID property SomeProperties.CourseId = "C1"; // Set course ID property SomeProperties.PlanId = "UnitTest0"; // Set plan ID property // Load general settigns; UserSettings.DefineUserSettings(); // Create the application and connect to the API Patient patient = null; Course course = null; PlanSetup plan = null; try { // Create the application VMS.TPS.Common.Model.API.Application app = ESAPIApplication.Instance.Context; // Open the plan patient = app.OpenPatientById(SomeProperties.PatientId); course = patient.Courses.Where(c => c.Id == SomeProperties.CourseId).Single(); plan = course.PlanSetups.Where(p => p.Id == SomeProperties.PlanId).Single(); } catch { string errorlog = DateTime.Now + ", The script was not able to connect to the Eclipse API or load the plan info for some reason."; MessageBox.Show(errorlog); return; } // Launch the main part of the code. MainCode.RunMainCode(patient, course, plan); }
static void Execute(VMS.TPS.Common.Model.API.Application app, string[] args) { //check if file with patient info exists if (args.Count() == 1 && args[0] == "/test-file") { if (System.IO.File.Exists("testpatients.xml")) { try { //--load patient list to DOM XmlDocument xDoc = new XmlDocument(); xDoc.Load("testpatients.xml"); //--run batch test //runBatchTest(app, xDoc); } catch (Exception e) { Console.Write(e.Message); } } } else { //start UI RunFromUI(app); } }
static void Execute(VMS.TPS.Common.Model.API.Application app, string PMRN, string MU) { MessageBox.Show("PMRN: " + PMRN); MessageBox.Show("MU: " + MU); /* * * Patient dummypatient = app.OpenPatientById(PMRN); // open the dummy patient * dummypatient.BeginModifications(); * * * PlanSetup TSEIPlan = dummypatient.Courses.First().PlanSetups.First(); //gets the first plan in the first course of the dummy patient. the dummy patient will only have one course with onw plan. * * foreach(Beam B in TSEIPlan.Beams) * { * // B.Meterset = MU; // something like that * * } * * * Patient actualpatient = app.OpenPatientById(PMRN); * * actualpatient.AddCourse(); * actualpatient.Courses.First().AddExternalPlanSetup(TSEIPlan.StructureSet); * * // I guess that's it * app.SaveModifications(); * * */ }
static void Main(string[] args) { //global variable declaration string PMRN = null; // patient MRN string MU = null; // MU value for the new patient's plan TSEIGUI tseigui = new TSEIGUI(); System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.Run(tseigui); // run GUI to obtain required information before opening Eclipse. only need patient MRN and plan MU for this. PMRN = tseigui.PMRN; MU = tseigui.MU; try { using (VMS.TPS.Common.Model.API.Application app = VMS.TPS.Common.Model.API.Application.CreateApplication()) { Execute(app, PMRN, MU); } } catch (Exception e) { MessageBox.Show("Error launching Eclipse - " + e.ToString()); } }
public MainWindow(VMS.TPS.Common.Model.API.Application Application) { _application = Application; // _application.CurrentUser = _application.CurrentUser; _viewModel = new ViewModel(); InitializeComponent(); this.DataContext = _viewModel; //lstPatients.SelectedIndex = 1; //lstPlans.SelectedIndex=0; LoadRecentPatients(); //Show list of scripts if running in ALLSCRIPTS mode itmScripts.Visibility = Visibility.Collapsed; #if ALLSCRIPTS itmScripts.Visibility = Visibility.Visible; ScriptsConfiguration config = MyConfig.GetScriptsSection(); foreach (ScriptElement script in config.Scripts) { _viewModel.Scripts.Add(new MyScript { Name = script.Name, Description = script.Description, IsChecked = false }); } _viewModel.Scripts[0].IsChecked = true; #endif }
static void Main(string[] args) { //AppDomain.CurrentDomain.FirstChanceException += // (object source, FirstChanceExceptionEventArgs e) => // { // string sMsg = string.Format("Exception raised in {0}: {1}\n\nDetails:\n{2}", AppDomain.CurrentDomain.FriendlyName, e.Exception.Message,e.Exception.ToString()); // //ignore the varian osp exception we are getting // if (!sMsg.Contains("OSP")) // MessageBox.Show(sMsg); // }; AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) => { string msg = string.Format("Unhandled Exception raised in {0}: {1}\n\nDetails:\n{2}", AppDomain.CurrentDomain.FriendlyName, (e.ExceptionObject as Exception).Message, (e.ExceptionObject as Exception).ToString()); //ignore the varian osp exception we are getting if (!msg.Contains("OSP")) { MessageBox.Show(msg); } }; try { using (VMS.TPS.Common.Model.API.Application app = VMS.TPS.Common.Model.API.Application.CreateApplication(null, null)) { Execute(app); } } catch (Exception e) { Console.Error.WriteLine(e.ToString()); // MessageBox.Show(e.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
public MainWindow(VMS.TPS.Common.Model.API.Application app) { viewModel = new ViewModel.MainWindowModel(app); DataContext = viewModel; InitializeComponent(); }
public Patient abrirPaciente(string ID) { VMS.TPS.Common.Model.API.Application app = VMS.TPS.Common.Model.API.Application.CreateApplication(null, null); Patient paciente = app.OpenPatientById(ID); paciente.BeginModifications(); return(paciente); }
public AsyncESAPI(string username = null, string password = null) { m_application = Execute(new Func <EApp>(() => { return(EApp.CreateApplication(username, password)); //return EApp.CreateApplication(null,null ); })); isInit = true; }
//CONSTRUCTOR public PatientSelectViewModel(VMS.TPS.Common.Model.API.Application application, IEventAggregator eventAggregator) { //Local variable _application = application; _eventAggregator = eventAggregator; Courses = new ObservableCollection <Course>(); Plans = new ObservableCollection <PlanSetup>(); OpenPatientCommand = new DelegateCommand(OnOpenPatient, CanOpenPatient); }
private void Initialize() #endif { #if ESAPI_13 _esapiApp = Application.CreateApplication(userId, password); #elif ESAPI_15 _esapiApp = Application.CreateApplication(); #endif _search = new PatientSummarySearch(_esapiApp.PatientSummaries, MaxSearchResults); _dataRepository = new DataRepository(GetDataPath()); }
static void RunFromUI(VMS.TPS.Common.Model.API.Application app) { Window window = new Window(); MainWindow mainWindow = new MainWindow(app); window.Title = "UM Plugin Tester"; window.Content = mainWindow; window.Width = 1200; window.Height = 600; window.ShowDialog(); }
public ImportarNombresEstructuras() { InitializeComponent(); try { app = VMS.TPS.Common.Model.API.Application.CreateApplication("paberbuj", "123qwe"); } catch (Exception) { MessageBox.Show("No se puede acceder a Eclipse.\n Compruebe que está en una PC con acceso al TPS"); } }
public MainWindow() { _app = VMS.TPS.Common.Model.API.Application.CreateApplication(); //version 13.X //_app = VMS.TPS.Common.Model.API.Application.CreateApplication(null,null); MainViewModel mainViewModel = new MainViewModel(_app); this.DataContext = mainViewModel; //MessageBox.Show(_app.CurrentUser.Id); this.Closing += MainWindow_Closing; InitializeComponent(); }
public MainWindow(VMS.TPS.Common.Model.API.Application Application) { _application = Application; _viewModel = new ViewModel(); InitializeComponent(); this.DataContext = _viewModel; //lstPatients.SelectedIndex = 1; //lstPlans.SelectedIndex=0; foreach (PatientSummary patientSummary in _application.PatientSummaries) { MyPatient myPatient = new MyPatient(); myPatient.PatientId = patientSummary.Id; myPatient.LastName = patientSummary.LastName; myPatient.FirstName = patientSummary.FirstName; Patient patient = _application.OpenPatient(patientSummary); foreach (Course course in patient.Courses) { MyCourse vmCourse = new MyCourse(); vmCourse.CourseId = course.Id; foreach (PlanSetup planSetup in course.PlanSetups) { vmCourse.PlanItems.Add(new MyPlanItem { pItemId = planSetup.Id, IsInScope = false, IsPlanSum = false }); } foreach (PlanSum planSum in course.PlanSums) { vmCourse.PlanItems.Add(new MyPlanItem { pItemId = planSum.Id, IsInScope = false, IsPlanSum = true }); } myPatient.Courses.Add(vmCourse); } _application.ClosePatient(); _viewModel.Patients.Add(myPatient); } OpenSelections(); }
public SelectPlanUI(VMS.TPS.Common.Model.API.Application app, Entity daemon, DICOMSCU scu, FileWriterSCP scp, string path) { this.app = app; this.daemon = daemon; this.scu = scu; this.scp = scp; this.path = path; this.Location = new Point(0, 0); InitializeComponent(); //textBoxPatId.Text = "QC_Checklista"; }
public SelectPlanWindow(VMS.TPS.Common.Model.API.Application application) { this.application = application; this.Location = new Point(0, 0); InitializeComponent(); //textBoxPatientId.Text = "test_FN"; textBoxPatientId.Text = "QC_Checklista"; //buttonOpen_Click(null, null); //listBoxCourses.SelectedIndex = 0; //listBoxPlans.SelectedIndex = 0; }
static void Main(string[] args) { try { using (VMS.TPS.Common.Model.API.Application app = VMS.TPS.Common.Model.API.Application.CreateApplication(args[0], args[1])) { Execute(app); } } catch (Exception e) { Console.Error.WriteLine(e.ToString()); } }
static void Main(string[] args) { try { using (Application app = Application.CreateApplication(null, null)) { Execute(app); } } catch (Exception e) { Console.Error.WriteLine(e.ToString()); } }
public Form3(Plantilla _plantilla) { InitializeComponent(); plantilla = _plantilla; this.Text = plantilla.nombre; try { app = VMS.TPS.Common.Model.API.Application.CreateApplication(null, null); } catch (Exception) { MessageBox.Show("No se puede acceder a Eclipse.\n Compruebe que está en una PC con acceso al TPS"); } }
public static void Execute(VMS.TPS.Common.Model.API.Application app) { string[] args = { "", "", "", "", "", "", "", "" }; args[0] = "$P-901"; Patient this_patient = app.OpenPatientById(args[0]); System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); System.Windows.Forms.Application.Run(new Form1(this_patient, args)); app.ClosePatient(); app.Dispose(); }
static void Main(string[] args) { try { using (VMS.TPS.Common.Model.API.Application app = VMS.TPS.Common.Model.API.Application.CreateApplication("allrights", "allrights")) { Execute(app, args); } } catch (Exception e) { Console.Error.WriteLine(e.ToString()); // MessageBox.Show(e.ToString(), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void Application_Startup(object sender, StartupEventArgs e) { app = VMS.TPS.Common.Model.API.Application.CreateApplication(); if (app != null) { if (!String.IsNullOrEmpty(e.Args.FirstOrDefault())) { _patient = app.OpenPatientById(e.Args[0].Split(';').First().Trim('"')); _course = _patient.Courses.FirstOrDefault(x => x.Id == e.Args[0].Split(';')[1]); _planSetup = _course.PlanSetups.FirstOrDefault(x => x.Id == e.Args[0].Split(';').Last().Trim('"')); } var bootstrapper = new Bootstrapper(); var container = bootstrapper.Bootstrap(app, _patient, _course, _planSetup); var mainview = container.Resolve <MainView>(); mainview.Show(); } }
private void Application_Startup(object sender, StartupEventArgs e) { try { using (_app = VMS.TPS.Common.Model.API.Application.CreateApplication()) { IEventAggregator eventAggregator = new EventAggregator(); mv = new MainView(); mv.DataContext = new MainViewModel( new NavigationViewModel(_app, eventAggregator), new ScanCompareViewModel(eventAggregator)); mv.ShowDialog(); } } catch (ApplicationException ex) { // give the exception to the user somehow (log file, messagebox, etc) _app.ClosePatient(); //this is like closing the patient in Eclipse _app.Dispose(); //This is like closing Eclipse } }
public static void GeneratePlan(VMS.TPS.Common.Model.API.Application app, MLCDefinitions mlcs, ExternalBeamMachineParameters beamPars, IMRTGenerator.JSON.Patient patient, IEnumerable <IMRTGenerator.JSON.Beam> beams ) { var pat = app.OpenPatientById(patient.PatientId); var sSet = pat.StructureSets.Single(ss => ss.Id == patient.StructureSet); pat.BeginModifications(); var cr = pat.Courses.SingleOrDefault(cr_ => cr_.Id == "DTPCOURSE"); if (null == cr) { cr = pat.AddCourse(); cr.Id = "DTPCOURSE"; } var plan = cr.AddExternalPlanSetup(sSet); // // Cannot use target structure // var targetStructure = sSet.Structures.Single(s => s.Id == plan.TargetVolumeID); var isoCenter = targetStructure.CenterPoint; foreach (var bm in beams) { var beam = plan.AddMLCBeam(beamPars, null, default(VRect <double>), 0.0, bm.GantryAngleInDeg, bm.PatientSupportAngleInDeg, isoCenter); beam.FitMLCToStructure(new FitToStructureMargins(bm.MlcMarginInmm), targetStructure, true, JawFitting.FitToRecommended, OpenLeavesMeetingPoint.OpenLeavesMeetingPoint_Middle, ClosedLeavesMeetingPoint.ClosedLeavesMeetingPoint_Center); adjustJaws(beam, bm.BeamletSizeXInmm, mlcs.MLCs[beam.MLC.Id].LeafWidths()); } if (null == calcModel) { calcModel = plan.GetModelsForCalculationType(CalculationType.PhotonInfluenceMatrix)?.OrderByDescending(cm => cm, new ModelNameComparer()).First(); calcModel = calcModel == null ? "" : calcModel; } plan.SetCalculationModel(CalculationType.PhotonInfluenceMatrix, calcModel); app.SaveModifications(); }
public static void Execute(VMS.TPS.Common.Model.API.Application app) { Form1 ventana = new Form1(); System.Windows.Forms.Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); System.Windows.Forms.Application.Run(ventana); string HC = ventana.traerHC(); Patient paciente = app.OpenPatientById(HC); Course curso = paciente.Courses.Where(c => c.Id == "C1").FirstOrDefault(); ventana.escribirNombreCurso(curso.Id); foreach (PlanSetup p in curso.PlanSetups) { ventana.agregarALista(p.Id); } app.ClosePatient(); }
static void Execute(VMS.TPS.Common.Model.API.Application app) { // This program demonstrates use of MVVM design with stand alone Eclipse Script API. It includes binding of members and methods. In addition use of a class for // multipage printing of a report from from the View class is demonstrated. A DocumentPaginator class (PrintReport.cs) includes generic code and hightlights // code added specifically for printing out a report from Eclipse. //VMS.TPS.Common.Model.API.Patient curpat = app.OpenPatientById("ZBenchMark-TG166"); //VMS.TPS.Common.Model.API.PlanSetup curps = curpat.Courses.Where(x => x.Id == "C1").Single().PlanSetups.Where(x => x.Id == "TG-166").Single(); Window w = new Window(); // View gui = new View(); //This is the default with nothing passed //View gui = new View("Pass string from the API"); //This only passes a string //View gui = new View("Pass Eclipse Info", curpat, curps); Console.WriteLine("Loading default patients ..."); DVHPlot.MainWindow dvhgui = new DVHPlot.MainWindow(app); TPReportData pt1ReportData = new TPReportData(); TPReportData pt2ReportData = new TPReportData(); //DrawDVH(dvhgui.ViewModel, curps); //DrawDVHs(dvhgui.ViewModel, "B_002", "B_001", app, pt1ReportData, pt1ReportData); //dvhgui.ViewModel.ExportPDF(); //w.Content = dvhgui; //w.SizeToContent = SizeToContent.WidthAndHeight; //w.ShowDialog(); //dvhgui.content = gui; dvhgui.ShowDialog(); }
public void abrirPaciente(string ID) { try { VMS.TPS.Common.Model.API.Application app = VMS.TPS.Common.Model.API.Application.CreateApplication("pa", "123qwe"); Patient paciente = app.OpenPatientById(ID); XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.IndentChars = ("\t"); XmlWriter writer = XmlWriter.Create(paciente.Id + ".xml", settings); writer.WriteStartDocument(); writer.WriteStartElement("Patient"); paciente.WriteXml(writer); writer.WriteEndElement(); writer.WriteEndDocument(); MessageBox.Show("terminó"); app.ClosePatient(); } catch (Exception e) { File.WriteAllText("log.txt", e.ToString()); throw; } }