예제 #1
0
        /// <summary>
        /// Provides a representation of a graph-like structure for representing
        /// the execution of interdependent filters.
        /// </summary>
        /// <param name="batchFilter">The parent BatchFilter that holds this graph.</param>
        /// <param name="relations">List of relations between nodes.</param>
        /// <param name="filters">List of filters.</param>
        public Graph(
                BatchFilter batchFilter,
                List<RowNodeRelation> relations,
                List<RowBatchFilter> filters)
        {
            _batchFilter = batchFilter;

            // Create root node, dependent of the input images associated with the BatchFilter ...
            _root = new Node(this, null);

            MakeGraph(Guid.Empty, _root, relations, filters);
        }
예제 #2
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();
        }
예제 #3
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);
 }
예제 #4
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);
 }
예제 #5
0
 private void bt_BatchFinished_threadsafe_(BatchFilter sender)
 {
     MessageBox.Show(this, "Finished!");
 }
예제 #6
0
 private void bt_BatchFinished(BatchFilter sender)
 {
     BatchFinishedDelegate inv = new BatchFinishedDelegate(bt_BatchFinished_threadsafe_);
     this.Invoke(inv, sender);
 }
예제 #7
0
        private void mnuStart_Click(object sender, EventArgs e)
        {
            try
            {
                if (_results != null && _results.Count > 0)
                {

                    switch (MessageBox.Show("Clean current results?", "Question", MessageBoxButtons.YesNoCancel))
                    {
                        case System.Windows.Forms.DialogResult.Yes:
                            _results.Clear();
                            break;
                        case System.Windows.Forms.DialogResult.No:

                            break;
                        case System.Windows.Forms.DialogResult.Cancel:
                            return;
                    }
                }

                // Start batch
                _bt = new BatchFilter(TreeViewToRowNodeRelation(), _images.ToList(), _filters.ToList());

                if (rdAfterExecMeas.Checked)
                {
                    _bt.FilterMeasured += new FilterMeasuredDelegate(bt_FilterMeasured);
                }
                if (rdAfterExec.Checked)
                {
                    _bt.FilterExecuted += new FilterExecutedDelegate(bt_FilterExecuted);
                }
                _bt.BatchFinished += new BatchFinishedDelegate(bt_BatchFinished);
                // --

                _totFiltros = _bt.CountFilters;
                if (_totFiltros == 0)
                {
                    MessageBox.Show("No filters to execute ...");
                    return;
                }

                _executedFiltros = 0;
                lbXofY.Text = string.Format("{0}/{1}", _executedFiltros, _totFiltros);
                progressExec.Value = 0;

                // --
                _bt.Start();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.GetType().FullName, ex.Message);
            }
        }
예제 #8
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);
     }
 }
예제 #9
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);
            }
        }
예제 #10
0
 private void bt_BatchFinished_threadsafe_(BatchFilter sender)
 {
     try
     {
         Flush(true, false);
         MessageBox.Show(this, "Finished!");
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.GetType().FullName, ex.Message);
     }
 }
예제 #11
0
 // FINISHED
 private void bt_BatchFinished(BatchFilter sender)
 {
     try
     {
         BatchFinishedDelegate inv = new BatchFinishedDelegate(bt_BatchFinished_threadsafe_);
         this.Invoke(inv, sender);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.GetType().FullName, ex.Message);
     }
 }
예제 #12
0
 /// <summary>
 /// Called to signal the end of a filter measurement.
 /// </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>
 /// <param name="measures">The measures of the filter executed.</param>
 private void OnFilterMeasured(BatchFilter sender, WeakImage input, WeakImage output, Filter filter, SortedDictionary<string, object> configs, List<MetricResult> measures, TimeSpan duration)
 {
     if (null != FilterMeasured)
         FilterMeasured(sender, input, output, filter, configs, measures, duration);
 }
예제 #13
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);
     }
 }
예제 #14
0
 /// <summary>
 /// Called to signal the end of a batch execution.
 /// </summary>
 /// <param name="sender"></param>
 private void OnBatchFinished(BatchFilter sender)
 {
     if (null != BatchFinished)
         BatchFinished(this);
 }