public TaskModel(int number, AlgorithmModel algorithm, int nimages) { State = false; Saved = false; Number = number; Algorithm = new AlgorithmModel(algorithm); NumberImages = nimages; Collections = new List<CollectionModel>(); processedImage = null; }
public TaskModel(XmlNode taskNode, List<AlgorithmModel> algorithms) { State = true; Saved = true; Collections = new List<CollectionModel>(); processedImage = null; Number = int.Parse(((XmlElement)taskNode).GetAttribute("Number")); NumberImages = int.Parse(((XmlElement)taskNode).GetAttribute("Images")); Algorithm = new AlgorithmModel(algorithms[ int.Parse(((XmlElement)taskNode).GetAttribute("AlgorithmNumber")) - 1]); foreach (ProcessModel aprocess in Algorithm.Processes) { aprocess.Selected = false; } string name = ""; string path = ""; int processNumber = 0; // Originals and Processed Images for(int i = 0; i < taskNode.ChildNodes.Count - 1; i++) { if (i > 0) { // Algorithm process selected processNumber = int.Parse(((XmlElement)taskNode.ChildNodes[i]).GetAttribute("Number")); Algorithm.Processes[processNumber].Selected = true; } XmlNode imagesNode = taskNode.ChildNodes[i]; for (int j = 0; j < imagesNode.ChildNodes.Count; j++) { // originals if (i == 0) { Collections.Add(new CollectionModel()); } name = ((XmlElement)imagesNode.ChildNodes[j]).GetAttribute("Name"); path = @currentDirectory + ((XmlElement)imagesNode.ChildNodes[j]).GetAttribute("Path"); Collections[j].AddImage(new ImageModel(name, path)); } } // Validations for the collections XmlNode validationsNode = taskNode.LastChild; for (int i = 0; i < validationsNode.ChildNodes.Count; i++) { Collections[i].Validation = int.Parse(((XmlElement)validationsNode.ChildNodes[i]).GetAttribute("Number")); } }
public AlgorithmModel(AlgorithmModel malgorithm) { this.Number = malgorithm.Number; this.Name = malgorithm.Name; this.Path = malgorithm.Path; this.Source = malgorithm.Source; this.Processes = new List<ProcessModel>(); this.Validations = new List<ValidationModel>(); foreach (ProcessModel pr in malgorithm.Processes) { this.Processes.Add(new ProcessModel(pr.Name, pr.Selected)); } foreach (ValidationModel va in malgorithm.Validations) { this.Validations.Add(new ValidationModel(va.Name)); } }
public AlgorithmModel(AlgorithmModel malgorithm, bool type) { this.Number = malgorithm.Number; this.Name = malgorithm.Name; this.Path = malgorithm.Path; this.Source = malgorithm.Source; this._type = type; // RealTime Detection type = true if (this._type) { if (this.Source.Equals("code")) { // Face Detection RT if (this.Number.Equals("1")) { _detection = new FaceDetection(true); } // EyesDetection RT if (this.Number.Equals("2")) { _detection = new EyesDetection(true); } } //else if (this.Source.Equals("exe")) //{ //} //else if (this.Source.Equals("dll")) //{ //} } }