Пример #1
0
        void UpdateChartSeries()
        {
            foreach (KeyValuePair <VolumeViewModel, List <MPatient> > kvp in _dictpatients)
            {
                kvp.Value.Clear();
            }
            VolumeChartSeries.Clear();

            int patcnt = 0;

            foreach (MPatient pat in (_filterlevel > 0) ? _patientRepository.GetSelectedPatients(_filterlevel - 1) : _patientRepository.GetAllPatients())
            {
                bool bDone = false;
                VMS.TPS.Common.Model.API.Patient vpat = _vapp.OpenPatientById(pat.MRN);
                foreach (VMS.TPS.Common.Model.API.Course course in vpat.Courses)
                {
                    foreach (VMS.TPS.Common.Model.API.PlanSetup setup in course.PlanSetups)
                    {
                        if (setup.StructureSet != null)
                        {
                            foreach (VMS.TPS.Common.Model.API.Structure str in setup.StructureSet.Structures)
                            {
                                if (str.Name.ToUpper().Contains(_selectedStructure.Name.ToUpper()))
                                {
                                    bDone = true;
                                    this.VolumeChartSeries.Add(new KeyValuePair <string, float>((++patcnt).ToString(),
                                                                                                (float)str.Volume));
                                    foreach (VolumeViewModel vol in AllVolumes)
                                    {
                                        if (str.Volume > vol.Range[0] && str.Volume < vol.Range[1])
                                        {
                                            _dictpatients[vol].Add(pat);
                                            //break;
                                        }
                                    }
                                }
                                if (bDone)
                                {
                                    break;
                                }
                            }
                        }
                        if (bDone)
                        {
                            break;
                        }
                    }
                    if (bDone)
                    {
                        break;
                    }
                }
                _vapp.ClosePatient();
            }
        }
Пример #2
0
        void ShowPlans()
        {
            if (_selectedpatient != null)
            {
                VMS.TPS.Common.Model.API.Patient          pat      = _vapp.OpenPatientById(_selectedpatient.MRN);
                List <VMS.TPS.Common.Model.API.PlanSetup> lstPlans = new List <VMS.TPS.Common.Model.API.PlanSetup>();
                foreach (VMS.TPS.Common.Model.API.Course c in pat.Courses)
                {
                    lstPlans.AddRange(c.PlanSetups);
                }
                List <VMS.TPS.Common.Model.API.Beam> lstBeams = new List <VMS.TPS.Common.Model.API.Beam>();
                lstBeams.AddRange(lstPlans[0].Beams);

                ESAPISimpleUI.View.ListBoxWindow win = new ESAPISimpleUI.View.ListBoxWindow("Test selection box", "Select a plan", System.Windows.Controls.SelectionMode.Single, ESAPISimpleUI.View.ViewType.DataGrid,
                                                                                            lstPlans);
                bool bOK = win.ShowDialog().Value;
                if (bOK)
                {
                    List <VMS.TPS.Common.Model.API.PlanSetup> lstSelectedPlans = win.SelectedItems.Cast <VMS.TPS.Common.Model.API.PlanSetup>().ToList();
                    if (lstSelectedPlans != null && lstSelectedPlans.Count > 0)
                    {
                        ESAPISimpleUI.View.ListBoxWindow win2 = new ESAPISimpleUI.View.ListBoxWindow("Test selection box", "Select beams",
                                                                                                     System.Windows.Controls.SelectionMode.Multiple, ESAPISimpleUI.View.ViewType.DataGrid,
                                                                                                     lstSelectedPlans[0].Beams);
                        bOK = win2.ShowDialog().Value;
                        if (bOK)
                        {
                            List <VMS.TPS.Common.Model.API.Beam> lstSelectedBeams = win2.SelectedItems.Cast <VMS.TPS.Common.Model.API.Beam>().ToList();
                        }
                    }
                }


                _vapp.ClosePatient();
            }
        }
Пример #3
0
        static void Execute(VMS.TPS.Common.Model.API.Application app)
        {
            var folderPath = @"\\10.208.223.10\Eclipse";

            folderPath = Path.Combine(folderPath, "ResearchProjects", "AverageDose");

            // For Non-clinical Eclipse
            var computerName = System.Environment.GetEnvironmentVariable("COMPUTERNAME");
            var homePath     = System.Environment.GetEnvironmentVariable("HOMEPATH");
            var homeDrive    = System.Environment.GetEnvironmentVariable("HOMEDRIVE");

            if (computerName == "ECQ275" || computerName == "ECM516NC" || computerName == "XPS13")
            {
                folderPath = homeDrive + Path.Combine(homePath, @"Desktop\AverageDose");
            }

            var patientId = "Physics";
            var courseId  = "DLG_TEST_06X";
            var planId    = "06X";

            var currentPatient   = app.OpenPatientById(patientId);
            var currentCourse    = EsapiHelpers.GetCourse(currentPatient, courseId);
            var currentPlanSetup = EsapiHelpers.GetPlanSetup(currentCourse, planId);

            var mainWindowViewModel = new MainWindowViewModel();

            mainWindowViewModel.FolderPath = folderPath;
            mainWindowViewModel.FileName   = "AverageDose.csv";

            if (currentPlanSetup.Beams.Count() > 0)
            {
                var query = currentPlanSetup.Beams.First().FieldReferencePoints.Where(p => !double.IsNaN(p.RefPointLocation.x));
                foreach (var p in query)
                {
                    var xDcs = p.RefPointLocation.x;
                    var yDcs = p.RefPointLocation.y;
                    var zDcs = p.RefPointLocation.z;

                    var pUcs = EsapiHelpers.DicomToUserCoordinates(xDcs, yDcs, zDcs, currentPlanSetup);

                    var x = pUcs[0];
                    var y = pUcs[1];
                    var z = pUcs[2];


                    mainWindowViewModel.FieldReferencePoints.Add(new AverageDoseInSensitiveVolume.Models.FieldReferencePoint(x, y, z, xDcs, yDcs, zDcs, p.ReferencePoint.Id));
                }
            }

            if (mainWindowViewModel.FieldReferencePoints.Count > 0)
            {
                mainWindowViewModel.SelectedFieldReferencePoint = mainWindowViewModel.FieldReferencePoints.First();
            }
            else
            {
                throw new InvalidOperationException("No reference point");
            }

            var doseVoxel = new DoseVoxel(currentPlanSetup);

            var voxel = doseVoxel.Voxel;

            // Add PinPoint 3D
            mainWindowViewModel.Cylinders.Add(new Cylinder("PinPoint 3D", 1.45, 2.9, voxel, 20, 20, 40));
            mainWindowViewModel.Cylinders.Add(new Cylinder("Semiflex 3D", 2.4, 4.8, voxel, 20, 20, 40));
            mainWindowViewModel.Cylinders.Add(new Cylinder("Semiflex", 2.75, 6.5, voxel, 20, 20, 40));
            mainWindowViewModel.Cylinders.Add(new Cylinder("Farmer", 3.05, 23, voxel, 20, 20, 40));

            var mainWindow = new MainWindow(mainWindowViewModel);

            mainWindow.ShowDialog();
        }
Пример #4
0
 void UpdateChartSeries()
 {
     foreach (KeyValuePair <string, List <MPatient> > kvp in _dictpatients)
     {
         kvp.Value.Clear();
     }
     foreach (MPatient pat in (_filterlevel > 0)?_patientRepository.GetSelectedPatients(_filterlevel - 1):_patientRepository.GetAllPatients())
     {
         bool bDone = false;
         VMS.TPS.Common.Model.API.Patient vpat = _vapp.OpenPatientById(pat.MRN);
         foreach (VMS.TPS.Common.Model.API.Course course in vpat.Courses)
         {
             foreach (VMS.TPS.Common.Model.API.PlanSetup setup in course.PlanSetups)
             {
                 if (setup.StructureSet != null)
                 {
                     foreach (VMS.TPS.Common.Model.API.Structure str in setup.StructureSet.Structures)
                     {
                         foreach (SiteViewModel site in AllSites)
                         {
                             foreach (string sz in site.Structures)
                             {
                                 if (str.Id.ToUpper().Contains(sz.ToUpper()))
                                 //if (site.Structures.Contains(str.Id.ToUpper()))
                                 {
                                     bDone = true;
                                     _dictpatients[site.Name].Add(pat);
                                     break;
                                 }
                             }
                             if (bDone)
                             {
                                 break;
                             }
                         }
                         if (bDone)
                         {
                             break;
                         }
                     }
                 }
                 if (bDone)
                 {
                     break;
                 }
             }
             if (bDone)
             {
                 break;
             }
         }
         if (!bDone)
         {
             _dictpatients[AllSites[AllSites.Count - 1].Name].Add(pat);
         }
         _vapp.ClosePatient();
     }
     this.SiteChartSeries = new ObservableCollection <KeyValuePair <string, int> >();
     foreach (KeyValuePair <string, List <MPatient> > kvp in _dictpatients)
     {
         this.SiteChartSeries.Add(new KeyValuePair <string, int>(kvp.Key, kvp.Value.Count));
     }
 }