public FormSpecificDialog(ITemplateForm form, bool nameEditable = false) { InitializeComponent(); this.currentForm = form; txtValue.Enabled = nameEditable; txtValue.Text = form.Name; chkChooseIdentifier.DisplayMember = "Name"; chkChooseIdentifier.SelectionMode = SelectionMode.One; List <Field> fields = new List <Field>(); for (int i = 0; i < form.Pages.Count; i++) { Page page = form.Pages[i]; fields.AddRange(page.Fields.Where <Field>(f => // include anything that's not an image field (f is ImageField) == false // but exclude CSV OmrFields && ((f is OmrField) && ((OmrField)f).Options.TextFormat == OmrTextFormat.Aggregated) ) ); } for (int i = 0; i < fields.Count; i++) { bool isChecked = form.IdentifierFieldId != null && fields[i].PageNumber == form.IdentifierFieldId.PageNumber && fields[i].Name == form.IdentifierFieldId.FieldName; chkChooseIdentifier.Items.Add(fields[i], isChecked); } }
public ProcessOmrDocumentsOperation(RasterImage answerKey, ITemplateForm template, IImageManager imageManager, Dictionary <string, string> images) { this.imageManager = imageManager; this.key = answerKey; this.toLoad = images; this._templateForm = template; }
public void Process() { omrProcessor.Start(); this.template = omrProcessor.TemplateForm; this.answers = omrProcessor.Answers; this.results = omrProcessor.Results; ReprocessVerification(VerificationParameters.AllParameters, answers, results); }
public void InitializeDefaults() { imageManager = new MemoryImageManager(); myImages = new Dictionary <string, string>(); template = MainForm.GetOmrEngine().CreateTemplateForm(); answers = MainForm.GetOmrEngine().CreateRecognitionForm(); results = new List <IRecognitionForm>(); }
public TemplatePanel(RasterImage defaultImage, ITemplateForm currentEngine) : this() { templateImage = defaultImage; templateEditorEngine = currentEngine; if (defaultImage != null) { rdbtnTemplate.Checked = true; } else { rdBtnFile.Checked = true; rdbtnTemplate.Enabled = false; } }
public Workspace(InputPanel ip, KeyPanel kp, ITemplateForm currentTemplate) : this() { for (int i = 0; i < ip.SelectedInputs.Count; i++) { string guid = Guid.NewGuid().ToString(); imageManager.Add(guid, ip.SelectedInputs[i]); myImages.Add(guid, ip.SelectedInputs[i]); } if (kp.AnswerImage != null) { imageManager.Add(Workspace.IMGMGR_ANSWERS, kp.AnswerImagePath); myAnswerkeyPath = kp.AnswerImagePath; } omrProcessor = new ProcessOmrDocumentsOperation(kp.AnswerImage, currentTemplate, imageManager, myImages); this.PassingGrade = kp.PassingGrade; this.verificationParameters = VerificationParameters.GetTemplate(VerificationParameters.FilterTemplate.CommonIssues); }
private void LoadTemplate(string selectedPath) { loadedEditorEngine = MainForm.GetOmrEngine().CreateTemplateForm(); loadedEditorEngine.Load(new FileStream(selectedPath, FileMode.Open, FileAccess.Read)); }
public CreateNewTemplateOperation(RasterImage loadedImage, ITemplateForm template) : base() { this.loadedImage = loadedImage; this.templateForm = template; }
// this prepares a recently deserialized workspace for use internal void Unpack() { InitializeDefaults(); using (MemoryStream ms = new MemoryStream(filepathDictionaryBytes)) { BinaryFormatter bf = new BinaryFormatter(); myImages = (Dictionary <string, string>)bf.Deserialize(ms); ms.Close(); } foreach (string key in myImages.Keys) { imageManager.Add(key, myImages[key]); } if (string.IsNullOrWhiteSpace(myAnswerkeyPath) == false) { imageManager.Add(IMGMGR_ANSWERS, myAnswerkeyPath); } template = MainForm.GetOmrEngine().CreateTemplateForm(); results = new List <IRecognitionForm>(); using (MemoryStream ms = new MemoryStream(templateBytes)) { template.Load(ms); } templateImage = template.Pages[0].Image; for (int i = 1; i < template.Pages.Count; i++) { templateImage.AddPage(template.Pages[i].Image); } if (answerBytes != null) { answers = MainForm.GetOmrEngine().CreateRecognitionForm(); using (MemoryStream ms = new MemoryStream(answerBytes)) { answers.Load(ms); } answerReviewCounts = GetManualReviewCollection(answers, VerificationParameters.AllParameters); } resultReviewCounts = new ReviewCounter(); for (int i = 0; i < resultsBytes.Length; i++) { using (MemoryStream ms = new MemoryStream(resultsBytes[i])) { IRecognitionForm frm = MainForm.GetOmrEngine().CreateRecognitionForm(); frm.Load(ms); resultReviewCounts += GetManualReviewCollection(frm, VerificationParameters.AllParameters, answers, reviewRequiredStatus[i]); results.Add(frm); } } }