Пример #1
0
        public override void Run(PluginScriptContext context)
        {
            // TODO : Add here the code that is called when the script is launched from Eclipse.
            User         user         = context.CurrentUser;
            StructureSet structureSet = context.StructureSet;

            if (structureSet == null)
            {
                MessageBox.Show("No structureSet is loaded.");
                return;
            }

            System.Reflection.Assembly assembly = System.Reflection.Assembly.GetExecutingAssembly();
            FileVersionInfo            fvi      = FileVersionInfo.GetVersionInfo(assembly.Location);
            string scriptVersion = fvi.FileVersion;

            var window     = new Window();
            var mainWindow = new AutoStructure.MainControl();

            window.Title = "AutoStructureMaker " + scriptVersion;

            window.Content          = mainWindow;
            mainWindow.structureSet = structureSet;
            mainWindow.UserId       = user.Name;
            window.ShowDialog();
        }
Пример #2
0
        /*public void Execute(ScriptContext scriptContext, Window mainWindow)
         * {
         *
         * }*/

        public override void Execute(PluginScriptContext scriptContext, Window mainWindow)
        {
            Run(scriptContext.CurrentUser,
                scriptContext.Patient,
                scriptContext.Image,
                scriptContext.StructureSet,
                scriptContext.PlanSetup,
                scriptContext.PlansInScope,
                scriptContext.PlanSumsInScope,
                mainWindow);
        }
Пример #3
0
        public override void Run(PluginScriptContext context)
        {
            var esapiService = new EsapiService(context);

            using (var ui = new UiRunner())
            {
                ui.Run(() =>
                {
                    var window         = new MainWindow();
                    var dialogService  = new DialogService(window);
                    var viewModel      = new MainViewModel(esapiService, dialogService);
                    window.DataContext = viewModel;
                    window.ShowDialog();
                });
            }
        }
Пример #4
0
        public override void Run(PluginScriptContext context)
        {
            PlanSetup  plan         = context?.PlanSetup as ExternalPlanSetup;
            QAProtocol rtQAProtocol = new QAProtocol();

            Stream         myStream        = null;
            OpenFileDialog openFileDialog1 = new OpenFileDialog();

            // Locate protocols in the subfolder of running DLL directory.
            string RelativePath = "\\QAProtocols\\";

            openFileDialog1.InitialDirectory =
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) + RelativePath;
            openFileDialog1.Filter =
                "RT Protocol files (*.protocol)|*.protocol|All files (*.*)|*.*";
            openFileDialog1.FilterIndex      = 1;
            openFileDialog1.RestoreDirectory = true;

            if (openFileDialog1.ShowDialog() == true)
            {
                try
                {
                    if ((myStream = openFileDialog1.OpenFile()) != null)
                    {
                        using (myStream)
                        {
                            // reading in and parsing the protocol file
                            rtQAProtocol.ReadinProtocol(myStream);
                        }
                        myStream.Close();

                        // Plan check and display results
                        rtQAProtocol.ApplyToPlan(plan);
                        rtQAProtocol.DisplayResults();
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Error: Could not read file from disk. Original error: "
                                    + ex.Message);
                }
            }
            return;
        }
Пример #5
0
        public override void Run(PluginScriptContext context)
        {
            // Define the desired structure ID
            var structureId = GetStructureIdFromSettings();

            // Find the structure in the current structure set
            var structure = context?.StructureSet?.Structures?.FirstOrDefault(x => x.Id == structureId);

            if (structure == null)
            {
                throw new InvalidOperationException("Unable to find the structure.");
            }

            // Calculate D2cc[Gy]
            var d2cc = context?.PlanSetup?.GetDoseAtVolume(structure, 2, VolumePresentation.AbsoluteCm3, DoseValuePresentation.Absolute);

            if (d2cc == null)
            {
                throw new InvalidOperationException("Unable to calculate the dose metric.");
            }

            // Show the result
            MessageBox.Show($"{structureId} D2cc[Gy] = {d2cc}");
        }
Пример #6
0
 public ScriptContext(PluginScriptContext context)
     : base(context)
 {
 }