Exemplo n.º 1
0
        private void btSelect_Click(object sender, EventArgs e)
        {
            try
            {
                AlgorithmsForm sel = new AlgorithmsForm(false);
                sel.ShowDialog();
                if (sel.DialogResult == System.Windows.Forms.DialogResult.OK)
                {
                    Filter[] filter = sel.Selection;

                    _filter = filter[0];
                    panelConfigs.SetFilter(_filter);
                    txFilter.Text = _filter.FilterType.FullName;

                    ExecuteFilter();

                }
                sel.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.GetType().FullName, ex.Message);
            }
        }
Exemplo n.º 2
0
        private void btAddAlgorithms_Click(object sender, EventArgs e)
        {
            AlgorithmsForm frm = new AlgorithmsForm(true);
            frm.ShowDialog(this);
            if (frm.DialogResult == DialogResult.OK)
            {
                Filter[] selection = frm.Selection;

                if (null != selection)
                {
                    foreach (Filter f in selection)
                    {
                        _algorithms.Add(new RowBatchAlgorithm(
                                f.Attributes["ShortName"].ToString(),
                                ((FilterCore)Activator.CreateInstance(f.FilterType)).GetDefaultConfigs(),
                                BatchFilterFactory.NodeFilterInputType.OriginalImages,
                                f,
                                null));
                    }
                }
            }
            GridAlgorithms.Refresh();
            frm.Dispose();
        }
Exemplo n.º 3
0
        private void btAddAlgorithms_Click(object sender, EventArgs e)
        {
            try
            {
                AlgorithmsForm frm = new AlgorithmsForm(true);
                frm.ShowDialog(this);
                if (frm.DialogResult == DialogResult.OK)
                {
                    Filter[] selection = frm.Selection;

                    BindingList<RowBatchFilter> datasource = (BindingList<RowBatchFilter>)gridAlgorithms.DataSource;

                    if (null != selection)
                    {
                        List<MetricExecBase> metrics;

                        foreach (Filter f in selection)
                        {
                            // Generate metrics by default!
                            metrics = null;

                            Metric m = Factory.GetMetricsFromFilter(f.FilterType);

                            if (null != m)
                            {
                                metrics = new List<MetricExecBase>();

                                SortedDictionary<string, Metric.MetricDelegate> ms = m.GetListMetrics();

                                // brute-force adding
                                foreach (string key in ms.Keys)
                                {
                                    // input - output
                                    metrics.Add(new MetricExec(key, ms[key]));

                                    // reference
                                    foreach (RowImage r in _references)
                                    {
                                        metrics.Add(new MetricExecReference(key, ms[key], r.Item1));
                                    }
                                }

                            }

                            datasource.Add(new RowBatchFilter(
                                    f.Attributes["ShortName"].ToString(),
                                    ((FilterCore)Activator.CreateInstance(f.FilterType)).GetDefaultConfigs(),
                                    f,
                                    metrics,
                                    SelectedRowNode.Item1));
                        }
                    }
                }
                gridAlgorithms.Refresh();
                frm.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.GetType().FullName, ex.Message);
            }
        }