Beispiel #1
0
        private void PerformTestType(eTestType TestType)
        {

            #region extract classes of interest
            cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses();
            GUI_ListClasses.IsCheckBoxes = !_DescEvolCellByCellItem.Checked;
            GUI_ListClasses.IsSelectAll = true;

            if (GUI_ListClasses.Run().IsSucceed == false) return;
            cExtendedTable ListClassSelected = GUI_ListClasses.GetOutPut();

            if (ListClassSelected.Sum() < 1)
            {
                MessageBox.Show("At least one classe has to be selected.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            #endregion

            cDesignerTab DT = new cDesignerTab();

            for (int i = 0; i < cGlobalInfo.CurrentScreening.ListDescriptors.Count; i++)
            {

                if (cGlobalInfo.CurrentScreening.ListDescriptors[i].IsActive() == false) continue;

                cDesignerSplitter DS = new cDesignerSplitter();
                DS.Orientation = Orientation.Vertical;
                cViewerTable VTable = new cViewerTable();

                cViewertext VT = new cViewertext();

                cExtendedTable FinalTable = new cExtendedTable(cGlobalInfo.ListWellClasses.Count, 0, 0);
                for (int j = 0; j < cGlobalInfo.ListWellClasses.Count; j++)
                {
                    FinalTable[j].Tag = cGlobalInfo.ListWellClasses[j];
                    FinalTable[j].Name = cGlobalInfo.ListWellClasses[j].Name;
                }

                cListWells ListWellsToProcess = new cListWells(null);
                cDescriptorType CurrentDesc = cGlobalInfo.CurrentScreening.ListDescriptors[i];
                // build the table
                foreach (cPlate CurrentPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    foreach (cWell CurrentWell in CurrentPlate.ListActiveWells)
                    {
                        if ((CurrentWell.GetCurrentClassIdx() < 0) || (ListClassSelected[0][CurrentWell.GetCurrentClassIdx()] == 0)) continue;
                        {
                            FinalTable[CurrentWell.GetCurrentClassIdx()].Add(CurrentWell.GetAverageValue(CurrentDesc));
                            ListWellsToProcess.Add(CurrentWell);
                        }
                    }
                }

                cClean C = new cClean();
                C.SetInputData(FinalTable);
                C.Run();
                cExtendedTable NewTable = C.GetOutPut();

                cTwoSampleFTest TSFTest = null;
                cANOVA Anova = null;
                cTwoSampleUnpooledTTest TwoSampleTTest = null;
                cStudent_tTest StudentTTest = null;

                if (TestType == eTestType.F_TEST)
                {
                    TSFTest = new cTwoSampleFTest();
                    TSFTest.SetInputData(NewTable);
                    TSFTest.Run();
                    VTable.SetInputData(TSFTest.GetOutPut());
                    VT.SetInputData(TSFTest.GetInfo());
                }
                else if (TestType == eTestType.ANOVA)
                {
                    Anova = new cANOVA();
                    Anova.SetInputData(NewTable);
                    Anova.Run();
                    VTable.SetInputData(Anova.GetOutPut());
                    VT.SetInputData(Anova.GetInfo());
                }
                else if (TestType == eTestType.TWO_SAMPLES_T_TEST)
                {
                    TwoSampleTTest = new cTwoSampleUnpooledTTest();
                    TwoSampleTTest.SetInputData(NewTable);
                    TwoSampleTTest.Run();
                    VTable.SetInputData(TwoSampleTTest.GetOutPut());
                    VT.SetInputData(TwoSampleTTest.GetInfo());
                }
                else if (TestType == eTestType.STUDENT_T_TEST)
                {
                    StudentTTest = new cStudent_tTest();
                    StudentTTest.SetInputData(NewTable);
                    StudentTTest.Run();
                    VTable.SetInputData(StudentTTest.GetOutPut());
                    VT.SetInputData(StudentTTest.GetInfo());
                }
                VTable.DigitNumber = -1;
                VTable.Run();
                DS.SetInputData(VTable.GetOutPut());

                VT.Run();
                DS.SetInputData(VT.GetOutPut());
                DS.Run();
                DS.Title = cGlobalInfo.CurrentScreening.ListDescriptors[i].GetName();

                cDesignerSplitter DSMain = new cDesignerSplitter();
                DSMain.Orientation = Orientation.Horizontal;
                DSMain.SetInputData(DS.GetOutPut());

                // Compute and display associated Stacked histogram

                //CDW1.Title = CompleteScreening.ListDescriptors[CompleteScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - Stacked Histogram - " + PlateList.Count + " plates";

                cExtendedTable TableForHisto = ListWellsToProcess.GetAverageDescriptorValues(i);
                TableForHisto.Name = "";

                cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
                CV1.SetInputData(TableForHisto);
                CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[i].GetName();
                CV1.Chart.IsLegend = true;
                CV1.Run();

                DSMain.SetInputData(CV1.GetOutPut());
                DSMain.Title = cGlobalInfo.CurrentScreening.ListDescriptors[i].GetName();
                DSMain.Run();
                DT.SetInputData(DSMain.GetOutPut());
            }

            DT.Run();
            cDisplayToWindow DTW = new cDisplayToWindow();
            DTW.SetInputData(DT.GetOutPut());
            DTW.Title = "Classification Significance - " + TestType.ToString();
            DTW.Run();
            DTW.Display();

        }
Beispiel #2
0
        private void dToolStripMenuItem_Click(object sender, EventArgs e)
        {
            cFeedBackMessage MessageReturned;

            cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses();
            GUI_ListClasses.IsCheckBoxes = true;
            GUI_ListClasses.IsSelectAll = true;

            if (GUI_ListClasses.Run().IsSucceed == false) return;
            cExtendedList ListClassSelected = GUI_ListClasses.GetOutPut()[0];

            List<cWellClassType> ListWellClassesSelected = new List<cWellClassType>();
            foreach (var item in ListClassSelected.ListTags)
            {
                ListWellClassesSelected.Add((cWellClassType)(item));
            }

            cViewerGraph1D V1D = new cViewerGraph1D();
            V1D.Chart.IsSelectable = true;
            V1D.Chart.LabelAxisX = "Well Index";
            V1D.Chart.LabelAxisY = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();

            V1D.Chart.IsXGrid = true;



            if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
            {
                cExtendedTable DataFromPlate = new cExtendedTable(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells,
                                                cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx, ListClassSelected);

                DataFromPlate.Name = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetName();

                V1D.Chart.IsShadow = true;
                V1D.Chart.IsBorder = true;
                //V1D.Chart.IsSelectable = true;
                V1D.Chart.CurrentTitle.Tag = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate();
                V1D.SetInputData(DataFromPlate);
                V1D.Run();

                cDesignerSplitter DS = new cDesignerSplitter();
                DS.Orientation = System.Windows.Forms.Orientation.Horizontal;
                DS.SetInputData(V1D.GetOutPut());

                cExtendedTable NewTable = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells.Filter(ListWellClassesSelected).GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
                NewTable.Name = "Histogram";

                cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
                CV1.SetInputData(NewTable);
                CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
                CV1.Run();
                DS.SetInputData(CV1.GetOutPut());
                DS.Run();


                cDisplayToWindow Disp0 = new cDisplayToWindow();
                Disp0.SetInputData(DS.GetOutPut());
                Disp0.Title = "Scatter points graph - " + DataFromPlate[0].Count + " wells.";
                if (!Disp0.Run().IsSucceed) return;
                Disp0.Display();
            }
            else if (ProcessModeEntireScreeningToolStripMenuItem.Checked)
            {
                V1D.Chart.MarkerSize = 5;
                V1D.Chart.IsBorder = false;
                V1D.Chart.IsShadow = false;

                cListWells ListWell = new cListWells(null);
                int IdxWellForPlateSeparator = 0;
                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    foreach (cWell TmpWell in TmpPlate.ListActiveWells)
                    {
                        int ClassTmp = TmpWell.GetCurrentClassIdx();
                        if ((ClassTmp == -1) || (GUI_ListClasses.GetOutPut()[0][TmpWell.GetCurrentClassIdx()] == 0)) continue;
                        ListWell.Add(TmpWell);
                        IdxWellForPlateSeparator++;
                    }


                    if (cGlobalInfo.OptionsWindow.FFAllOptions.checkBoxDisplayPlatesVerticalLines.Checked)
                    {
                        Classes.Base_Classes.General.cLineVerticalForGraph VL = new Classes.Base_Classes.General.cLineVerticalForGraph(IdxWellForPlateSeparator + 0.5);
                        VL.IsAllowMoving = false;
                        V1D.Chart.ListVerticalLines.Add(VL);
                    }

                }
                cExtendedTable DataFromPlate = new cExtendedTable(ListWell,
                                                cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx, ListClassSelected);

                DataFromPlate.Name = cGlobalInfo.CurrentScreening.GetName() + " - " + cGlobalInfo.CurrentScreening.ListPlatesActive.Count + " plates";

                int MaxNumberOfPts = (int)cGlobalInfo.OptionsWindow.FFAllOptions.numericUpDownMinNumPointForFastDisp.Value;
                if (ListWell.Count > MaxNumberOfPts)
                {
                    cGlobalInfo.WindowHCSAnalyzer.richTextBoxConsole.AppendText("\n" + V1D.Title + ": Number of Wells is Higher than " + MaxNumberOfPts + " => Switching to FastPoints Mode.\n");
                    V1D.Chart.ISFastPoint = true;
                }

                V1D.SetInputData(DataFromPlate);
                V1D.Run();

                cDesignerSplitter DS = new cDesignerSplitter();
                DS.Orientation = System.Windows.Forms.Orientation.Horizontal;
                DS.SetInputData(V1D.GetOutPut());

                cExtendedTable NewTable = ListWell.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
                NewTable.Name = "Histogram";

                cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
                CV1.SetInputData(NewTable);
                CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
                CV1.Run();
                DS.SetInputData(CV1.GetOutPut());
                DS.Run();

                cDisplayToWindow Disp0 = new cDisplayToWindow();
                Disp0.SetInputData(DS.GetOutPut());
                Disp0.Title = "Scatter points graph - " + DataFromPlate[0].Count + " wells.";
                if (!Disp0.Run().IsSucceed) return;
                Disp0.Display();

            }
            else if (ProcessModeplateByPlateToolStripMenuItem.Checked)
            {
                cDesignerTab CDT = new cDesignerTab();

                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    cExtendedTable DataFromPlate = new cExtendedTable(TmpPlate.ListActiveWells,
                                                cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx, ListClassSelected);

                    DataFromPlate.Name = TmpPlate.GetName();

                    V1D = new cViewerGraph1D();
                    V1D.Chart.IsSelectable = true;
                    V1D.Chart.LabelAxisX = "Well Index";
                    V1D.Chart.LabelAxisY = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
                    V1D.Chart.IsXGrid = true;
                    V1D.Chart.CurrentTitle.Tag = TmpPlate;
                    V1D.SetInputData(DataFromPlate);
                    V1D.Title = TmpPlate.GetName();
                    V1D.Run();

                    cDesignerSplitter DS = new cDesignerSplitter();
                    DS.Orientation = System.Windows.Forms.Orientation.Horizontal;
                    DS.SetInputData(V1D.GetOutPut());

                    cExtendedTable NewTable = TmpPlate.ListActiveWells.Filter(ListWellClassesSelected).GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
                    NewTable.Name = "Histogram";

                    cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
                    CV1.SetInputData(NewTable);
                    CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
                    CV1.Run();

                    DS.Title = TmpPlate.GetName();
                    DS.SetInputData(CV1.GetOutPut());
                    DS.Run();

                    CDT.SetInputData(DS.GetOutPut());
                }

                CDT.Run();

                cDisplayToWindow Disp0 = new cDisplayToWindow();
                Disp0.SetInputData(CDT.GetOutPut());
                Disp0.Title = "Scatter points graphs";
                if (!Disp0.Run().IsSucceed) return;
                Disp0.Display();
            }

        }
Beispiel #3
0
        private void stackedHistogramsToolStripMenuItem_Click(object sender, EventArgs e)
        {
            cGUI_ListClasses GUI_ListClasses = new cGUI_ListClasses();
            GUI_ListClasses.IsCheckBoxes = true;
            GUI_ListClasses.IsSelectAll = true;

            if (GUI_ListClasses.Run().IsSucceed == false) return;
            cExtendedList ListClassSelected = GUI_ListClasses.GetOutPut()[0];

            if (ListClassSelected.Sum() < 1)
            {
                MessageBox.Show("At least one classe has to be selected.", "Error !", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            cDisplayToWindow CDW1 = new cDisplayToWindow();

            if ((ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked) || (ProcessModeEntireScreeningToolStripMenuItem.Checked))
            {
                cListWells ListWellsToProcess = new cListWells(null);
                List<cPlate> PlateList = new List<cPlate>();

                if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
                    PlateList.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
                else
                {
                    foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) PlateList.Add(TmpPlate);
                }

                foreach (cPlate TmpPlate in PlateList)
                    foreach (cWell item in TmpPlate.ListActiveWells)
                        if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) ListWellsToProcess.Add(item);


                if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
                    CDW1.Title = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - Stacked Histogram (" + PlateList[0].GetName() + ")";
                else
                    CDW1.Title = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - Stacked Histogram - " + PlateList.Count + " plates";

                cExtendedTable NewTable = ListWellsToProcess.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
                NewTable.Name = CDW1.Title;

                cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
                CV1.SetInputData(NewTable);
                CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
                CV1.Run();

                CDW1.SetInputData(CV1.GetOutPut());
            }
            else if (ProcessModeplateByPlateToolStripMenuItem.Checked)
            {
                cDesignerTab CDT = new cDesignerTab();
                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    cListWells ListWellsToProcess = new cListWells(null);
                    foreach (cWell item in TmpPlate.ListActiveWells)
                        if ((item.GetCurrentClassIdx() != -1) && (ListClassSelected[item.GetCurrentClassIdx()] == 1)) ListWellsToProcess.Add(item);

                    cExtendedTable NewTable = ListWellsToProcess.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
                    NewTable.Name = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - " + TmpPlate.GetName();


                    cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
                    CV1.SetInputData(NewTable);
                    CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
                    CV1.Title = TmpPlate.GetName();
                    CV1.Run();

                    CDT.SetInputData(CV1.GetOutPut());
                }
                CDT.Run();
                CDW1.SetInputData(CDT.GetOutPut());
                CDW1.Title = "Stacked Histogram - " + cGlobalInfo.CurrentScreening.ListPlatesActive.Count + " plates";
            }

            CDW1.Run();
            CDW1.Display();
        }
Beispiel #4
0
        public void PerformScreeningClustering(List<cPlate> ListPlatesToProcess, bool IsOneByOne)
        {


            this.Cursor = Cursors.WaitCursor;
            cMachineLearning MachineLearning = new cMachineLearning(this.GlobalInfo);
            cParamAlgo ParamAlgoForClustering = MachineLearning.AskAndGetClusteringAlgo();
            if (ParamAlgoForClustering == null)
            {
                this.Cursor = Cursors.Default;
                return;
            }

            //DataTable dt = new DataTable();
            cExtendedTable dt = new cExtendedTable();


            for (int IdxDesc = 0; IdxDesc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; IdxDesc++)
            {
                if (cGlobalInfo.CurrentScreening.ListDescriptors[IdxDesc].IsActive())
                    dt.Add(new cExtendedList(cGlobalInfo.CurrentScreening.ListDescriptors[IdxDesc].GetName()));
            }
            if (IsOneByOne)
            {
                foreach (cPlate itemPlate in ListPlatesToProcess)
                {
                    cListWells ListWell = new cListWells(null);

                    foreach (var item in itemPlate.ListActiveWells)
                        ListWell.Add(item);

                    dt = ListWell.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors(), false, false);

                    MachineLearning.SelectedClusterer = MachineLearning.BuildClusterer(ParamAlgoForClustering, dt);

                    if (MachineLearning.SelectedClusterer != null)
                    {
                        double[] Assign = MachineLearning.EvaluteAndDisplayClusterer(richTextBoxInfoClustering,
                                                                null,
                                                                MachineLearning.CreateInstancesWithoutClass(dt)).getClusterAssignments();

                        MachineLearning.Classes = new cExtendedList();
                        MachineLearning.Classes.AddRange(Assign);
                    }
                    if (MachineLearning.Classes.Max() >= cGlobalInfo.ListWellClasses.Count)
                    {
                        MessageBox.Show("The number of clusters is higher than the supported number of classes. Operation cancelled !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.Cursor = Cursors.Default;
                        return;
                    }
                    if (MachineLearning.Classes.IsContainNegative() || (MachineLearning.Classes.Count == 0))
                    {
                        MessageBox.Show("Negative or null cluster index identified. Operation cancelled !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        this.Cursor = Cursors.Default;
                        return;
                    }
                    // ----- update well classes ------
                    int IdxWell = 0;
                    foreach (cWell item in itemPlate.ListActiveWells)
                        item.SetClass((int)MachineLearning.Classes[IdxWell++]);
                }
            }
            else
            {
                cListWells ListWell = new cListWells(null);
                foreach (cPlate itemPlate in ListPlatesToProcess)
                {
                    foreach (cWell item in itemPlate.ListActiveWells)
                    {
                        //cExtendedList ListValues = item.GetAverageValuesList(false);
                        //dt.Rows.Add();
                        //int RealIdx = 0;
                        //for (int IdxDesc = 0; IdxDesc < CompleteScreening.ListDescriptors.Count; IdxDesc++)
                        //{
                        //    if (CompleteScreening.ListDescriptors[IdxDesc].IsActive())
                        //        dt.Rows[dt.Rows.Count - 1][RealIdx++] = ListValues[IdxDesc];
                        ListWell.Add(item);
                        //}
                    }
                }

                dt = ListWell.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors(), false, false);



                MachineLearning.SelectedClusterer = MachineLearning.BuildClusterer(ParamAlgoForClustering, dt);

                if (MachineLearning.SelectedClusterer != null)
                {
                    double[] Assign = MachineLearning.EvaluteAndDisplayClusterer(richTextBoxInfoClustering,
                                                            null,
                                                            MachineLearning.CreateInstancesWithoutClass(dt)).getClusterAssignments();

                    MachineLearning.Classes = new cExtendedList();
                    MachineLearning.Classes.AddRange(Assign);
                }
                if (MachineLearning.Classes.Max() >= cGlobalInfo.ListWellClasses.Count)
                {
                    MessageBox.Show("The number of cluster is higher than the supported number of classes. Operation cancelled !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.Cursor = Cursors.Default;
                    return;
                }
                if (MachineLearning.Classes.IsContainNegative() || (MachineLearning.Classes.Count == 0))
                {
                    MessageBox.Show("Negative or null cluster index identified. Operation cancelled !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    this.Cursor = Cursors.Default;
                    return;
                }
                int IdxWell = 0;
                // ----- update well classes ------
                foreach (cPlate itemPlate in ListPlatesToProcess)
                {
                    foreach (cWell item in itemPlate.ListActiveWells)
                        item.SetClass((int)MachineLearning.Classes[IdxWell++]);
                }
            }
            cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().DisplayDistribution(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor(), false);
            this.Cursor = Cursors.Default;
        }
Beispiel #5
0
        private void ToolStripMenuItem_DisplayHistograms(object sender, EventArgs e)
        {
            if (GlobalInfo == null) return;
            for (int i = 0; i < cGlobalInfo.ListWellClasses.Count; i++)
            {
                if (cGlobalInfo.ListWellClasses[i].Name == this.Name)
                {
                    Idx = i;
                    break;
                }
            }

            if (Idx == -1) return;

            if ((cGlobalInfo.CurrentScreening.ListDescriptors == null) || (cGlobalInfo.CurrentScreening.ListDescriptors.Count == 0)) return;

            cDisplayToWindow CDW1 = new cDisplayToWindow();

            cListWells ListWellsToProcess = new cListWells(null);
            List<cPlate> PlateList = new List<cPlate>();
            cDesignerSplitter DS = new cDesignerSplitter();

            foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) PlateList.Add(TmpPlate);

            foreach (cPlate TmpPlate in PlateList)
                foreach (cWell item in TmpPlate.ListActiveWells)
                    if (item.GetCurrentClassIdx() == base.Idx) ListWellsToProcess.Add(item);

            cExtendedTable NewTable2 = ListWellsToProcess.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
            NewTable2.Name = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - Histogram - " + PlateList.Count + " plates";

            cViewerStackedHistogram CV2 = new cViewerStackedHistogram();
            CV2.SetInputData(NewTable2);
            CV2.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
            CV2.Chart.IsBorder = false;
            CV2.Chart.Width = 0;
            CV2.Chart.Height = 0;

            //StripLine AverageLine = new StripLine();
            //AverageLine.BackColor = Color.Red;
            //AverageLine.IntervalOffset = GlobalInfo.CurrentScreen.ListDescriptors[Parent.ListDescriptors.CurrentSelectedDescriptor].GetValue();
            //AverageLine.StripWidth = 0.0001;
            //AverageLine.Text = this.ListDescriptors[Parent.ListDescriptors.CurrentSelectedDescriptor].GetValue().ToString("N2");

            CV2.Run();

            //CV2.Chart.ChartAreas[0].AxisX.StripLines.Add(AverageLine);

            DS.SetInputData(CV2.GetOutPut());

            PlateList.Clear();
            PlateList.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
            ListWellsToProcess.Clear();
            foreach (cPlate TmpPlate in PlateList)
                foreach (cWell item in TmpPlate.ListActiveWells)
                    if (item.GetCurrentClassIdx() == Idx) ListWellsToProcess.Add(item);

            CDW1.Title = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - Histogram (" + PlateList[0].GetName() + ")";

            cExtendedTable NewTable = ListWellsToProcess.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
            NewTable.Name = CDW1.Title;

            cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
            CV1.SetInputData(NewTable);
            CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
            CV1.Chart.Width = 0;
            CV1.Chart.Height = 0;

            //  CV1.Chart.ChartAreas[0].AxisX.Minimum = CV2.Chart.ChartAreas[0].AxisX.Minimum;
            //  CV1.Chart.ChartAreas[0].AxisX.Maximum = CV2.Chart.ChartAreas[0].AxisX.Maximum;
            CV1.Run();

            // CV1.Chart.ChartAreas[0].AxisX.StripLines.Add(AverageLine);
            DS.SetInputData(CV1.GetOutPut());
            DS.Run();

            CDW1.SetInputData(DS.GetOutPut());
            CDW1.Run();
            CDW1.Display();

            return;
        }
Beispiel #6
0
        private void ToolStripMenuItem_DisplayAsStackedHistograms(object sender, EventArgs e)
        {
            cDisplayToWindow CDW1 = new cDisplayToWindow();

            cListWells ListWellsToProcess = new cListWells(null);
            List<cPlate> PlateList = new List<cPlate>();

            PlateList.Add(this);

            foreach (cPlate TmpPlate in PlateList)
                foreach (cWell item in TmpPlate.ListActiveWells)
                    if (item.GetCurrentClassIdx() != -1) ListWellsToProcess.Add(item);

            CDW1.Title = this.ParentScreening.ListDescriptors[this.ParentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - Stacked Histogram (" + PlateList[0].Name + ")";

            cExtendedTable NewTable = ListWellsToProcess.GetAverageDescriptorValues(this.ParentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
            NewTable.Name = CDW1.Title;

            cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
            CV1.SetInputData(NewTable);
            CV1.Chart.LabelAxisX = this.ParentScreening.ListDescriptors[this.ParentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
            CV1.Run();

            CDW1.SetInputData(CV1.GetOutPut());

            CDW1.Run();
            CDW1.Display();
        }
Beispiel #7
0
        //private void ToolStripMenuItem_DisplayImage(object sender, EventArgs e)
        //{
        //    vtkImageData ID0 = null;
        //    string[] ListChar = this.Info.Split('.');
        //    if (ListChar[ListChar.Length - 1].ToLower() == "jpg")
        //    {
        //        vtkJPEGReader JPEGReader = vtkJPEGReader.New();
        //        JPEGReader.SetFileName(this.Info);
        //        JPEGReader.Update();
        //        ID0 = JPEGReader.GetOutput();
        //    }
        //    if ((ListChar[ListChar.Length - 1].ToLower() == "tif") || (ListChar[ListChar.Length - 1].ToLower() == "tiff"))
        //    {
        //        vtkTIFFReader TIFFReader = vtkTIFFReader.New();
        //        TIFFReader.SetFileName(this.Info);
        //        TIFFReader.Update();
        //        ID0 = TIFFReader.GetOutput();
        //    }
        //    vtkImageReader Reader = vtkImageReader.New();
        //    Reader.SetFileName(this.Info);
        //    Reader.Update();
        //    if (Reader == null) return;
        //    //vtkJPEGReader TIFFReader = vtkJPEGReader.New();
        //    //TIFFReader.SetFileName(this.Info);
        //    //TIFFReader.Update();
        //    //    cVolume3D Volume3D0 = new cVolume3D(ID0, new HCSAnalyzer.Classes._3D.cPoint3D(0, 0, 0));
        //    cViewerImage3D VI3D = new cViewerImage3D();
        //    VI3D.SetInputData(ID0);
        //    VI3D.Run();
        //    cDisplayToWindow DTW = new cDisplayToWindow();
        //    DTW.SetInputData(VI3D.GetOutPut());
        //    DTW.Title = this.Info;
        //    DTW.Run();
        //    DTW.Title = this.Info;
        //    DTW.Display();
        //}
        private void DisplayHisto(object sender, EventArgs e)
        {
            if ((cGlobalInfo.CurrentScreening.ListDescriptors == null) || (cGlobalInfo.CurrentScreening.ListDescriptors.Count == 0)) return;

            cDisplayToWindow CDW1 = new cDisplayToWindow();

            cListWells ListWellsToProcess = new cListWells(null);
            List<cPlate> PlateList = new List<cPlate>();
            cDesignerSplitter DS = new cDesignerSplitter();

            foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesActive) PlateList.Add(TmpPlate);

            foreach (cPlate TmpPlate in PlateList)
                foreach (cWell item in TmpPlate.ListActiveWells)
                    if (item.GetCurrentClassIdx() != -1) ListWellsToProcess.Add(item);

            cExtendedTable NewTable2 = ListWellsToProcess.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
            NewTable2.Name = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - Stacked Histogram - " + PlateList.Count + " plates";

            cViewerStackedHistogram CV2 = new cViewerStackedHistogram();
            CV2.SetInputData(NewTable2);
            CV2.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
            CV2.Chart.IsBorder = false;
            CV2.Chart.Width = 0;
            CV2.Chart.Height = 0;

            StripLine AverageLine = new StripLine();
            AverageLine.BackColor = Color.Red;
            AverageLine.IntervalOffset = this.ListSignatures[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetValue();
            AverageLine.StripWidth = 0.0001;
            AverageLine.Text = this.ListSignatures[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetValue().ToString("N2");

            CV2.Run();

            CV2.Chart.ChartAreas[0].AxisX.StripLines.Add(AverageLine);

            DS.SetInputData(CV2.GetOutPut());

            PlateList.Clear();
            PlateList.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
            ListWellsToProcess.Clear();
            foreach (cPlate TmpPlate in PlateList)
                foreach (cWell item in TmpPlate.ListActiveWells)
                    if (item.GetCurrentClassIdx() != -1) ListWellsToProcess.Add(item);

            CDW1.Title = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName() + " - Stacked Histogram (" + PlateList[0].GetName() + ")";

            cExtendedTable NewTable = ListWellsToProcess.GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx);
            NewTable.Name = CDW1.Title;

            cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
            CV1.SetInputData(NewTable);
            CV1.Chart.LabelAxisX = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptorIdx].GetName();
            CV1.Chart.Width = 0;
            CV1.Chart.Height = 0;

            //  CV1.Chart.ChartAreas[0].AxisX.Minimum = CV2.Chart.ChartAreas[0].AxisX.Minimum;
            //  CV1.Chart.ChartAreas[0].AxisX.Maximum = CV2.Chart.ChartAreas[0].AxisX.Maximum;
            CV1.Run();

            CV1.Chart.ChartAreas[0].AxisX.StripLines.Add(AverageLine);

            DS.SetInputData(CV1.GetOutPut());

            DS.Run();

            CDW1.SetInputData(DS.GetOutPut());

            CDW1.Run();
            CDW1.Display();

            return;

            //cExtendedList Pos = new cExtendedList();
            //cWell TempWell;

            //int NumberOfPlates = cGlobalInfo.PlateListWindow.listBoxPlateNameToProcess.Items.Count;

            //// loop on all the plate
            //for (int PlateIdx = 0; PlateIdx < NumberOfPlates; PlateIdx++)
            //{
            //    cPlate CurrentPlateToProcess = cGlobalInfo.CurrentScreening.ListPlatesActive.GetPlate((string)cGlobalInfo.PlateListWindow.listBoxPlateNameToProcess.Items[PlateIdx]);

            //    for (int row = 0; row < cGlobalInfo.CurrentScreening.Rows; row++)
            //        for (int col = 0; col < cGlobalInfo.CurrentScreening.Columns; col++)
            //        {
            //            TempWell = CurrentPlateToProcess.GetWell(col, row, false);
            //            if (TempWell == null) continue;
            //            else
            //            {
            //                if (TempWell.GetClassIdx() == this.ClassForClassif)
            //                    Pos.Add(TempWell.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptor].GetValue());
            //            }
            //        }
            //}

            //if (Pos.Count == 0)
            //{
            //    MessageBox.Show("No well of class " + cGlobalInfo.CurrentScreening.SelectedClass + " selected !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            //    return;
            //}

            //List<double[]> HistoPos = Pos.CreateHistogram((int)cGlobalInfo.OptionsWindow.numericUpDownHistoBin.Value);
            //if (HistoPos == null) return;
            //cWindowToDisplayHisto NewWindow = new cWindowToDisplayHisto(this.Parent, Pos);

            //Series SeriesPos = new Series();
            //SeriesPos.ShadowOffset = 1;

            //if (HistoPos.Count == 0) return;

            //for (int IdxValue = 0; IdxValue < HistoPos[0].Length; IdxValue++)
            //{
            //    SeriesPos.Points.AddXY(HistoPos[0][IdxValue], HistoPos[1][IdxValue]);
            //    SeriesPos.Points[IdxValue].ToolTip = HistoPos[1][IdxValue].ToString();

            //    if (this.ClassForClassif == -1)
            //        SeriesPos.Points[IdxValue].Color = Color.Black;
            //    else
            //        SeriesPos.Points[IdxValue].Color = cGlobalInfo.ListWellClasses[this.ClassForClassif].ColourForDisplay;
            //}

            //ChartArea CurrentChartArea = new ChartArea();
            //CurrentChartArea.BorderColor = Color.Black;

            //NewWindow.chartForSimpleForm.ChartAreas.Add(CurrentChartArea);
            //CurrentChartArea.Axes[0].MajorGrid.Enabled = false;
            //CurrentChartArea.Axes[0].Title = cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptor].GetName();
            //CurrentChartArea.Axes[1].Title = "Sum";
            //CurrentChartArea.AxisX.LabelStyle.Format = "N2";

            //NewWindow.chartForSimpleForm.TextAntiAliasingQuality = TextAntiAliasingQuality.High;
            //CurrentChartArea.BackGradientStyle = GradientStyle.TopBottom;
            //CurrentChartArea.BackColor = cGlobalInfo.OptionsWindow.panel1.BackColor;
            //CurrentChartArea.BackSecondaryColor = Color.White;

            //SeriesPos.ChartType = SeriesChartType.Column;
            //// SeriesPos.Color = cGlobalInfo.CurrentScreening.GetColor(1);
            //NewWindow.chartForSimpleForm.Series.Add(SeriesPos);

            //NewWindow.chartForSimpleForm.ChartAreas[0].CursorX.IsUserEnabled = true;
            //NewWindow.chartForSimpleForm.ChartAreas[0].CursorX.IsUserSelectionEnabled = true;
            //NewWindow.chartForSimpleForm.ChartAreas[0].AxisX.ScaleView.Zoomable = true;
            //NewWindow.chartForSimpleForm.ChartAreas[0].AxisX.ScrollBar.IsPositionedInside = true;

            //StripLine AverageLine = new StripLine();
            //AverageLine.BackColor = Color.Red;
            //AverageLine.IntervalOffset = this.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptor].GetValue();
            //AverageLine.StripWidth = 0.0001;
            //AverageLine.Text = String.Format("{0:0.###}", this.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptor].GetValue());
            //CurrentChartArea.AxisX.StripLines.Add(AverageLine);

            //if (cGlobalInfo.OptionsWindow.checkBoxDisplayHistoStats.Checked)
            //{
            //    StripLine NAverageLine = new StripLine();
            //    NAverageLine.BackColor = Color.Black;
            //    NAverageLine.IntervalOffset = Pos.Mean();
            //    NAverageLine.StripWidth = 0.0001;// double.Epsilon;
            //    CurrentChartArea.AxisX.StripLines.Add(NAverageLine);
            //    NAverageLine.Text = String.Format("{0:0.###}", NAverageLine.IntervalOffset);

            //    StripLine StdLine = new StripLine();
            //    StdLine.BackColor = Color.FromArgb(64, Color.Black);
            //    double Std = Pos.Std();
            //    StdLine.IntervalOffset = NAverageLine.IntervalOffset - 0.5 * Std;
            //    StdLine.StripWidth = Std;
            //    CurrentChartArea.AxisX.StripLines.Add(StdLine);
            //    //NAverageLine.StripWidth = 0.01;
            //}

            //Title CurrentTitle = new Title(this.StateForClassif + " - " + cGlobalInfo.CurrentScreening.ListDescriptors[cGlobalInfo.CurrentScreening.ListDescriptors.CurrentSelectedDescriptor].GetName() + " histogram.");
            //CurrentTitle.Font = new System.Drawing.Font("Arial", 11, FontStyle.Bold);
            //NewWindow.chartForSimpleForm.Titles.Add(CurrentTitle);

            //NewWindow.Text = CurrentTitle.Text;
            //NewWindow.Show();
            //NewWindow.chartForSimpleForm.Update();
            //NewWindow.chartForSimpleForm.Show();
            //NewWindow.Controls.AddRange(new System.Windows.Forms.Control[] { NewWindow.chartForSimpleForm });

            //return;
        }