private void AddTgFolder() { string folderLocation = FileBrowser.BrowseForFolder(); if (string.IsNullOrWhiteSpace(folderLocation)) { return; } ObservableCollection <SingleMouseViewModel> currentList = new ObservableCollection <SingleMouseViewModel>(TgItemsSource); string[] files = Directory.GetFiles(folderLocation); foreach (string file in files) { string extension = Path.GetExtension(file); if (CheckIfExtensionIsVideo(extension)) { ISingleMouse newFile = ModelResolver.Resolve <ISingleMouse>(); newFile.AddFile(GetSingleFile(file)); newFile.Name = Path.GetFileNameWithoutExtension(file); currentList.Add(new SingleMouseViewModel(newFile)); } } TgItemsSource = currentList; }
public SingleMouseViewModel(ISingleMouse model) { Model = model; ResetProgress(); ParallelOptions = new ParallelOptions(); ParallelOptions.MaxDegreeOfParallelism = 4; ThresholdValue = 20; ThresholdValue2 = 10; GapDistance = -1; SmoothMotion = true; }
public SingleMouseViewModel(ISingleMouse model) { Model = model; ResetProgress(); ParallelOptions = new ParallelOptions(); ParallelOptions.MaxDegreeOfParallelism = 4; ThresholdValue = 20; ThresholdValue2 = 10; GapDistance = 35; SmoothMotion = true; WhiskerSettings = ModelResolver.Resolve <IWhiskerVideoSettings>(); WhiskerSettings.AssignDefaultValues(); }
public ISingleMouse GetMouse() { if (Videos.Length == 0) { return(null); } ISingleMouse mouse = ModelResolver.Resolve <ISingleMouse>(); mouse.Name = Name; mouse.Id = Id; mouse.Age = Age; mouse.Class = Class; //ITypeBase type; switch (Type) { case "Non-Transgenic": mouse.Type = ModelResolver.Resolve <INonTransgenic>(); break; case "Transgenic": mouse.Type = ModelResolver.Resolve <ITransgenic>(); break; case "Undefined": mouse.Type = ModelResolver.Resolve <IUndefined>(); break; } List <string> videos = new List <string>(); foreach (string video in Videos) { string fileName = Path.GetFileName(video); string extension = Path.GetExtension(fileName); fileName = fileName.Replace(extension, ""); int index = fileName.IndexOf("-"); index++; fileName = fileName.Substring(index, fileName.Length - index); videos.Add(fileName); } mouse.Videos = videos; mouse.GenerateFiles(Videos[0]); return(mouse); }
public ReviewWindowViewModel(ISingleMouse model, Dictionary <ISingleFile, IMouseDataResult> results, string artFile) { ObservableCollection <SingleFileViewModel> videos = new ObservableCollection <SingleFileViewModel>(); foreach (ISingleFile singleFile in model.VideoFiles) { SingleFileViewModel vm = new SingleFileViewModel(singleFile, artFile); IMouseDataResult data = results[singleFile]; if (data != null) { vm.VideoOutcome = data.VideoOutcome; if (data.VideoOutcome != SingleFileResult.Ok) { vm.Comments = data.Message; } else { vm.Comments = data.MainBehaviour; } } videos.Add(vm); } SingleFiles = videos; Model = model; Results = results; ArtFile = artFile; GapDistanceMin = 5; GapDistanceMax = 300; BinaryThresholdMin = 0; BinaryThresholdMax = 255; BinaryThreshold2Min = 0; BinaryThreshold2Max = 255; Name = Model.Name; Age = Model.Age; Type = Model.Type; SelectedVideo = SingleFiles.First(); }
private void AddTgFile() { string fileLocation = FileBrowser.BroseForVideoFiles(); if (string.IsNullOrWhiteSpace(fileLocation)) { return; } ISingleMouse newFile = ModelResolver.Resolve <ISingleMouse>(); newFile.AddFile(GetSingleFile(fileLocation)); newFile.Name = Path.GetFileNameWithoutExtension(fileLocation); SingleMouseViewModel viewModel = new SingleMouseViewModel(newFile); ObservableCollection <SingleMouseViewModel> currentList = new ObservableCollection <SingleMouseViewModel>(TgItemsSource); currentList.Add(viewModel); TgItemsSource = currentList; }