public void SetLayerChainItems(PrefabInterpretationLogic logic) { if (logic is LayerInterpretationLogic) { LayerInterpretationLogic layerLog = logic as LayerInterpretationLogic; List <string> layernames = new List <string>(); List <Dictionary <string, object> > parameters = new List <Dictionary <string, object> >(); ChainLoader.GetLayerNamesAndParameters(layerLog.LayerDirectory, layernames, parameters); LayerChainItems = new ObservableCollection <LayerChainItem>(); if (layerLog.Layers != null) { for (int i = 0; i < layernames.Count; i++) { LayerChainItem item = new LayerChainItem(); item.Name = System.IO.Path.GetFileNameWithoutExtension(layernames[i]); item.FullPath = layernames[i]; foreach (string key in parameters[i].Keys) { string val = parameters[i][key] as string; if (val != null) { item.ParameterKeys.Add(key); item.ParameterValues.Add(val); } } LayerChainItems.Add(item); } } //List<string> dirs = new List<string>(); //dirs.Add(layerLog.LayerDirectory); //var alllayers = ChainLoader.GetAllLayerNames(dirs); //AllLayers = new ObservableCollection<LayerChainItem>(); //foreach (string layer in alllayers) //{ // LayerChainItem item = new LayerChainItem(); // item.Name = System.IO.Path.GetFileNameWithoutExtension(layer); // string path = System.IO.Path.GetDirectoryName(layer); // if (System.IO.Path.Equals(path, layerLog.LayerDirectory)) // { // item.FullPath = item.Name; // }else // item.FullPath = layer; // AllLayers.Add(item); //} } else { Visibility = System.Windows.Visibility.Collapsed; } }
public static VideoFrames FromAnnotations(LayerInterpretationLogic logic) { VideoFrames frames = new VideoFrames(); frames._mode = Mode.Annotations; frames._annotationImages = GetAllImageIdsUsingAllLibrariesFromLayers(logic); return(frames); }
public static VideoInterpreter FromAnnotations(LayerInterpretationLogic logic) { VideoInterpreter i = new VideoInterpreter(logic); i._frames = VideoFrames.FromAnnotations(logic); i._interpretFrame = new Thread(i._interpretFrame_DoWork); i._interpretFrame.Priority = ThreadPriority.Highest; i._interpretFrame.Start(); i._framesCollection = new VirtualizingCollection <BitmapSource>(i.FrameCount, i.GetFramesInRange); return(i); }
public void SetLayerChainItems(PrefabInterpretationLogic logic) { LayerChainItems = new ObservableCollection <LayerChainItem>(); if (logic is LayerInterpretationLogic) { LayerInterpretationLogic layerLog = logic as LayerInterpretationLogic; _layerInterpretLogic = layerLog; List <string> layernames = new List <string>(); List <Dictionary <string, object> > parameters = new List <Dictionary <string, object> >(); ChainLoader.GetLayerNamesAndParameters(layerLog.LayerDirectory, layernames, parameters); for (int i = 0; i < layernames.Count; i++) { LayerChainItem item = new LayerChainItem(); item.Name = System.IO.Path.GetFileName(layernames[i]); item.RelativePath = layernames[i]; item.FullPath = System.IO.Path.GetFullPath(layerLog.LayerDirectory + "/" + layernames[i]); foreach (string key in parameters[i].Keys) { object val = parameters[i][key]; if (val != null) { item.ParameterKeys.Add(key); item.ParameterValues.Add(val); } } LayerChainItems.Add(item); } //List<string> dirs = new List<string>(); //dirs.Add(layerLog.LayerDirectory); //var alllayers = ChainLoader.GetAllLayerNames(dirs); //AllLayers = new ObservableCollection<LayerChainItem>(); //foreach (string layer in alllayers) //{ // LayerChainItem item = new LayerChainItem(); // item.Name = System.IO.Path.GetFileName(layer); // string path = System.IO.Path.GetDirectoryName(layer); // if (System.IO.Path.Equals(path, layerLog.LayerDirectory)) // { // item.RelativePath = item.Name; // }else // item.RelativePath = layer; // item.FullPath = System.IO.Path.GetFullPath(layerLog.LayerDirectory + "/" + layer); // AllLayers.Add(item); //} } else { LayerChainItem item = new LayerChainItem(); item.Name = "prefab_identification_layers"; item.RelativePath = "..\\prefab_identification_layers"; item.FullPath = System.IO.Path.GetFullPath(logic.LayerDirectory + "/" + item.RelativePath); item.DeleteButtonVisibility = System.Windows.Visibility.Collapsed; LayerChainItems.Add(item); item = new LayerChainItem(); item.Name = "interpret_tree.py"; item.RelativePath = "interpret_tree.py"; item.FullPath = System.IO.Path.GetFullPath(logic.LayerDirectory + "/" + item.RelativePath); item.DeleteButtonVisibility = System.Windows.Visibility.Collapsed; LayerChainItems.Add(item); AddLayerButton.Visibility = Visibility.Collapsed; LibrariesPanel.Visibility = Visibility.Collapsed; } }
private static Dictionary <string, List <string> > GetAllImageIdsUsingAllLibrariesFromLayers(LayerInterpretationLogic logic) { var images = new Dictionary <string, List <string> >(); var libs = AnnotationLibrary.GetAnnotationLibraries(logic.Layers); foreach (string lib in libs) { List <string> forlib = new List <string>(AnnotationLibrary.GetAllImageIds(lib)); images[lib] = forlib; } return(images); }