コード例 #1
0
ファイル: MetaData.cs プロジェクト: mahitosh/HRA4
 /**************************************************************************************************/
 public MetaData()
 {
     Diseases = new DiseaseList();
     GeneticTests = new GeneticTestList();
     Users = new UserList();
     UserGroups = new UserGroupList();
     OrderTypes = new OrderTypesList();
     Mutations = new MutationList();
     SystemWideDefaultPedigreePrefs = new GUIPreference();
     CurrentUserDefaultPedigreePrefs = new GUIPreference();
     ApptProviders = new ApptProviderList();
     KbVariants = new VariantsFromKB();
     BrOvCdsRecs = new AllBrOvCdsRecs();
     Globals = new GlobalSettings();
 }
コード例 #2
0
ファイル: PedigreeGenerator.cs プロジェクト: mahitosh/HRA4
        public PedigreeGenerator(int Width, int Height, Patient proband)
        {
            height = Height;
            width = Width;

            //pedigreeControl1 = new PedigreeControl();
            pedigreeControl1 = new PedigreeControl(false);
            pedigreeLegend1 = new PedigreeLegend();
            pedigreeComment1 = new PedigreeComment();
            pedigreeTitleBlock1 = new PedigreeTitleBlock();
            sysDefaultAnnotations = new PedigreeAnnotationList("-1");
            sysDefaultAnnotations.BackgroundListLoad();
            pedigreeSettingsForm1 = new PedigreeSettingsForm(sysDefaultAnnotations);

            if (proband != null)
            {
                if (proband.guiPreferences.Count == 0)
                {
                    GUIPreference gp = new GUIPreference();
                    gp.BackgroundLoadWork();
                    proband.guiPreferences.Add(gp);
                }
            }
        }
コード例 #3
0
ファイル: GUIPreference.cs プロジェクト: mahitosh/HRA4
        public void ConsumeSettings(GUIPreference preferences)
        {
            switch (this.PrefSubtype)
            {
                case Subtype.Normal:
                    this.owningPatient = preferences.owningPatient;
                    this.parentName = preferences.parentName;
                    this.formName = preferences.formName;
                    break;
                case Subtype.System:
                    this.owningPatient = null;
                    this.parentName = "System";
                    this.formName = "Default";
                    break;
                case Subtype.User:
                    this.owningPatient = null;
                    this.parentName = SessionManager.Instance.ActiveUser.userLogin;
                    this.formName = "Default";
                    break;
                default:
                    this.owningPatient = preferences.owningPatient;
                    this.parentName = preferences.parentName;
                    this.formName = preferences.formName;
                    break;
            }

            this.modifiedDate = DateTime.Now;
            this.width = preferences.width;
            this.height = preferences.height;
            this.pedigreeZoomValue = preferences.pedigreeZoomValue;
            this.pedigreeVerticalSpacing = preferences.pedigreeVerticalSpacing;

            this.ShowRelIds = preferences.ShowRelIds;
            this.PedigreeBackground = preferences.PedigreeBackground;
            this.nameWidth = preferences.nameWidth;
            this.limitedEthnicity = preferences.limitedEthnicity;
            this.ShowTitle = preferences.ShowTitle;
            this.ShowName = preferences.ShowName;
            this.NameFont = preferences.NameFont;
            this.ShowUnitnum = preferences.ShowUnitnum;
            this.UnitnumFont = preferences.UnitnumFont;
            this.ShowDob = preferences.ShowDob;
            this.DobFont = preferences.DobFont;
            this.TitleBackground = preferences.TitleBackground;
            this.TitleBorder = preferences.TitleBorder;
            this.ShowLegend = preferences.ShowLegend;
            this.LegendBackground = preferences.LegendBackground;
            this.LegendBorder = preferences.LegendBorder;
            this.LegendRadius = preferences.LegendRadius;
            this.LegendFont = preferences.LegendFont;
            this.ShowComment = preferences.ShowComment;
            this.CommentBackground = preferences.CommentBackground;
            this.CommentBorder = preferences.CommentBorder;
            this.CommentFont = preferences.CommentFont;

            this.LegendX = preferences.LegendX;
            this.LegendY = preferences.LegendY;
            this.LegendHeight = preferences.LegendHeight;
            this.LegendWidth = preferences.LegendWidth;
            this.TitleX = preferences.TitleX;
            this.TitleY = preferences.TitleY;
            this.TitleHeight = preferences.TitleHeight;
            this.TitleWidth = preferences.TitleWidth;
            this.CommentX = preferences.CommentX;
            this.CommentY = preferences.CommentY;
            this.CommentHeight = preferences.CommentHeight;
            this.CommentWidth = preferences.CommentWidth;

            this.VariantFoundText = preferences.VariantFoundText;
            this.VariantFoundVusText = preferences.VariantFoundVusText;
            this.VariantNotFoundText = preferences.VariantNotFoundText;
            this.VariantUnknownText = preferences.VariantUnknownText;
            this.VariantNotTestedText = preferences.VariantNotTestedText;
            this.VariantHeteroText = preferences.VariantHeteroText;

            this.hideNonBloodRelatives = preferences.hideNonBloodRelatives;

            foreach (PedigreeAnnotation pa in annotations)
            {
                foreach (PedigreeAnnotation target in preferences.annotations)
                {
                    if (pa.annotation == target.annotation)
                    {
                        if (pa.area != target.area)
                        {
                            pa.area = target.area;
                            pa.slot = target.slot;
                            pa.SignalModelChanged(new HraModelChangedEventArgs(null));
                        }
                        break;
                    }
                }
            }

            SignalModelChanged(new HraModelChangedEventArgs(null));
        }
コード例 #4
0
ファイル: PedigreeForm.cs プロジェクト: mahitosh/HRA4
        /**************************************************************************************************/
        private void GUIPreferenceListLoaded(HraListLoadedEventArgs e)
        {
            currentPrefs = getBestFitExistingGuiPreference(false);
            SettingsForm.preferences = currentPrefs;
            pedigreeControl1.currentPrefs = currentPrefs;

            pedigreeControl1.currentPrefs.GUIPreference_height = pedigreeControl1.Height;
            pedigreeControl1.currentPrefs.GUIPreference_width = pedigreeControl1.Width;

            ApplyPrefs();
        }
コード例 #5
0
ファイル: PedigreeForm.cs プロジェクト: mahitosh/HRA4
        /**************************************************************************************************/
        private GUIPreference getBestFitExistingGuiPreference(bool exactMatchOnly)
        {
            GUIPreference bestFitGuiPreference = null;
            List<GUIPreference> localList = proband.guiPreferences.ConvertAll(x => (GUIPreference)x);
            String parentFormText = (this.ParentForm != null) ? this.ParentForm.Text : "";

            if (localList.Count == 0)
            {
                GUIPreference guiPreference;
                //String parentFormText = (this.ParentForm != null) ? this.ParentForm.Text : "";

                guiPreference = new GUIPreference(proband, DateTime.Now, this.Text, parentFormText, this.Width, this.Height);
                HraModelChangedEventArgs args = new HraModelChangedEventArgs(this);
                args.Persist = true;
                proband.guiPreferences.AddToList(guiPreference, args);
                return guiPreference;
            }
            else
            {
                GUIPreference guiPreference = null;
                foreach (GUIPreference gp in localList)
                {
                    guiPreference = gp;
                    guiPreference.ReadOnly = false;
                    guiPreference.ConsumeSettings(guiPreference);    //TODO this is kind of a hack

                    guiPreference.PersistFullObject(new HraModelChangedEventArgs(this));
                    guiPreference.GUIPreference_height = pedigreeControl1.Height;   //TODO and so is this
                    guiPreference.GUIPreference_width = pedigreeControl1.Width;     //TODO ...and this....find better places for all of this...
                }
                return guiPreference;
            }
        }
コード例 #6
0
ファイル: PedigreeTitleBlock.cs プロジェクト: mahitosh/HRA4
 internal void SetVariantLabel(string label, GUIPreference currentGuiPrefs)
 {
     if (variantLabel.InvokeRequired)
     {
         SetVariantLabelCallback aoc = SetVariantLabel;
         object[] args = new object[1];
         args[0] = label;
         args[1] = currentGuiPrefs;
         this.Invoke(aoc, args);
     }
     else
     {
         variantLabel.Text = label;
         int width = this.ComputeOptimalWidth();
         int height = this.ComputeOptimalHeight();
         if (currentGuiPrefs != null)
         {
             currentGuiPrefs.GUIPreference_TitleWidth = width;
             currentGuiPrefs.GUIPreference_TitleHeight = height;
         }
     }
 }
コード例 #7
0
ファイル: PedigreeGenerator.cs プロジェクト: mahitosh/HRA4
        /**************************************************************************************************/
        private GUIPreference getBestFitExistingGuiPreference(bool exactMatchOnly)
        {
            List<GUIPreference> localList = proband.guiPreferences.ConvertAll(x => (GUIPreference)x);
            String parentFormText = "";

            if (localList.Count == 0)
            {
                GUIPreference guiPreference;
                //String parentFormText = (this.ParentForm != null) ? this.ParentForm.Text : "";

                guiPreference = new GUIPreference(proband, DateTime.Now, "", parentFormText, width, height, true);
                HraModelChangedEventArgs args = new HraModelChangedEventArgs(null);
                args.Persist = true;
                proband.guiPreferences.AddToList(guiPreference, args);
                return guiPreference;
            }
            else
            {
                GUIPreference guiPreference = null;
                foreach (GUIPreference gp in localList)
                {
                    //if (guiPreference == null)
                    guiPreference = gp;
                }
                return guiPreference;
            }
        }
コード例 #8
0
ファイル: PedigreeGenerator.cs プロジェクト: mahitosh/HRA4
        private void GeneratePedigree()
        {
            int MaxWidth = width;
            int MaxHeight = height;

            bool new_gui_pref = true;
            if (proband.guiPreferences.Count == 0)
                new_gui_pref = true;

            pedigreeTitleBlock1.NameText = proband.name;
            pedigreeTitleBlock1.MRN = proband.unitnum;
            pedigreeTitleBlock1.DOB = proband.dob;

            pedigreeComment1.proband = proband;
            pedigreeComment1.Text = proband.family_comment;

            proband.FHx.SetIDsFromRelationships();
            pedigreeControl1.ForceLoadFamily(proband.FHx);

            currentPrefs = getBestFitExistingGuiPreference(false);
            pedigreeControl1.currentPrefs = currentPrefs;

            if (string.IsNullOrEmpty(proband.family_comment))
                pedigreeComment1.Visible = false;

            if (pedigreeControl1.currentPrefs.GUIPreference_width != 0 && pedigreeControl1.currentPrefs.GUIPreference_height != 0)
            {
                //pedigreeControl1.Width = pedigreeControl1.currentPrefs.GUIPreference_width;
                //pedigreeControl1.Height = pedigreeControl1.currentPrefs.GUIPreference_height;

                //width = pedigreeControl1.currentPrefs.GUIPreference_width;
                //height = pedigreeControl1.currentPrefs.GUIPreference_height;

                if (!new_gui_pref)
                {
                    pedigreeControl1.Width = pedigreeControl1.currentPrefs.GUIPreference_width;
                    pedigreeControl1.Height = pedigreeControl1.currentPrefs.GUIPreference_height;

                    width = pedigreeControl1.currentPrefs.GUIPreference_width;
                    height = pedigreeControl1.currentPrefs.GUIPreference_height;
                }
                else
                {
                    pedigreeControl1.Width = width;
                    pedigreeControl1.Height = height;

                }
                float x = pedigreeControl1.model.parameters.scale = ((float)pedigreeControl1.currentPrefs.GUIPreference_zoomValue) / 100.0f;

                pedigreeControl1.model.parameters.scale = 0.65f * x;
                //pedigreeControl1.model.parameters.scale = (float)height / (float)pedigreeControl1.currentPrefs.GUIPreference_height * x;
                //pedigreeControl1.model.parameters.scale = (float)width / (float)pedigreeControl1.currentPrefs.GUIPreference_width * x;

                pedigreeControl1.model.parameters.hOffset = (int)(((width / 2) / pedigreeControl1.model.parameters.scale) - (float)(pedigreeControl1.model.displayXMax / 2));
                pedigreeControl1.model.parameters.vOffset = (int)(((height / 2) / pedigreeControl1.model.parameters.scale) - (float)(pedigreeControl1.model.displayYMax / 2));

                foreach (PedigreeIndividual pi in pedigreeControl1.model.individuals)
                {
                    foreach (ClincalObservation co in pi.HraPerson.PMH.Observations)
                    {
                        pedigreeLegend1.AddSingleObservation(co, false);
                        pedigreeLegend1.Visible = true;
                    }

                }
            }
            if (new_gui_pref)
            {
                int minx = int.MaxValue;
                int maxx = int.MinValue;

                int miny = int.MaxValue;
                int maxy = int.MinValue;

                foreach (PedigreeIndividual pi in pedigreeControl1.model.individuals)
                {
                    foreach (ClincalObservation co in pi.HraPerson.PMH.Observations)
                    {
                        pedigreeLegend1.AddSingleObservation(co, false);
                        pedigreeLegend1.Visible = true;
                    }
                    if (pi.HraPerson.x_norm == int.MinValue)
                        pi.HraPerson.x_norm = (int)(pi.point.x - (pedigreeControl1.model.displayXMax / 2));

                    if (pi.HraPerson.y_norm == int.MinValue)
                        pi.HraPerson.y_norm = (int)(pi.point.y - (pedigreeControl1.model.displayYMax / 2));

                    if (pi.HraPerson.x_norm < minx)
                        minx = pi.HraPerson.x_norm;

                    if (pi.HraPerson.x_norm > maxx)
                        maxx = pi.HraPerson.x_norm;

                    if (pi.HraPerson.y_norm < miny)
                        miny = pi.HraPerson.y_norm;

                    if (pi.HraPerson.y_norm > maxx)
                        maxy = pi.HraPerson.y_norm;
                }

                maxx += 60;
                minx -= 60;

                float zoom = (float)((double)width / (double)(maxx - minx));
                if (zoom < 1.0f)
                {
                    pedigreeControl1.model.parameters.scale = zoom;
                    pedigreeControl1.model.parameters.hOffset = (int)(((width / 2) / pedigreeControl1.model.parameters.scale) - (float)(pedigreeControl1.model.displayXMax / 2));
                    pedigreeControl1.model.parameters.vOffset = (int)(((height / 2) / pedigreeControl1.model.parameters.scale) - (float)(pedigreeControl1.model.displayYMax / 2));
                }
                else
                {
                    pedigreeControl1.model.parameters.scale = 1;
                    pedigreeControl1.model.parameters.hOffset = (int)(((width / 2) / pedigreeControl1.model.parameters.scale) - (float)(pedigreeControl1.model.displayXMax / 2));
                    pedigreeControl1.model.parameters.vOffset = (int)(((height / 2) / pedigreeControl1.model.parameters.scale) - (float)(pedigreeControl1.model.displayYMax / 2));

                }

                if (pedigreeControl1.model.parameters.scale > 0 && pedigreeControl1.model.parameters.scale < 2.0f)
                {
                    pedigreeControl1.currentPrefs.GUIPreference_zoomValue = (int)(150.0f * pedigreeControl1.model.parameters.scale);
                }

                pedigreeControl1.controller.SetMode("SELF_ORGANIZING");
                int counter = 0;
                while (pedigreeControl1.model.converged == false && counter < 200)     //for (int i = 0; i < 100; i++)
                {
                    pedigreeControl1.controller.IncrementLayout();
                    counter++;
                }

                pedigreeControl1.CenterIndividuals();
            }

            ApplyPrefs();

            if (new_gui_pref)
            {
                //pedigreeLegend1.Location = new Point(pedigreeTitleBlock1.Location.X + pedigreeTitleBlock1.Width + 10, pedigreeTitleBlock1.Location.Y);
            }

            if (showBrcaScores)
                pedigreeSettingsForm1.showBrcaScores();
            else
                pedigreeSettingsForm1.hideBrcaScores();

            if (showMmrScores)
                pedigreeSettingsForm1.showMmrScores();
            else
                pedigreeSettingsForm1.hideMmrScores();

            pedigreeControl1.model.parameters.annotation_areas = pedigreeSettingsForm1.annotation_areas;

            pedigreeControl1.model.FamilialVariants = FamilialVariants;

            image = new Bitmap(width, height);

            Graphics g = Graphics.FromImage(image);

            pedigreeControl1.DrawFromView(g, width, height);

            pedigreeTitleBlock1.DrawToBitmapWithBorder(image, new Rectangle(pedigreeTitleBlock1.Location, pedigreeTitleBlock1.Size));

            if (string.IsNullOrEmpty(proband.Patient_Comment) == false && pedigreeComment1.Visible)
            {
                pedigreeComment1.DrawToBitmapWithBorder(image, new Rectangle(pedigreeComment1.Location, pedigreeComment1.Size));
            }
            if (pedigreeLegend1.Visible)
                pedigreeLegend1.DrawToBitmapWithBorder(image, new Rectangle(pedigreeLegend1.Location, pedigreeLegend1.Size));

            float MaxRatio = MaxWidth / (float)MaxHeight;
            float ImgRatio = image.Width / (float)image.Height;

            if (image.Width > MaxWidth)
                image = new Bitmap(image, new Size(MaxWidth, (int)Math.Round(MaxWidth /
                ImgRatio, 0)));

            if (image.Height > MaxHeight)
                image = new Bitmap(image, new Size((int)Math.Round(MaxWidth * ImgRatio,
                0), MaxHeight));
        }
コード例 #9
0
ファイル: PedigreeGenerator.cs プロジェクト: mahitosh/HRA4
        private void GeneratePedigree()
        {
            pedigreeTitleBlock1.NameText = proband.name;
            pedigreeTitleBlock1.MRN = proband.unitnum;
            pedigreeTitleBlock1.DOB = proband.dob;

            pedigreeComment1.proband = proband;
            pedigreeComment1.Text = proband.family_comment;

            proband.FHx.SetIDsFromRelationships();
            pedigreeControl1.ForceLoadFamily(proband.FHx);

            currentPrefs = getBestFitExistingGuiPreference(false);
            pedigreeControl1.currentPrefs = currentPrefs;

            ShowComments();

            if (pedigreeControl1.currentPrefs.GUIPreference_width != 0 && pedigreeControl1.currentPrefs.GUIPreference_height != 0)
            {
                pedigreeControl1.Width = width;
                pedigreeControl1.Height = height;

                float x = pedigreeControl1.model.parameters.scale = ((float)pedigreeControl1.currentPrefs.GUIPreference_zoomValue) / 100.0f;

                pedigreeControl1.model.parameters.scale = 0.65f * x;

                pedigreeControl1.model.parameters.hOffset = (int)(((width / 2) / pedigreeControl1.model.parameters.scale) - (float)(pedigreeControl1.model.displayXMax / 2));
                pedigreeControl1.model.parameters.vOffset = (int)(((height / 2) / pedigreeControl1.model.parameters.scale) - (float)(pedigreeControl1.model.displayYMax / 2));
            }

            AddObservations();

            pedigreeControl1.model.individuals.ForEach(SetNorms);
            var maxx = pedigreeControl1.model.individuals.Max(pi => pi.HraPerson.x_norm);
            var minx = pedigreeControl1.model.individuals.Min(pi => pi.HraPerson.x_norm);
            var maxy = pedigreeControl1.model.individuals.Max(pi => pi.HraPerson.y_norm);
            var miny = pedigreeControl1.model.individuals.Min(pi => pi.HraPerson.y_norm);

            maxx += 60;
            minx -= 60;
            maxy += 80;
            miny -= 20;

            int pedigreeHeight = maxy - miny;
            this.height = pedigreeHeight;

            //TODO not sure if this is optimal - may want to determine if scale is limited by x or y and scale accordingly
            float zoom = (float)((double)width / (double)(maxx - minx));
            if (zoom < 1.0f)
            {
                pedigreeControl1.model.parameters.scale = zoom;
                pedigreeControl1.model.parameters.hOffset = (int)(((width / 2) / pedigreeControl1.model.parameters.scale) - (float)(pedigreeControl1.model.displayXMax / 2));
                pedigreeControl1.model.parameters.vOffset = (int)(((height / 2) / pedigreeControl1.model.parameters.scale) - (float)(pedigreeControl1.model.displayYMax / 2));
            }
            else
            {
                pedigreeControl1.model.parameters.scale = 1;
                pedigreeControl1.model.parameters.hOffset = (int)(((width / 2) / pedigreeControl1.model.parameters.scale) - (float)(pedigreeControl1.model.displayXMax / 2));
                pedigreeControl1.model.parameters.vOffset = (int)(((height / 2) / pedigreeControl1.model.parameters.scale) - (float)(pedigreeControl1.model.displayYMax / 2));
            }

            if (pedigreeControl1.model.parameters.scale > 0 && pedigreeControl1.model.parameters.scale < 2.0f)
            {
                pedigreeControl1.currentPrefs.GUIPreference_zoomValue = (int)(150.0f * pedigreeControl1.model.parameters.scale);
            }

            pedigreeControl1.controller.SetMode("SELF_ORGANIZING");
            int counter = 0;
            while (pedigreeControl1.model.converged == false && counter < 200)     //for (int i = 0; i < 100; i++)
            {
                pedigreeControl1.controller.IncrementLayout();
                counter++;
            }

            pedigreeControl1.CenterIndividuals();

            ApplyPrefs();

            ShowBrcaScores();

            ShowMmrScores();

            pedigreeControl1.model.parameters.annotation_areas = pedigreeSettingsForm1.annotation_areas;

            pedigreeControl1.model.FamilialVariants = FamilialVariants;

            Rectangle legendLayout;
            Rectangle commentBoxLayout;
            Rectangle titleBlockLayout;
            Rectangle pedigreeRegionLayout;
            Rectangle backdropLayout;
            int totalHeight;

            ComputePedigreeLayout(width, height,
                out legendLayout,
                out commentBoxLayout,
                out titleBlockLayout,
                out pedigreeRegionLayout,
                out backdropLayout,
                out totalHeight);

            image = new Bitmap(width, totalHeight);

            Control canvasControl = new Control
            {
                BackColor = Color.White,
                Width = backdropLayout.Width,
                Height = backdropLayout.Height
            };
            canvasControl.DrawToBitmap(image, backdropLayout);

            pedigreeControl1.DrawToBitmap(image, pedigreeRegionLayout);

            pedigreeTitleBlock1.DrawToBitmapWithBorder(image, titleBlockLayout);

            if (string.IsNullOrEmpty(proband.Patient_Comment) == false && pedigreeComment1.Visible)
            {
                pedigreeComment1.DrawToBitmapWithBorder(image, commentBoxLayout);
            }
            if (pedigreeLegend1.Visible)
            {
                pedigreeLegend1.DrawToBitmapWithBorder(image, legendLayout);
            }
        }