/// <summary> /// Initializes a new instance of the <see cref="Baimp.PipelineController"/> class. /// </summary> /// <param name="project">Project.</param> /// <param name="pipelineShelf">Frame where the pipeline should be.</param> public PipelineController(Project project, VBox pipelineShelf) { this.pipelineShelf = pipelineShelf; pipelineScroller = new ScrollView(); pipelineScroller.Content = currentPipeline; this.project = project; OnProjectDataChangged(new ProjectChangedEventArgs(null) { refresh = true }); InitializeControllerbar(); splitControllTab_pipelineScroller.PackEnd(pipelineScroller, true, true); algorithm = new AlgorithmTreeView(project.scanCollection); algorithm.MinWidth = 200; // TODO, save size as user property HPaned splitPipeline_Algorithm = new HPaned(); splitPipeline_Algorithm.Panel1.Content = algorithm; splitPipeline_Algorithm.Panel1.Resize = false; splitPipeline_Algorithm.Panel1.Shrink = false; splitPipeline_Algorithm.Panel2.Content = splitControllTab_pipelineScroller; splitPipeline_Algorithm.Panel2.Resize = true; splitPipeline_Algorithm.Panel2.Shrink = false; pipelineShelf.PackStart(splitPipeline_Algorithm, true, true); InitializeEvents(); }
public static void Main(string[] args) { bool show_help = false; string filename = null; string path = null; string featureExtraction = null; // commandline parsing var p = new OptionSet() { { "h|?|help", "show help screen", v => show_help = v != null }, { "f|file=", "project file to open", v => filename = v }, { "p|path=", "path to folder with scans", v => path = v }, { "e|extraction=", "select and run feature extraction", v => featureExtraction = v }, }; try { p.Parse(args); } catch (OptionException e) { Console.Out.WriteLine(e.Message); printHelp(p); return; } // print help if (show_help) { printHelp(p); return; } ThreadPool.SetMaxThreads(8, 16); // start application if (GetOS() == OSType.Unix) { toolkitType = ToolkitType.Gtk; } else if (GetOS() == OSType.MaxOSX) { toolkitType = ToolkitType.Cocoa; } else { toolkitType = ToolkitType.Gtk; } Application.Initialize(toolkitType); Project project = new Project(filename); Window w = new MainWindow(project); w.Show(); Application.Run(); w.Dispose(); Application.Dispose(); }
/// <summary> /// Initializes a new instance of the <see cref="Baimp.PipelineProcessor"/> class. /// </summary> /// <param name="project">Project.</param> /// <param name="cancellationToken">Cancellation token.</param> public PipelineProcessor(Project project, CancellationToken cancellationToken) { this.project = project; this.cancellationToken = cancellationToken; }
/// <summary> /// Execute the pipeline of the specified project. /// </summary> /// <param name="project">Project.</param> /// <returns>True if started, otherwise false<returns> public bool Execute(Project project) { if (nodes.Count == 0) { return false; } cancelRequest = new CancellationTokenSource(); CancellationToken token = cancelRequest.Token; project.NotifyPipelineStart(this); foreach (PipelineNode pNode in nodes) { foreach(Tuple<IType[], Result[]> results in pNode.results) { foreach (IType result in results.Item1) { result.Dispose(); } } pNode.results.Clear(); pNode.ClearInputQueue(); } PipelineProcessor process = new PipelineProcessor(project, token); Task executionTask = Task.Factory.StartNew(() => { foreach (PipelineNode pNode in nodes) { if (token.IsCancellationRequested) { break; } if (pNode.IsReady() && pNode.algorithm.Input.Count == 0) { bool isConnected = false; foreach (MarkerNode mNode in pNode.MNodes) { if (mNode.Edges.Count > 0) { isConnected = true; } } if (isConnected) { Result[] zeroInput = new Result[0]; process.Start(pNode, zeroInput, int.MaxValue); } } } }).ContinueWith(fromTask => { Application.Invoke(() => project.NotifyPipelineStop(this)); }); return true; }
public PipelineView(Project project) { this.project = project; PipelineName = "Untitled " + globalId; globalId++; }
/// <summary> /// Initializes a new instance of the <see cref="Baimp.MainWindow"/> class. /// </summary> /// <param name="project">Project.</param> public MainWindow(Project project) { this.project = project; Initialize(); }
/// <summary> /// Call only, if mNodes are set from outside /// </summary> public void InitializeNodes(Project project) { this.project = project; AlgorithmType = algorithmType; foreach (MarkerNode mNode in mNodes) { mNode.parent = this; if (mNode.IsInput) { if (mNode.Position < algorithm.Input.Count) { mNode.compatible = algorithm.Input[mNode.Position]; } } else { if (mNode.Position < algorithm.Output.Count) { mNode.compatible = algorithm.Output[mNode.Position]; } } } isInitialized = true; }
public PipelineNode(Project project, PipelineView parent, string algoType, Rectangle bound) { this.project = project; this.parent = parent; mNodes = new List<MarkerNode>(); Initialize(); AlgorithmType = algoType; this.bound = bound; int i = 0; foreach (Compatible c in algorithm.Input) { this.Add(new MarkerNode(this, c, i, true)); i++; } i = 0; foreach (Compatible c in algorithm.Output) { this.Add(new MarkerNode(this, c, i, false)); i++; } isInitialized = true; }