/**************************************************************************************************/ public void RedrawPedigree() { pedGen = new PedigreeGenerator(pictureBox1.Width, pictureBox1.Height); pedGen.showBrcaScores = showBrcaScores; pedGen.showMmrScores = showMmrScores; Bitmap b = pedGen.GeneratePedigreeImage(); pictureBox1.Image = b; }
/**************************************************************************************************/ private void InitSelectedRelative() { proband = SessionManager.Instance.GetActivePatient(); if (proband != null) { proband.AddHandlersWithLoad(activePatientChanged, activePatientLoaded, null); pedGen = new PedigreeGenerator(pictureBox1.Width, pictureBox1.Height); pedGen.showBrcaScores = showBrcaScores; pedGen.showMmrScores = showMmrScores; Bitmap b = pedGen.GeneratePedigreeImage(); pictureBox1.Image = b; } }
/**********************************************************************/ private void PerformPedigreeReplacement(HtmlTextNode pedigreeNode) { int pos = pedigreeNode.Text.IndexOf(HraTagText, 0); int suffixPos = pedigreeNode.Text.IndexOf(HraTagSuffix); if (suffixPos > pos) { string args = pedigreeNode.Text.Substring(pos + HraTagText.Length, suffixPos - pos - HraTagText.Length); string[] parts = args.Split(splitChars); if (parts.Length == 2) { int.TryParse(parts[0], out width); int.TryParse(parts[1], out height); } PedigreeGenerator pg = new PedigreeGenerator(width, height,proband); Bitmap bmp; if (proband != null) { bmp = pg.GeneratePedigreeImage(proband); } else { bmp = pg.GeneratePedigreeImage(); } System.IO.MemoryStream stream = new System.IO.MemoryStream(); bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Png); var base64Data = Convert.ToBase64String(stream.ToArray()); HtmlNode newPedNode = pedigreeNode.OwnerDocument.CreateElement("img"); newPedNode.Attributes.Add(pedigreeNode.OwnerDocument.CreateAttribute("src", "data:image/png;base64," + base64Data)); newPedNode.Attributes.Add(pedigreeNode.OwnerDocument.CreateAttribute("style", "width:" + bmp.Width + "px; height:" + bmp.Height + "px")); pedigreeNode.ParentNode.ReplaceChild(newPedNode, pedigreeNode); } }
public static string ShowPedigreeImage(RiskApps3.Model.PatientRecord.Patient proband) { int Width = 625; int Height = 625; PedigreeGenerator pg = new PedigreeGenerator(Width, Height, proband); Bitmap bmp; if (proband != null) { bmp = pg.GeneratePedigreeImage(proband); } else { bmp = pg.GeneratePedigreeImage(); } System.IO.MemoryStream stream = new System.IO.MemoryStream(); bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Png); var base64Data = Convert.ToBase64String(stream.ToArray()); return base64Data; }