private void reloadAnnoTier(string filename) { if (!File.Exists(filename)) { MessageTools.Error("Annotation file not found '" + filename + "'"); return; } AnnoList anno = AnnoList.LoadfromFile(filename); double maxdur = 0; maxdur = anno[anno.Count - 1].Stop; if (anno != null && AnnoTierStatic.Selected != null) { setAnnoList(anno); AnnoTierStatic.Selected.Children.Clear(); AnnoTierStatic.Selected.AnnoList.Clear(); AnnoTierStatic.Selected.segments.Clear(); AnnoTierStatic.Selected.AnnoList = anno; foreach (AnnoListItem item in anno) { AnnoTierStatic.Selected.addSegment(item); } AnnoTierStatic.Selected.TimeRangeChanged(MainHandler.Time); } updateTimeRange(maxdur); // if (maxdur > Properties.Settings.Default.DefaultZoominSeconds && Properties.Settings.Default.DefaultZoominSeconds != 0 && annos.Count != 0 && media_list.Medias.Count == 0) fixTimeRange(Properties.Settings.Default.DefaultZoominSeconds); }
private void AnnoList_Drop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { string[] filenames = e.Data.GetData(DataFormats.FileDrop, true) as string[]; if (filenames != null && filenames[0].EndsWith(".annotation")) { try { AnnoList list = AnnoList.LoadfromFile(filenames[0]); if (list.Scheme.Type == AnnoScheme.TYPE.DISCRETE) { foreach (var item in list.Scheme.Labels) { Label label = new Label() { Name = item.Name, Color = item.Color }; if (!items.Contains(label) && label.Name != "GARBAGE" && label.Name != "") { items.Add(label); } } } else if (list.Scheme.Type == AnnoScheme.TYPE.FREE) { HashSet <string> labelNames = new HashSet <string>(); foreach (AnnoListItem item in list) { labelNames.Add(item.Label); } foreach (string name in labelNames) { Label label = new Label() { Name = name, Color = list.Scheme.MaxOrForeColor }; if (!items.Contains(label) && label.Name != "GARBAGE" && label.Name != "") { items.Add(label); } } } else { return; } schemeNameTextField.Text = list.Scheme.Name; backroundColorPicket.SelectedColor = list.Scheme.MinOrBackColor; } catch { MessageTools.Warning("This is not a valid annotation file"); } } } }
private void loadAnnotation(string filename) { if (!File.Exists(filename)) { MessageTools.Error("Annotation file not found '" + filename + "'"); return; } AnnoList annoList = AnnoList.LoadfromFile(filename); handleAnnotation(annoList); }
private void OkButton_Click(object sender, RoutedEventArgs e) { DialogResult = true; if (cmlRadioButton.IsChecked == true) { CMLScheme cmlScheme = (CMLScheme)cmlCombobox.SelectedItem; Scheme = AnnoList.LoadfromFile(cmlScheme.Path).Scheme; LoadedFromFile = true; } else { AnnoScheme.TYPE annoType = AnnoScheme.TYPE.FREE; if (freeRadioButton.IsChecked == true) { annoType = AnnoScheme.TYPE.FREE; } else if (discreteRadioButton.IsChecked == true) { annoType = AnnoScheme.TYPE.DISCRETE; } else if (continuousRadioButton.IsChecked == true) { annoType = AnnoScheme.TYPE.CONTINUOUS; } else if (pointRadioButton.IsChecked == true) { annoType = AnnoScheme.TYPE.POINT; } Scheme.Type = annoType; if (Scheme.Type == AnnoScheme.TYPE.CONTINUOUS) { Scheme.MinScore = 0.0; Scheme.MaxScore = 1.0; Scheme.MinOrBackColor = Defaults.Colors.GradientMin; Scheme.MaxOrForeColor = Defaults.Colors.GradientMax; } else if (Scheme.Type == AnnoScheme.TYPE.POINT) { Scheme.NumberOfPoints = 1; Scheme.MaxOrForeColor = Colors.Green; } } }
private void loadAnnoFile(string filename) { if (!File.Exists(filename)) { MessageTools.Error("Annotation file not found '" + filename + "'"); return; } AnnoList annoList = AnnoList.LoadfromFile(filename); addAnnoTierFromList(annoList); foreach (AnnoTrigger trigger in annoList.Meta.Trigger) { mediaList.Add(trigger); } foreach (Pipeline pipeline in annoList.Meta.Pipeline) { mediaList.Add(pipeline); } }