Пример #1
0
        public VolumesViewModel(VMS.TPS.Common.Model.API.Application vapp, PatientRepository patientRepository, SiteRepository siteRepository, VolumeRepository volumeRepository, int filterlevel)
        {
            if (patientRepository == null)
            {
                throw new ArgumentNullException("paientRepository");
            }
            if (siteRepository == null)
            {
                throw new ArgumentNullException("siteRepository");
            }
            if (volumeRepository == null)
            {
                throw new ArgumentNullException("volumeRepository");
            }
            base.DisplayName = Strings.VolumesViewModel_DisplayName;

            _patientRepository = patientRepository;
            _siteRepository    = siteRepository;
            _volumeRepository  = volumeRepository;
            _vapp            = vapp;
            _filterlevel     = filterlevel;
            _avialstructures = new List <StructureTempViewModel>();
            _dictpatients    = new Dictionary <VolumeViewModel, List <MPatient> >();


            // Populate the AllVolumes collection.
            this.CreateVolumes();
        }
Пример #2
0
        protected override void OnStartup(StartupEventArgs e)
        {
            base.OnStartup(e);

            MainWindow window = new MainWindow();

            _vapp = VMS.TPS.Common.Model.API.Application.CreateApplication(null, null);

            var viewModel = new MainWindowViewModel(null, _vapp);

            // When the ViewModel asks to be closed,
            // close the window.
            EventHandler handler = null;

            handler = delegate
            {
                viewModel.RequestClose -= handler;
                window.Close();
            };
            viewModel.RequestClose += handler;

            // Allow all controls in the window to
            // bind to the ViewModel by setting the
            // DataContext, which propagates down
            // the element tree.
            window.DataContext = viewModel;

            window.Closed += OnMainWindowClose;
            window.Show();
        }
        public MainWindowViewModel(string szDataFile, VMS.TPS.Common.Model.API.Application vapp)
        {
            base.DisplayName = Strings.MainWindowViewModel_DisplayName;

            _siteRepository = new SiteRepository(null);

            _volumeRepository = new VolumeRepository(null);

            _vapp = vapp;
            //LoadEclipseApp();

            _patientRepository = new PatientRepository(_vapp.PatientSummaries.ToList(), 12);
        }
Пример #4
0
        private void InitializeEsapi()
        {
            // The ESAPI Application object must be created before the PluginScriptContext
#if ESAPI_13
            _app = Application.CreateApplication(null, null);
#elif ESAPI_15
            _app = Application.CreateApplication();
#endif

            // The PluginScriptContext requires the command-line arguments and the Application object
            // (if there are no command-line arguments, the return is null)
            _scriptContext = StandaloneScriptContext.From(Environment.GetCommandLineArgs(), _app);
        }
Пример #5
0
        public PatientsViewModel(VMS.TPS.Common.Model.API.Application vapp, PatientRepository patientRepository, int filterlevel)
        {
            if (patientRepository == null)
            {
                throw new ArgumentNullException("paientRepository");
            }

            base.DisplayName = Strings.PatientsViewModel_DisplayName;

            _patientRepository = patientRepository;

            _filterlevel = filterlevel;

            // Populate the AllPatients collection with MPatientViewModel.
            this.CreatePatients();
        }
Пример #6
0
        public SelectedPatientsViewModel(VMS.TPS.Common.Model.API.Application vapp, PatientRepository patientRepository)
        {
            if (patientRepository == null)
            {
                throw new ArgumentNullException("patientRepository");
            }

            base.DisplayName = Strings.SelectedPatientsViewModel_DisplayName;

            _vapp = vapp;

            _patientRepository = patientRepository;

            // Subscribe for notifications of when a new patient is added from the filter.
            _patientRepository.SelectedPatientAdded += this.OnSelectedPatientAddedToRepository;

            // Populate theSelectedPatients collection with MPatientViewModels.
            this.CreateSelectedPatients();
            _showplanscommand = new RelayCommand(param => this.ShowPlans());
        }
Пример #7
0
        public SitesViewModel(VMS.TPS.Common.Model.API.Application vapp, PatientRepository patientRepository, SiteRepository siteRepository, int filterlevel)
        {
            if (patientRepository == null)
            {
                throw new ArgumentNullException("paientRepository");
            }
            if (siteRepository == null)
            {
                throw new ArgumentNullException("siteRepository");
            }
            base.DisplayName = Strings.SitesViewModel_DisplayName;

            _patientRepository = patientRepository;
            _siteRepository    = siteRepository;
            _vapp        = vapp;
            _filterlevel = filterlevel;

            _dictpatients = new Dictionary <string, List <MPatient> >();

            // Populate the AllSites collection with SiteViewModels.
            this.CreateSites();
        }
Пример #8
0
        private void Application_Startup(object sender, StartupEventArgs e)
        {
            var _patientId = String.Empty;
            var _courseId  = string.Empty;
            var _planId    = String.Empty;

            if (e.Args.Count() > 0)
            {
                _patientId = e.Args.ElementAt(0).Split(';').First();
                if (e.Args.Count() > 1)
                {
                    _courseId = e.Args.ElementAt(0).Split(';').ElementAt(1);
                }
                if (e.Args.Count() > 2)
                {
                    _planId = e.Args.ElementAt(0).Split(';').ElementAt(2);
                }
            }
            try
            {
                app = VMS.TPS.Common.Model.API.Application.CreateApplication();
                IEventAggregator eventAggregator = new EventAggregator();
                var mv = new MainView
                {
                    DataContext = new MainViewModel(
                        new PatientNavigationViewModel(app, _patientId, _courseId, _planId, eventAggregator),
                        new ScanPlotViewModel(eventAggregator))
                };
                mv.ShowDialog();
                app.Dispose();
            }
            catch (ApplicationException ex)
            {
                app.Dispose();
                MessageBox.Show(ex.Message);
            }
        }
 /// <summary>
 /// Create an Eclipse Application instance
 /// </summary>
 void LoadEclipseApp()
 {
     _vapp = VMS.TPS.Common.Model.API.Application.CreateApplication(null, null);
 }
Пример #10
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();
        }