예제 #1
0
 /// <summary>
 /// Node that executes a certain filter.
 /// </summary>
 /// <param name="graphFilter">The graph that holds this node.</param>
 /// <param name="filter">The filter to execute.</param>
 /// <param name="configs">The configurations of the filter to execute.</param>
 /// <param name="measures">The measures to calculate.</param>
 public NodeFilter(
             Graph graphFilter, Node parent, Filter filter,
             SortedDictionary<string, object> configs,
             List<MetricExecBase> measures)
     : base(graphFilter, parent)
 {
     this.filter = filter;
     this.configs = configs;
     this.measures = measures;
 }
예제 #2
0
 /// <summary>
 /// Defines the execution of a filter in the batch.
 /// </summary>
 /// <param name="Item1">The name of the filter (for display only).</param>
 /// <param name="Item2">The configurations of the filter.</param>
 /// <param name="Item3">The filter to execute.</param>
 /// <param name="Item4">The metric's setup for the filter.</param>
 /// <param name="Item5">The Guid of the RowNode that has this RowBatchFilter.</param>
 public RowBatchFilter(
         string Item1, SortedDictionary<string, object> Item2, Filter Item3,
         List<MetricExecBase> Item4, Guid Item5)
 {
     this.Item1 = Item1;
     this.Item2 = Item2;
     this.Item3 = Item3;
     this.Item4 = Item4;
     this.Item5 = Item5;
 }
        public MeasuresEditForm(Filter filter, WeakImage[] references, List<MetricExecBase> metrics)
        {
            InitializeComponent();

            try
            {
                _filter = filter;
                _references = references;
                _originalMetrics = metrics;

                DialogResult = System.Windows.Forms.DialogResult.Cancel;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.GetType().FullName, ex.Message);
            }
        }
예제 #4
0
        public void SetFilter(Filter filter)
        {
            if (null == filter)
                return;

            _params.Clear();
            flowLayoutPanel1.Controls.Clear();

            // ---------------------------------------------

            FilterCore f = (FilterCore)System.Activator.CreateInstance(filter.FilterType);
            SortedDictionary<string, object> dict = f.GetDefaultConfigs();

            if (dict != null)
            {
                foreach (String k in dict.Keys)
                {
                    double defaultValue;
                    double minValue;
                    double maxValue;
                    double step;
                    Rangeable val = dict[k] as Rangeable;

                    if (null != val)
                    {
                        defaultValue = val.Value;
                        minValue = val.Min;
                        maxValue = val.Max;
                        step = val.Step;
                    }
                    else
                    {
                        defaultValue = double.Parse(dict[k].ToString());
                        minValue = double.MinValue;
                        maxValue = double.MaxValue;
                        step = 0.000001;
                    }

                    AddParam(k, defaultValue, minValue, maxValue, step);
                }
            }
        }
예제 #5
0
 private void bt_FilterExecuted(BatchFilter sender, Image input, Image output, Filter filter, SortedDictionary<string, object> configs)
 {
     FilterExecutedDelegate inv = new FilterExecutedDelegate(bt_FilterExecuted_threadsafe_);
     this.Invoke(inv, sender, input, output, filter, configs);
 }
예제 #6
0
 /// <summary>
 /// Called to signal the end of a filter measurement.
 /// </summary>
 /// <param name="input">The input of the filter.</param>
 /// <param name="ouput">The output of the filter.</param>
 /// <param name="filter">The filter executed.</param>
 /// <param name="configs">The configurations used by the filter.</param>
 /// <param name="measures">The measures of the filter executed.</param>
 protected void OnFilterMeasured(WeakImage input, WeakImage output, Filter filter, SortedDictionary<string, object> configs, List<MetricResult> measures, TimeSpan duration)
 {
     if (null != FilterMeasured)
         FilterMeasured(input, output, filter, configs, measures, duration);
 }
예제 #7
0
 /// <summary>
 /// Called to signal the end of a filter execution.
 /// </summary>
 /// <param name="input">The input of the filter.</param>
 /// <param name="ouput">The output of the filter.</param>
 /// <param name="filter">The filter executed.</param>
 /// <param name="configs">The configurations used by the filter.</param>
 protected void OnFilterExecuted(WeakImage input, WeakImage output, Filter filter, SortedDictionary<string, object> configs, TimeSpan duration)
 {
     if (null != FilterExecuted)
         FilterExecuted(input, output, filter, configs, duration);
 }
예제 #8
0
 /// <summary>
 /// Executed when a filter in a graph finishes measurement.
 /// </summary>
 /// <param name="input">The input of the filter.</param>
 /// <param name="output">The output of the filter.</param>
 /// <param name="filter">The filter executed.</param>
 /// <param name="configs">The configurations used by the filter.</param>
 /// <param name="results">The measures of the filter executed.</param>
 /// <param name="duration">The duration of the execution of the filter.</param>
 protected void filter_f_FilterMeasured(WeakImage input, WeakImage output, Filter filter, SortedDictionary<string, object> configs, List<MetricResult> results, TimeSpan duration)
 {
     OnFilterMeasured(input, output, filter, configs, results, duration);
 }
예제 #9
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);
            }
        }
예제 #10
0
 /// <summary>
 /// Called to signal the end of a filter execution.
 /// </summary>
 /// <param name="sender">The BatchFilter sender of the event.</param>
 /// <param name="input">The input of the filter.</param>
 /// <param name="output">The output of the filter.</param>
 /// <param name="filter">The filter executed.</param>
 /// <param name="configs">The configurations used by the filter.</param>
 private void OnFilterExecuted(BatchFilter sender, WeakImage input, WeakImage output, Filter filter, SortedDictionary<string, object> configs, TimeSpan duration)
 {
     if (null != FilterExecuted)
     {
         FilterExecuted(sender, input, output, filter, configs, duration);
     }
 }
예제 #11
0
 // MEASURED
 private void bt_FilterMeasured(BatchFilter sender, WeakImage input, WeakImage output, Filter filter, SortedDictionary<string, object> configs, List<MetricResult> measures, TimeSpan duration)
 {
     try
     {
         FilterMeasuredDelegate inv = new FilterMeasuredDelegate(bt_FilterMeasured_threadsafe_);
         this.Invoke(inv, sender, input, output, filter, configs, measures, duration);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.GetType().FullName, ex.Message);
     }
 }
예제 #12
0
 /// <summary>
 /// Results of the execution of a filter.
 /// </summary>
 /// <param name="Item1">The name of the filter (for display only).</param>
 /// <param name="Item2">The input image used by the filter.</param>
 /// <param name="Item3">The output of the filter.</param>
 /// <param name="Item4">The list of calculated metrics.</param>
 /// <param name="Item5">The filter used.</param>
 /// <param name="Item6">The filter's configurations.</param>
 public RowResults(string Item1, WeakImage Item2, WeakImage Item3,
         List<MetricResult> Item4, Filter Item5,
         SortedDictionary<string, object> Item6, TimeSpan Item7)
 {
     this.Item1 = Item1;
     this.Item2 = Item2;
     this.Item3 = Item3;
     this.Item4 = Item4;
     this.Item5 = Item5;
     this.Item6 = Item6;
     this.Item7 = Item7;
 }
예제 #13
0
 /// <summary>
 /// Executed when a filter in a graph finishes measurement.
 /// </summary>
 /// <param name="input">The input image of the filter.</param>
 /// <param name="output">The output image of the filter.</param>
 /// <param name="filter">The filter executed.</param>
 /// <param name="configs">The configurations used by the filter.</param>
 /// <param name="measures">The measures of the filter executed.</param>
 private void _graph_FilterMeasured(WeakImage input, WeakImage output, Filter filter, SortedDictionary<string, object> configs, List<MetricResult> measures, TimeSpan duration)
 {
     OnFilterMeasured(this, input, output, filter, configs, measures, duration);
 }
예제 #14
0
 /// <summary>
 /// Executed when a filter in a graph finishes execution.
 /// </summary>
 /// <param name="input">The input image of the filter.</param>
 /// <param name="output">The output image of the filter.</param>
 /// <param name="filter">The filter executed.</param>
 /// <param name="configs">The configurations used by the filter.</param>
 private void _graph_FilterExecuted(WeakImage input, WeakImage output, Filter filter, SortedDictionary<string, object> configs, TimeSpan duration)
 {
     OnFilterExecuted(this, input, output, filter, configs, duration);
 }
예제 #15
0
 private void bt_FilterMeasured(BatchFilter sender, Image input, Image output, Filter filter, SortedDictionary<string, object> configs, List<MetricResult> measures)
 {
     FilterMeasuredDelegate inv = new FilterMeasuredDelegate(bt_FilterMeasured_threadsafe_);
     this.Invoke(inv, sender, input, output, filter, configs, measures);
 }
예제 #16
0
        private void bt_FilterMeasured_threadsafe_(BatchFilter sender, Image input, Image output, Filter filter, SortedDictionary<string, object> configs, List<MetricResult> measures)
        {
            // Add row to GridResults ...
            _results.Add(new RowResults(filter.Attributes["ShortName"].ToString(), input, output, measures, filter, configs));

            GridResults.Refresh();
        }
예제 #17
0
        private void bt_FilterMeasured_threadsafe_(BatchFilter sender, WeakImage input, WeakImage output, Filter filter, SortedDictionary<string, object> configs, List<MetricResult> measures, TimeSpan duration)
        {
            try
            {
                Monitor.TryEnter(filterMeas_lock, -1);

                ++_executedFiltros;
                lbXofY.Text = string.Format("{0}/{1}", _executedFiltros, _totFiltros);
                progressExec.Value = (int)(Math.Min(1.0, _executedFiltros / (_totFiltros * 1.0)) * progressExec.Maximum);

                if (ckForgetNoMeasures.Checked)
                {
                    // Forget the row
                    if (measures == null || measures.Count == 0)
                        return;
                }

                // Add row to GridResults ...
                _results.Add(new RowResults(filter.Attributes["ShortName"].ToString(), input, output, measures, filter, configs, duration));

                Flush(false, true);

                gridResults.Refresh();

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.GetType().FullName, ex.Message);
            }
            finally
            {
                Monitor.Exit(filterMeas_lock);
            }
        }