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); } }
private void OpenAlgorithm_CurrentRow() { if (null != GridAlgorithms.SelectedRows && GridAlgorithms.SelectedRows.Count > 0) { AlgorithmsForm frm = new AlgorithmsForm(false); frm.ShowDialog(this); if (frm.DialogResult == DialogResult.OK) { Filter[] selection = frm.Selection; if (null != selection) { BindingList<RowBatchAlgorithm> datasource = (BindingList<RowBatchAlgorithm>)GridAlgorithms.DataSource; RowBatchAlgorithm binded; foreach (DataGridViewRow r in GridAlgorithms.SelectedRows) { binded = (RowBatchAlgorithm)r.DataBoundItem; datasource[r.Index] = new RowBatchAlgorithm( selection[0].Attributes["ShortName"].ToString(), binded.Item2, binded.Item3, selection[0], binded.Item5); } } } } }
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(); }
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); } }
private void OpenAlgorithmCurrentRow() { try { if (null != gridAlgorithms.SelectedRows && gridAlgorithms.SelectedRows.Count > 0) { AlgorithmsForm frm = new AlgorithmsForm(false); frm.ShowDialog(this); if (frm.DialogResult == DialogResult.OK) { Filter[] selection = frm.Selection; if (null != selection) { BindingList<RowBatchFilter> datasource = (BindingList<RowBatchFilter>)gridAlgorithms.DataSource; RowBatchFilter binded; foreach (DataGridViewRow r in gridAlgorithms.SelectedRows) { binded = (RowBatchFilter)r.DataBoundItem; datasource[r.Index] = new RowBatchFilter( selection[0].Attributes["ShortName"].ToString(), ((FilterCore)Activator.CreateInstance(selection[0].FilterType)).GetDefaultConfigs(), selection[0], binded.Item4, binded.Item5); } } } } } catch (Exception ex) { MessageBox.Show(ex.GetType().FullName, ex.Message); } }