Ejemplo n.º 1
0
        public PanelForPlatesSelection(bool IsCheckBoxes, cListPlates InitialList, bool SelectOnlyActive)
        {
            if (InitialList == null)
                InitialList = cGlobalInfo.CurrentScreening.ListPlatesAvailable;

            int NumPlates = InitialList.Count;
            this.AutoScroll = true;
            this.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelForClassSelection_MouseDown);

            if (IsCheckBoxes)
                ListCheckBoxes = new List<System.Windows.Forms.CheckBox>();
            else
                ListRadioButtons = new List<System.Windows.Forms.RadioButton>();

            for (int IdxPlate = 0; IdxPlate < NumPlates; IdxPlate++)
            {
                if (IsCheckBoxes)
                {
                    System.Windows.Forms.CheckBox CurrentCheckBox = new System.Windows.Forms.CheckBox();
                    CurrentCheckBox.Text = InitialList[IdxPlate].GetName();
                    CurrentCheckBox.Width = 300;
                    CurrentCheckBox.Tag = InitialList[IdxPlate];
                    CurrentCheckBox.Location = new System.Drawing.Point(5, CurrentCheckBox.Height * IdxPlate);

                    if (SelectOnlyActive)
                    {
                        cPlate TmpPlate = cGlobalInfo.CurrentScreening.ListPlatesActive.FindPlate(InitialList[IdxPlate]);
                        if(TmpPlate==null)
                            CurrentCheckBox.Checked = false;
                        else
                            CurrentCheckBox.Checked = true;
                    }
                    else
                        CurrentCheckBox.Checked = true;

                    System.Windows.Forms.ToolTip ToolTipForPlate = new System.Windows.Forms.ToolTip();
                    ToolTipForPlate.SetToolTip(CurrentCheckBox, InitialList[IdxPlate].GetShortInfo());
                    CurrentCheckBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelForClassSelection_MouseDown);
                    ListCheckBoxes.Add(CurrentCheckBox);
                }
                else
                {
                    System.Windows.Forms.RadioButton CurrentRadioButton = new System.Windows.Forms.RadioButton();
                    CurrentRadioButton.Text = InitialList[IdxPlate].GetName();
                    CurrentRadioButton.Location = new System.Drawing.Point(5, CurrentRadioButton.Height * IdxPlate);
                    CurrentRadioButton.Checked = false;
                    System.Windows.Forms.ToolTip ToolTipForPlate = new System.Windows.Forms.ToolTip();
                    ToolTipForPlate.SetToolTip(CurrentRadioButton, InitialList[IdxPlate].GetShortInfo());
                    CurrentRadioButton.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PanelForClassSelection_MouseDown);
                    ListRadioButtons.Add(CurrentRadioButton);
                }
            }

            if (IsCheckBoxes)
                this.Controls.AddRange(ListCheckBoxes.ToArray());
            else
                this.Controls.AddRange(ListRadioButtons.ToArray());
        }
Ejemplo n.º 2
0
        public cFeedBackMessage Run()
        {
            FormForDisplay WindowToDisplay = new FormForDisplay();
            WindowToDisplay.Text = "Plates Selection";
            WindowToDisplay.FormBorderStyle = FormBorderStyle.Sizable;

            PanelForPlatesSelection PlateSelectionPanel = new PanelForPlatesSelection(this.IsCheckBoxes, ListInitialPlates, IsCheckOnlyActive);
            PlateSelectionPanel.Height = WindowToDisplay.Height - 70;
            PlateSelectionPanel.Width = WindowToDisplay.Width - 30;
               // PlateSelectionPanel.SelectAll();
            //ClassSelectionPanel.Select(0);
            //ClassSelectionPanel.Select(1);
            PlateSelectionPanel.Location = new System.Drawing.Point(5, 5);
            //PlateSelectionPanel.Width = 300;
            //PlateSelectionPanel.Height = PlateSelectionPanel.ListCheckBoxes.Count * 25;
            PlateSelectionPanel.BorderStyle = BorderStyle.Fixed3D;
            PlateSelectionPanel.Anchor =(System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom
                        | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right);
            // MyPanel.Controls.Add(ClassSelectionPanel);

            Button ReturnButton = new Button();
            ReturnButton.Text = "Ok";
            ReturnButton.Anchor = (System.Windows.Forms.AnchorStyles)(System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left);

            ReturnButton.DialogResult = DialogResult.OK;
            ReturnButton.Location = new System.Drawing.Point(PlateSelectionPanel.Location.X, PlateSelectionPanel.Location.Y + PlateSelectionPanel.Height );
            WindowToDisplay.Controls.Add(ReturnButton);

            WindowToDisplay.Controls.Add(PlateSelectionPanel);
            WindowToDisplay.Width = PlateSelectionPanel.Width + 28;
            WindowToDisplay.Height = PlateSelectionPanel.Height + ReturnButton.Height + 48;

            if (WindowToDisplay.ShowDialog() != System.Windows.Forms.DialogResult.OK)
            {
                FeedBackMessage.IsSucceed = false;
                FeedBackMessage.Message = "Selection aborded !";
                return FeedBackMessage;
            }

            this.ListSelectedPlates = PlateSelectionPanel.GetListSelectedPlates();

            if (this.ListSelectedPlates.Count == 0)
            {
                FeedBackMessage.IsSucceed = false;
                FeedBackMessage.Message = "No class selected !";
                return FeedBackMessage;
            }
            return FeedBackMessage;
        }
Ejemplo n.º 3
0
        public cListPlates GetListSelectedPlates()
        {
            cListPlates LP = new cListPlates();

            foreach (var item in this.ListCheckBoxes)
            {
                if (item.Checked)
                    LP.Add((cPlate)item.Tag);
            }
            return LP;
        }
Ejemplo n.º 4
0
        //private void pCAToolStripMenuItem2_Click(object sender, EventArgs e)
        //{
        //    ComputeAndDisplayPCA(CompleteScreening.ListPlatesActive);
        //}
        //private void ComputeAndDisplayPCA(cListPlates PlatesToProcess)
        //{
        //    if (CompleteScreening == null) return;
        //    FormClassification WindowClassification = new FormClassification(CompleteScreening);
        //    WindowClassification.label1.Text = "Class of interest";
        //    WindowClassification.Text = "PCA";
        //    WindowClassification.buttonClassification.Text = "Process";
        //    if (WindowClassification.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
        //    int NeutralClass = WindowClassification.comboBoxForNeutralClass.SelectedIndex;
        //    int NumWell = 0;
        //    int NumWellForLearning = 0;
        //    foreach (cPlate CurrentPlate in PlatesToProcess)
        //    {
        //        foreach (cWell CurrentWell in CurrentPlate.ListActiveWells)
        //        {
        //            if (CurrentWell.GetClassIdx() == NeutralClass)
        //                NumWellForLearning++;
        //        }
        //        NumWell += CurrentPlate.GetNumberOfActiveWells();
        //    }
        //    if (NumWellForLearning == 0)
        //    {
        //        MessageBox.Show("No well of the selected class identified", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        //        return;
        //    }
        //    int NumDesc = CompleteScreening.GetNumberOfActiveDescriptor();
        //    if (NumDesc <= 1)
        //    {
        //        MessageBox.Show("More than one descriptor are required for this operation", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
        //        return;
        //    }
        //    double[,] DataForPCA = new double[NumWellForLearning, CompleteScreening.GetNumberOfActiveDescriptor() + 1];
        //    //   return;
        //    Matrix EigenVectors = PCAComputation(DataForPCA, NumWellForLearning, NumDesc, NeutralClass, PlatesToProcess);
        //    if (EigenVectors == null) return;
        //    SimpleForm NewWindow = new SimpleForm(CompleteScreening);
        //    Series CurrentSeries = new Series();
        //    CurrentSeries.ShadowOffset = 1;
        //    Matrix CurrentPt = new Matrix(NumWell, NumDesc);
        //    DataForPCA = new double[NumWell, NumDesc + 1];
        //    for (int desc = 0; desc < NumDesc; desc++)
        //    {
        //        if (CompleteScreening.ListDescriptors[desc].IsActive() == false) continue;
        //        List<double> CurrentDesc = new List<double>();
        //        foreach (cPlate CurrentPlate in PlatesToProcess)
        //        {
        //            for (int IdxValue = 0; IdxValue < CompleteScreening.Columns; IdxValue++)
        //                for (int IdxValue0 = 0; IdxValue0 < CompleteScreening.Rows; IdxValue0++)
        //                {
        //                    cWell TmpWell = CurrentPlate.GetWell(IdxValue, IdxValue0, true);
        //                    if (TmpWell == null) continue;
        //                    CurrentDesc.Add(TmpWell.ListDescriptors[desc].GetValue());
        //                }
        //        }
        //        for (int i = 0; i < NumWell; i++)
        //            DataForPCA[i, desc] = CurrentDesc[i];
        //    }
        //    int IDx = 0;
        //    foreach (cPlate CurrentPlate in PlatesToProcess)
        //    {
        //        for (int IdxValue = 0; IdxValue < CompleteScreening.Columns; IdxValue++)
        //            for (int IdxValue0 = 0; IdxValue0 < CompleteScreening.Rows; IdxValue0++)
        //            {
        //                cWell TmpWell = CurrentPlate.GetWell(IdxValue, IdxValue0, true);
        //                if (TmpWell == null) continue;
        //                DataForPCA[IDx++, NumDesc] = TmpWell.GetClassIdx();
        //            }
        //    }
        //    for (int i = 0; i < NumWell; i++)
        //        for (int j = 0; j < NumDesc; j++) CurrentPt.addElement(i, j, DataForPCA[i, j]);
        //    Matrix NewPt = new Matrix(NumWell, NumDesc);
        //    NewPt = CurrentPt.multiply(EigenVectors);
        //    double MinY = double.MaxValue, MaxY = double.MinValue;
        //    for (int IdxValue0 = 0; IdxValue0 < NumWell; IdxValue0++)
        //    {
        //        double CurrentY = NewPt.getElement(IdxValue0, 1);
        //        if (CurrentY < MinY) MinY = CurrentY;
        //        if (CurrentY > MaxY) MaxY = CurrentY;
        //        CurrentSeries.Points.AddXY(NewPt.getElement(IdxValue0, 0), CurrentY);
        //        CurrentSeries.Points[IdxValue0].Color = CompleteScreening.GlobalInfo.ListWellClasses[(int)DataForPCA[IdxValue0, NumDesc]].ColourForDisplay;
        //        CurrentSeries.Points[IdxValue0].MarkerStyle = MarkerStyle.Circle;
        //        CurrentSeries.Points[IdxValue0].MarkerSize = 8;
        //    }
        //    ChartArea CurrentChartArea = new ChartArea();
        //    CurrentChartArea.BorderColor = Color.Black;
        //    NewWindow.chartForSimpleForm.ChartAreas.Add(CurrentChartArea);
        //    NewWindow.chartForSimpleForm.TextAntiAliasingQuality = TextAntiAliasingQuality.High;
        //    CurrentChartArea.BackColor = Color.FromArgb(164, 164, 164);
        //    string AxeName = "";
        //    int IDxDesc = 0;
        //    for (int Desc = 0; Desc < CompleteScreening.ListDescriptors.Count; Desc++)
        //    {
        //        if (CompleteScreening.ListDescriptors[Desc].IsActive() == false) continue;
        //        AxeName += String.Format("{0:0.###}", EigenVectors.getElement(IDxDesc++, 0)) + "x" + CompleteScreening.ListDescriptors[Desc].GetName() + " + ";
        //        //   AxeName += String.Format("{0:0.##}", EigenVectors.getElement(CompleteScreening.ListDescriptors.Count - 1, 0)) + "x" + CompleteScreening.ListDescriptorName[CompleteScreening.ListDescriptors.Count - 1];
        //    }
        //    CurrentChartArea.Axes[0].Title = AxeName.Remove(AxeName.Length - 3);
        //    CurrentChartArea.Axes[0].MajorGrid.Enabled = true;
        //    AxeName = "";
        //    IDxDesc = 0;
        //    for (int Desc = 0; Desc < CompleteScreening.ListDescriptors.Count; Desc++)
        //    {
        //        if (CompleteScreening.ListDescriptors[Desc].IsActive() == false) continue;
        //        AxeName += String.Format("{0:0.###}", EigenVectors.getElement(IDxDesc++, 1)) + "x" + CompleteScreening.ListDescriptors[Desc].GetName() + " + ";
        //    }
        //    //AxeName += String.Format("{0:0.##}", EigenVectors.getElement(CompleteScreening.ListDescriptors.Count - 1, 0)) + "x" + CompleteScreening.ListDescriptorName[CompleteScreening.ListDescriptors.Count - 1];
        //    CurrentChartArea.Axes[1].Title = AxeName.Remove(AxeName.Length - 3);
        //    CurrentChartArea.Axes[1].MajorGrid.Enabled = true;
        //    CurrentChartArea.Axes[1].Minimum = MinY;
        //    CurrentChartArea.Axes[1].Maximum = MaxY;
        //    CurrentChartArea.AxisX.LabelStyle.Format = "N2";
        //    CurrentChartArea.AxisY.LabelStyle.Format = "N2";
        //    CurrentSeries.ChartType = SeriesChartType.Point;
        //    if (GlobalInfo.OptionsWindow.checkBoxDisplayFastPerformance.Checked) CurrentSeries.ChartType = SeriesChartType.FastPoint;
        //    NewWindow.chartForSimpleForm.Series.Add(CurrentSeries);
        //    NewWindow.Text = "PCA";
        //    NewWindow.Show();
        //    NewWindow.chartForSimpleForm.Update();
        //    NewWindow.chartForSimpleForm.Show();
        //    NewWindow.Controls.AddRange(new System.Windows.Forms.Control[] { NewWindow.chartForSimpleForm });
        //}
        private Matrix PCAComputation(double[,] DataForPCA, int NumWellForLearning, int NumDesc, int NeutralClass, cListPlates PlatesToProcess)
        {
            for (int desc = 0; desc < NumDesc; desc++)
            {
                if (cGlobalInfo.CurrentScreening.ListDescriptors[desc].IsActive() == false) continue;
                List<double> CurrentDesc = new List<double>();

                foreach (cPlate CurrentPlate in PlatesToProcess)
                {
                    for (int IdxValue = 0; IdxValue < cGlobalInfo.CurrentScreening.Columns; IdxValue++)
                        for (int IdxValue0 = 0; IdxValue0 < cGlobalInfo.CurrentScreening.Rows; IdxValue0++)
                        {
                            cWell TmpWell = CurrentPlate.GetWell(IdxValue, IdxValue0, true);
                            if ((TmpWell == null) || (TmpWell.GetCurrentClassIdx() != NeutralClass)) continue;
                            CurrentDesc.Add(TmpWell.ListSignatures[desc].GetValue());
                        }
                }
                for (int i = 0; i < NumWellForLearning; i++)
                {
                    DataForPCA[i, desc] = CurrentDesc[i];
                }
            }
            int IDx = 0;

            foreach (cPlate CurrentPlate in PlatesToProcess)
            {
                foreach (cWell CurrentWell in CurrentPlate.ListActiveWells)
                {
                    if (CurrentWell.GetCurrentClassIdx() == NeutralClass)
                        DataForPCA[IDx++, NumDesc] = NeutralClass;// CurrentWell.GetClassIdx();
                }
                // NumWell += CompleteScreening.GetCurrentDisplayPlate().GetNumberOfActiveWells();
            }

            double[,] Basis;
            double[] s2;
            int Info;

            alglib.pcabuildbasis(DataForPCA, NumWellForLearning, NumDesc, out Info, out s2, out Basis);

            Matrix EigenVectors = null;
            if (Info > 0)
            {
                EigenVectors = new Matrix(NumDesc, NumDesc);
                for (int row = 0; row < NumDesc; row++)
                    for (int col = 0; col < NumDesc; col++)
                        EigenVectors.addElement(row, col, Basis[row, col]);
            }
            return EigenVectors;
        }
Ejemplo n.º 5
0
        private void GenerateRandomProjectionDescriptorItem(object sender, EventArgs e)
        {
            FormForProjections WindowClassification = new FormForProjections();
            //WindowClassification.buttonClassification.Text = "Process";
            WindowClassification.label1.Text = "Class of Interest";
            WindowClassification.Text = "Random Projection";
            WindowClassification.IsPCA = true;
            WindowClassification.numericUpDownNumberOfAxis.Maximum = cGlobalInfo.CurrentScreening.GetNumberOfActiveDescriptor();

            cListPlates PlatesToProcess = new cListPlates();
            if (WindowClassification.radioButtonFromCurrentPlate.Checked)
                PlatesToProcess.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
            else
                PlatesToProcess = cGlobalInfo.CurrentScreening.ListPlatesActive;

            WindowClassification.PlatesToProcess = PlatesToProcess;
            if (WindowClassification.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
        }
Ejemplo n.º 6
0
        public string GeneratePCADescriptor(cListPlates PlatesToProcess, int NumberOfAxis, int NeutralClass)
        {
            int NumWell = 0;
            int NumWellForLearning = 0;
            foreach (cPlate CurrentPlate in PlatesToProcess)
            {
                NumWellForLearning += CurrentPlate.GetNumberOfWellOfClass(NeutralClass);
                NumWell += cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().GetNumberOfActiveWells();
            }

            if (NumWellForLearning == 0)
            {
                MessageBox.Show("No well identified !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }

            int NumDesc = cGlobalInfo.CurrentScreening.GetNumberOfActiveDescriptor();

            if (NumDesc <= 1)
            {
                MessageBox.Show("More than one descriptor are required for this operation", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return null;
            }

            double[,] DataForLDA = new double[NumWellForLearning, cGlobalInfo.CurrentScreening.GetNumberOfActiveDescriptor() + 1];

            //   return;
            Matrix EigenVectors = PCAComputation(DataForLDA, NumWellForLearning, NumDesc, NeutralClass, PlatesToProcess);

            string AxeName = "";
            int IDxDesc = 0;
            //for (int Desc = 0; Desc < CompleteScreening.ListDescriptors.Count; Desc++)
            //{
            //    if (CompleteScreening.ListDescriptors[Desc].IsActive() == false) continue;

            //       AxeName += String.Format("{0:0.##}", EigenVectors.getElement(CompleteScreening.ListDescriptors.Count - 1, 0)) + "x" + CompleteScreening.ListDescriptorName[CompleteScreening.ListDescriptors.Count - 1];
            //}

            int OriginalDescNumber = cGlobalInfo.WindowHCSAnalyzer.checkedListBoxActiveDescriptors.Items.Count;

            for (int AxesIdx = 0; AxesIdx < NumberOfAxis; AxesIdx++)
            {

                //for (int Idx = 0; Idx < CompleteScreening.GlobalInfo.WindowHCSAnalyzer.checkedListBoxActiveDescriptors.Items.Count; Idx++)
                //{

                //    if (CompleteScreening.ListDescriptors[Idx].IsActive())
                //        if (CompleteScreening.ListDescriptors[Idx].GetBinNumber() == 1)
                //        {
                //            AxeName += String.Format("{0:0.###}", EigenVectors.getElement(IDxDesc++, AxesIdx)) + "x" + CompleteScreening.ListDescriptors[Idx].GetName() + " + ";
                //        }
                //        else
                //        {
                //            MessageBox.Show("Descriptor length not consistent (" + CompleteScreening.ListDescriptors[Idx].GetName() + " : " + CompleteScreening.ListDescriptors[Idx].GetBinNumber() + " bins", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                //            return "";
                //        }
                //}

                //cDescriptorsType ColumnType = new cDescriptorsType(AxeName.Remove(AxeName.Length - 3), true, 1);

                cDescriptorType ColumnType = new cDescriptorType("PCA_" + (AxesIdx + 1), true, 1);

                while (cGlobalInfo.CurrentScreening.ListDescriptors.AddNew(ColumnType) == false)
                {
                    FormForNewDescName NewNameWindow = new FormForNewDescName();
                    NewNameWindow.textBoxName.Text = ColumnType.GetName();

                    if (NewNameWindow.ShowDialog() != System.Windows.Forms.DialogResult.OK)
                        return ColumnType.GetName();

                    ColumnType.ChangeName(NewNameWindow.textBoxName.Text);
                }
                //CompleteScreening.ListDescriptors.AddNew(ColumnType);

                foreach (cPlate TmpPlate in cGlobalInfo.CurrentScreening.ListPlatesAvailable)
                {
                    foreach (cWell Tmpwell in TmpPlate.ListActiveWells)
                    {
                        cListSignature LDesc = new cListSignature();

                        double NewValue = 0;
                        IDxDesc = 0;

                        //    AxeName += "\nPCA_" + (AxesIdx + 1);
                        for (int Idx = 0; Idx < OriginalDescNumber - 1; Idx++)
                        {
                            if (cGlobalInfo.CurrentScreening.ListDescriptors[Idx].IsActive())
                                // AxeName += String.Format("{0:0.###}", EigenVectors.getElement(IDxDesc, AxesIdx)) + "x" + CompleteScreening.ListDescriptors[Idx].GetName() + " + ";
                                NewValue += EigenVectors.getElement(IDxDesc++, AxesIdx) * Tmpwell.ListSignatures[Idx].GetValue();
                        }

                        cSignature NewDesc = new cSignature(NewValue, ColumnType, cGlobalInfo.CurrentScreening);
                        LDesc.Add(NewDesc);
                        Tmpwell.AddSignatures(LDesc);
                    }
                }
            }
            cGlobalInfo.CurrentScreening.ListDescriptors.UpDateDisplay();
            cGlobalInfo.CurrentScreening.UpDatePlateListWithFullAvailablePlate();
            for (int idxP = 0; idxP < cGlobalInfo.CurrentScreening.ListPlatesActive.Count; idxP++)
                cGlobalInfo.CurrentScreening.ListPlatesActive[idxP].UpDataMinMax();

            StartingUpDateUI();

            return AxeName;
        }
Ejemplo n.º 7
0
        private void copyPropertyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (cGlobalInfo.CurrentScreening == null) return;

            cGUI_ListWellProperty GUI_ListWellProperty = new cGUI_ListWellProperty();
            GUI_ListWellProperty.IsCheckBoxes = false;
            if (GUI_ListWellProperty.Run().IsSucceed == false) return;
            List<cPropertyType> ListSelectedProp = GUI_ListWellProperty.GetOutPut();

            cListPlates LP = new cListPlates();

            if (ProcessModeplateByPlateToolStripMenuItem.Checked)
            {
                cGUI_ListPlates GUI_ListPlates = new cGUI_ListPlates();
                GUI_ListPlates.IsCheckBoxes = true;
                cFeedBackMessage FBM = GUI_ListPlates.Run();
                cGlobalInfo.WindowHCSAnalyzer.richTextBoxConsole.AppendText(FBM.Message);
                if (!FBM.IsSucceed) return;

                LP = GUI_ListPlates.GetOutPut();
            }
            else if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
            {
                LP.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
            }
            else
            {
                LP = cGlobalInfo.CurrentScreening.ListPlatesActive;
            }

            cGlobalInfo.CurrentScreening.CopyPropertyToClipBoard(ListSelectedProp, LP);
        }
        public cFeedBackMessage Run(cScreening CompleteScreening)
        {
            if (this.Input == null)
            {
                FeedBackMessage.IsSucceed = false;
                FeedBackMessage.Message = "No input data defined.";
                return FeedBackMessage;
            }

            bool IsCurrentDescOnly = false;
            if (this.ListPlates == null)
                ListPlates = CompleteScreening.ListPlatesActive;

            cDisplayToWindow CDW1 = new cDisplayToWindow();

            cDesignerTab DT = new cDesignerTab();

            foreach (cDescriptorType CurrentDesc in CompleteScreening.ListDescriptors.GetActiveDescriptors())
            {
                cListExtendedTable CompleteListOfData = new cListExtendedTable();

                cExtendedTable FullTableAverage = new cExtendedTable();
                FullTableAverage.ListRowNames = new List<string>();

                string TableName = CurrentDesc.GetName() + " evolution\n" + Input[0].Sum() + " classes - ";

                for (int i = 0; i < Input[0].Count; i++)
                {
                    if ((Input[0][i] == 1) && (Input[0].ListTags != null) && (Input[0].ListTags[i].GetType() == typeof(cWellClassType)))
                    {
                        cWellClassType TmpWellClass = (cWellClassType)Input[0].ListTags[i];

                        CompleteListOfData.Add(new cExtendedTable());
                        CompleteListOfData[CompleteListOfData.Count - 1].Name = TmpWellClass.Name;
                        CompleteListOfData[CompleteListOfData.Count - 1].Tag = Input[0].ListTags[i];

                        FullTableAverage.Add(new cExtendedList(TmpWellClass.Name));
                        FullTableAverage[FullTableAverage.Count - 1].ListTags = new List<object>();
                        FullTableAverage[FullTableAverage.Count - 1].Name = TmpWellClass.Name;
                        FullTableAverage[FullTableAverage.Count - 1].Tag = TmpWellClass;

                        int IdxPlate = 0;
                        foreach (cPlate TmpPlate in CompleteScreening.ListPlatesActive)
                        {
                            FullTableAverage[FullTableAverage.Count - 1].Add(0);
                            FullTableAverage[FullTableAverage.Count - 1].ListTags.Add(TmpWellClass);

                            CompleteListOfData[CompleteListOfData.Count - 1].Add(new cExtendedList(TmpPlate.GetName()));
                            CompleteListOfData[CompleteListOfData.Count - 1][CompleteListOfData[CompleteListOfData.Count - 1].Count - 1].Tag = TmpPlate;
                            CompleteListOfData[CompleteListOfData.Count - 1][CompleteListOfData[CompleteListOfData.Count - 1].Count - 1].Add(IdxPlate);

                            IdxPlate++;
                        }
                    }
                }

                TableName += FullTableAverage[0].Count + " plates";
                FullTableAverage.Name = TableName;

                foreach (cPlate TmpPlate in CompleteScreening.ListPlatesActive)
                    FullTableAverage.ListRowNames.Add(TmpPlate.GetName());

              //  cDescriptorsType CurrentDesc = CompleteScreening.ListDescriptors.GetActiveDescriptor();
                int RealIdx = 0;
                for (int i = 0; i < Input[0].Count; i++)
                {
                    if (Input[0][i] == 1)
                    {
                        int IdxPlate = 0;
                        foreach (cPlate TmpPlate in ListPlates/*CompleteScreening.ListPlatesActive*/)
                        {
                            cExtendedList CurrentListValues = new cExtendedList();

                            foreach (cWell item in TmpPlate.ListActiveWells)
                                if ((item.GetCurrentClassIdx() != -1) && (item.GetCurrentClassIdx() == i))
                                {
                                    double Value = item.ListSignatures.GetSignature(CurrentDesc).GetValue();
                                    CurrentListValues.Add(Value);
                                    CompleteListOfData[RealIdx][IdxPlate].Add(Value);
                                }

                            FullTableAverage[RealIdx][IdxPlate] = CurrentListValues.Mean();
                            IdxPlate++;
                        }
                        RealIdx++;
                    }
                }

                cViewerGraph1D VG = new cViewerGraph1D();
                VG.Chart.IsLine = true;
                VG.Chart.IsShadow = true;
                VG.Chart.IsZoomableX = true;
                // VG.Chart.IsYGrid = true;
                //VG.Chart.IsDisplayValues = true;
                VG.Chart.IsLegend = true;
                //cViewerStackedHistogram CV1 = new cViewerStackedHistogram();
                //  CV1.SetInputData(NewTable);

                VG.SetInputData(FullTableAverage);
                VG.SetInputData(CompleteListOfData);

                VG.Chart.LabelAxisX = "Plate";
                VG.Chart.LabelAxisY = CurrentDesc.GetName();
                VG.Run();

                cExtendedControl TmpCtrl = VG.GetOutPut();
                TmpCtrl.Title = CurrentDesc.GetName();

                DT.SetInputData(TmpCtrl);

            }
            DT.Run();

            CDW1.Title = "Descriptor Evolution";
            CDW1.SetInputData(DT.GetOutPut());
            CDW1.Run();
            CDW1.Display();

            return FeedBackMessage;
        }
Ejemplo n.º 9
0
        private void ComputeAndDisplayLDA(cListPlates PlatesToProcess)
        {
            FormClassification WindowClassification = new FormClassification(cGlobalInfo.CurrentScreening);
            WindowClassification.buttonClassification.Text = "Process";
            WindowClassification.Text = "LDA";
            if (WindowClassification.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;

            int NeutralClass = WindowClassification.comboBoxForNeutralClass.SelectedIndex;

            int NumWell = 0;
            int NumWellForLearning = 0;
            foreach (cPlate CurrentPlate in PlatesToProcess)
            {
                NumWellForLearning += CurrentPlate.GetNumberOfActiveWellsButClass(NeutralClass);
                NumWell += CurrentPlate.GetNumberOfActiveWells();
            }
            // return;
            if (NumWellForLearning == 0)
            {
                MessageBox.Show("No well identified !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            int NumDesc = cGlobalInfo.CurrentScreening.GetNumberOfActiveDescriptor();

            if (NumDesc <= 1)
            {
                MessageBox.Show("More than one descriptor are required for this operation", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            double[,] DataForLDA = new double[NumWellForLearning, cGlobalInfo.CurrentScreening.GetNumberOfActiveDescriptor() + 1];

            //   return;
            Matrix EigenVectors = LDAComputation(DataForLDA, NumWellForLearning, NumWell, NumDesc, NeutralClass, PlatesToProcess);
            if (EigenVectors == null) return;

            SimpleForm NewWindow = new SimpleForm();
            Series CurrentSeries = new Series();
            CurrentSeries.ShadowOffset = 1;

            Matrix CurrentPt = new Matrix(NumWell, NumDesc);
            DataForLDA = new double[NumWell, NumDesc + 1];

            for (int desc = 0; desc < NumDesc; desc++)
            {
                if (cGlobalInfo.CurrentScreening.ListDescriptors[desc].IsActive() == false) continue;
                List<double> CurrentDesc = new List<double>();
                foreach (cPlate CurrentPlate in PlatesToProcess)
                {
                    for (int IdxValue = 0; IdxValue < cGlobalInfo.CurrentScreening.Columns; IdxValue++)
                        for (int IdxValue0 = 0; IdxValue0 < cGlobalInfo.CurrentScreening.Rows; IdxValue0++)
                        {
                            cWell TmpWell = CurrentPlate.GetWell(IdxValue, IdxValue0, true);
                            if (TmpWell == null) continue;
                            CurrentDesc.Add(TmpWell.ListSignatures[desc].GetValue());
                        }
                }
                for (int i = 0; i < NumWell; i++)
                    DataForLDA[i, desc] = CurrentDesc[i];
            }

            int IDx = 0;
            foreach (cPlate CurrentPlate in PlatesToProcess)
            {
                for (int IdxValue = 0; IdxValue < cGlobalInfo.CurrentScreening.Columns; IdxValue++)
                    for (int IdxValue0 = 0; IdxValue0 < cGlobalInfo.CurrentScreening.Rows; IdxValue0++)
                    {
                        cWell TmpWell = CurrentPlate.GetWell(IdxValue, IdxValue0, true);
                        if (TmpWell == null) continue;
                        DataForLDA[IDx++, NumDesc] = TmpWell.GetCurrentClassIdx();
                    }
            }

            for (int i = 0; i < NumWell; i++)
                for (int j = 0; j < NumDesc; j++) CurrentPt.addElement(i, j, DataForLDA[i, j]);

            Matrix NewPt = new Matrix(NumWell, NumDesc);

            NewPt = CurrentPt.multiply(EigenVectors);

            double MinY = double.MaxValue, MaxY = double.MinValue;

            for (int IdxValue0 = 0; IdxValue0 < NumWell; IdxValue0++)
            {
                double CurrentY = NewPt.getElement(IdxValue0, 1);

                if (CurrentY < MinY) MinY = CurrentY;
                if (CurrentY > MaxY) MaxY = CurrentY;

                CurrentSeries.Points.AddXY(NewPt.getElement(IdxValue0, 0), CurrentY);

                CurrentSeries.Points[IdxValue0].Color = cGlobalInfo.ListWellClasses[(int)DataForLDA[IdxValue0, NumDesc]].ColourForDisplay;
                CurrentSeries.Points[IdxValue0].MarkerStyle = MarkerStyle.Circle;
                CurrentSeries.Points[IdxValue0].MarkerSize = 8;
            }

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

            NewWindow.chartForSimpleForm.ChartAreas.Add(CurrentChartArea);
            NewWindow.chartForSimpleForm.TextAntiAliasingQuality = TextAntiAliasingQuality.High;
            CurrentChartArea.BackColor = Color.FromArgb(164, 164, 164);

            string AxeName = "";
            int IDxDesc = 0;
            for (int Desc = 0; Desc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; Desc++)
            {
                if (cGlobalInfo.CurrentScreening.ListDescriptors[Desc].IsActive() == false) continue;
                AxeName += String.Format("{0:0.###}", EigenVectors.getElement(IDxDesc++, 0)) + "x" + cGlobalInfo.CurrentScreening.ListDescriptors[Desc].GetName() + " + ";
                //   AxeName += String.Format("{0:0.##}", EigenVectors.getElement(CompleteScreening.ListDescriptors.Count - 1, 0)) + "x" + CompleteScreening.ListDescriptorName[CompleteScreening.ListDescriptors.Count - 1];
            }
            CurrentChartArea.Axes[0].Title = AxeName.Remove(AxeName.Length - 3);
            CurrentChartArea.Axes[0].MajorGrid.Enabled = true;

            AxeName = "";
            IDxDesc = 0;
            for (int Desc = 0; Desc < cGlobalInfo.CurrentScreening.ListDescriptors.Count; Desc++)
            {
                if (cGlobalInfo.CurrentScreening.ListDescriptors[Desc].IsActive() == false) continue;
                AxeName += String.Format("{0:0.###}", EigenVectors.getElement(IDxDesc++, 1)) + "x" + cGlobalInfo.CurrentScreening.ListDescriptors[Desc].GetName() + " + ";
            }
            //AxeName += String.Format("{0:0.##}", EigenVectors.getElement(CompleteScreening.ListDescriptors.Count - 1, 0)) + "x" + CompleteScreening.ListDescriptorName[CompleteScreening.ListDescriptors.Count - 1];

            CurrentChartArea.Axes[1].Title = AxeName.Remove(AxeName.Length - 3);
            CurrentChartArea.Axes[1].MajorGrid.Enabled = true;
            CurrentChartArea.Axes[1].Minimum = MinY;
            CurrentChartArea.Axes[1].Maximum = MaxY;
            CurrentChartArea.AxisX.LabelStyle.Format = "N2";
            CurrentChartArea.AxisY.LabelStyle.Format = "N2";

            CurrentSeries.ChartType = SeriesChartType.Point;

            NewWindow.chartForSimpleForm.Series.Add(CurrentSeries);

            NewWindow.Text = "LDA";
            NewWindow.Show();
            NewWindow.chartForSimpleForm.Update();
            NewWindow.chartForSimpleForm.Show();
            NewWindow.Controls.AddRange(new System.Windows.Forms.Control[] { NewWindow.chartForSimpleForm });
        }
Ejemplo n.º 10
0
        private void ComputeSystematicErrorsTable()
        {
            cListPlates LP = new cListPlates();

            if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
                LP.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
            else
                LP = cGlobalInfo.CurrentScreening.ListPlatesActive;

            cSystematicErrorAnalyzer SEA = new cSystematicErrorAnalyzer();
            SEA.PlatesToProcess = LP;
            SEA.DescriptorsToProcess = cGlobalInfo.CurrentScreening.GetActiveDescriptors();
            SEA.Run(true);
        }
Ejemplo n.º 11
0
        public void DisplayXYZ()
        {
            if (CompleteScreening == null) return;

            int DescX = this.comboBoxDescriptorX.SelectedIndex;
            int DescY = this.comboBoxDescriptorY.SelectedIndex;
            int DescZ = this.comboBoxDescriptorZ.SelectedIndex;

            if (DescX < 0) DescX = 0;
            if (DescY < 0) DescY = 0;
            if (DescZ < 0) DescZ = 0;

            int[] Pos = new int[2];
            Pos[0] = 0;
            Pos[1] = 0;

            if (CurrentWorld == null)
            {
                CurrentWorld = new c3DWorld(new cPoint3D(1000, 1000, 1000), new cPoint3D(ListScales[DescX], ListScales[DescY], ListScales[DescZ]), this.renderWindowControl1, Pos, CompleteScreening);
                light = vtkLight.New();
                CurrentWorld.SetBackgroundColor(Color.Black);
               // CurrentWorld.ren1.AddLight(light);
                //CurrentWorld.ren1.RemoveAllLights();
            }

            CurrentWorld.ren1.RemoveAllViewProps();

            //  if (widget != null) widget.SetEnabled(0);

            Series CurrentSeries = new Series("ScatterPoints");

            double MinX = double.MaxValue;
            double MinY = double.MaxValue;
            double MinZ = double.MaxValue;
            double MaxZ = double.MinValue;
            double MaxX = double.MinValue;
            double MaxY = double.MinValue;

            double TempX, TempY, TempZ;
            int Idx = 0;

            cListPlates ListPlate = new cListPlates();

            cMetaBiologicalObjectList ListMeta = new cMetaBiologicalObjectList("Test");
            cBiologicalSpot CurrentSpot1 = new cBiologicalSpot(Color.White, new cPoint3D(0, 0, 0), 1, 4);
            cMetaBiologicalObject Plate3D = new cMetaBiologicalObject("Data", ListMeta, CurrentSpot1);

            if (!IsFullScreen)
                ListPlate.Add(CompleteScreening.GetCurrentDisplayPlate());
            else
                ListPlate = CompleteScreening.ListPlatesActive;

            vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();
            colors.SetName("colors");
            colors.SetNumberOfComponents(3);
            vtkPoints Allpoints = vtkPoints.New();

            cExtendedList ListPtX = new cExtendedList();
            cExtendedList ListPtY = new cExtendedList();
            cExtendedList ListPtZ = new cExtendedList();

            List<bool> ListCheckBoxes = ClassSelectionPanel.GetListSelectedClass();

            for (int i = 0; i < ListPlate.Count; i++)
            {
                cPlate CurrentPlate = ListPlate[i];
                for (int IdxValue = 0; IdxValue < CompleteScreening.Columns; IdxValue++)
                    for (int IdxValue0 = 0; IdxValue0 < CompleteScreening.Rows; IdxValue0++)
                    {
                        cWell TmpWell = CurrentPlate.GetWell(IdxValue, IdxValue0, true);
                        if ((TmpWell != null) && (ListCheckBoxes[TmpWell.GetCurrentClassIdx()]))
                        {

                            TempX = TmpWell.ListSignatures[DescX].GetValue();
                            if (TempX < MinX) MinX = TempX;
                            if (TempX > MaxX) MaxX = TempX;

                            TempY = TmpWell.ListSignatures[DescY].GetValue();
                            if (TempY < MinY) MinY = TempY;
                            if (TempY > MaxY) MaxY = TempY;

                            TempZ = TmpWell.ListSignatures[DescZ].GetValue();
                            if (TempZ < MinZ) MinZ = TempZ;
                            if (TempZ > MaxZ) MaxZ = TempZ;

                            //   cBiologicalSpot CurrentSpot = new cBiologicalSpot(TmpWell.GetColor(), new cPoint3D(TempX, TempY, TempZ), 1, 4);

                            List<char> Col = new List<char>();

                            Col.Add((char)(TmpWell.GetClassColor().R));
                            Col.Add((char)(TmpWell.GetClassColor().G));
                            Col.Add((char)(TmpWell.GetClassColor().B));

                            // IntPtr unmanagedPointer = Marshal.UnsafeAddrOfPinnedArrayElement(Col.ToArray(), 0);

                            //colors.InsertNextTupleValue(unmanagedPointer);
                            colors.InsertNextTuple3(Col[0], Col[1], Col[2]);

                            ListPtX.Add(TempX);
                            ListPtY.Add(TempY);
                            ListPtZ.Add(TempZ);

                            //     CurrentSpot.Name = TmpWell.AssociatedPlate.Name + " - " + TmpWell.GetPosX() + "x" + TmpWell.GetPosY() + " :" + TmpWell.Name;
                            //    CurrentSpot.ObjectType = TmpWell.AssociatedPlate.Name + " - " + TmpWell.GetPosX() + "x" + TmpWell.GetPosY() + " :" + TmpWell.Name;
                            //    Plate3D.AddObject(CurrentSpot);
                            // CurrentWorld.AddBiological3DObject(CurrentSpot);
                            //CurrentSeries.Points.Add(TempX, TempY);

                            //                                if (IsFullScreen)
                            //                                    CurrentSeries.Points[Idx].ToolTip = TmpWell.AssociatedPlate.Name + "\n" + TmpWell.GetPosX() + "x" + TmpWell.GetPosY() + " :" + TmpWell.Name;
                            //                                else
                            //                                    CurrentSeries.Points[Idx].ToolTip = TmpWell.GetPosX() + "x" + TmpWell.GetPosY() + " :" + TmpWell.Name;

                            Idx++;
                        }
                    }
            }

            double MinValueX = ListPtX.Min();
            double MaxValueX = ListPtX.Max();
            cExtendedList NormX = ListPtX.Normalize(eNormalizationType.MIN_MAX);
            if (NormX == null) return;

            double MinValueY = ListPtY.Min();
            double MaxValueY = ListPtY.Max();
            cExtendedList NormY = ListPtY.Normalize(eNormalizationType.MIN_MAX);
            if (NormY == null) return;

            double MinValueZ = ListPtZ.Min();
            double MaxValueZ = ListPtZ.Max();
            cExtendedList NormZ = ListPtZ.Normalize(eNormalizationType.MIN_MAX);
            if (NormZ == null) return;

            for (int IdxPt = 0; IdxPt < ListPtX.Count; IdxPt++)
                Allpoints.InsertNextPoint(NormX[IdxPt], NormY[IdxPt], NormZ[IdxPt]);

            vtkPolyData polydata = vtkPolyData.New();
            polydata.SetPoints(Allpoints);
            polydata.GetPointData().SetScalars(colors);
               // vtkSphereSource SphereSource = vtkSphereSource.New();
            SphereSource.SetRadius(RadiusSphere);
            //SphereSource
            vtkGlyph3D glyph3D = vtkGlyph3D.New();
            glyph3D.SetColorModeToColorByScalar();
            glyph3D.SetSourceConnection(SphereSource.GetOutputPort());

            glyph3D.SetInput(polydata);
            glyph3D.ScalingOff();
            glyph3D.Update();

            vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
            mapper.SetInputConnection(glyph3D.GetOutputPort());
            actorSpheres = vtkActor.New();
            actorSpheres.SetMapper(mapper);
            actorSpheres.GetProperty().SetOpacity(this.SphereOpacity);
            CurrentWorld.ren1.AddActor(actorSpheres);

            if (this.IsLightAutomated)
            {
                CurrentWorld.ren1.RemoveAllLights();
                CurrentWorld.ren1.AutomaticLightCreationOn();
               // this.light.SetIntensity(0);
            }
            else
            {
                CurrentWorld.ren1.RemoveAllLights();
                CurrentWorld.ren1.AddLight(light);
                this.light.SetIntensity(this.LightIntensity);
                CurrentWorld.ren1.AutomaticLightCreationOff();
                actorSpheres.GetProperty().SetInterpolationToPhong();
                actorSpheres.GetProperty().SetAmbient(this.LightAmbient);
                actorSpheres.GetProperty().SetDiffuse(this.LightDiffuse);
                actorSpheres.GetProperty().SetSpecular(this.LightSpecular);

                light.SetFocalPoint(0.5, 0.5, 1);
                light.SetPosition(0.5, 0.5, -1);

                light.SetDiffuseColor(1, 1, 1);

                if (this.IsDisplayLightSource)
                {
                    light.SetPositional(1);
                    vtkLightActor lightActor = vtkLightActor.New();
                    lightActor.SetLight(light);
                    CurrentWorld.ren1.AddViewProp(lightActor);
                }

            }

            #region Connect For DRC
            if ((CompleteScreening.GetCurrentDisplayPlate().ListDRCRegions != null) && (cGlobalInfo.OptionsWindow.checkBoxConnectDRCPts.Checked))
            {
                foreach (cDRC_Region TmpRegion in CompleteScreening.GetCurrentDisplayPlate().ListDRCRegions)
                {
                    int cpt = 0;

                    cWell[][] ListWells = TmpRegion.GetListWells();

                    foreach (cWell[] item in ListWells)
                    {
                        for (int IdxWell = 0; IdxWell < item.Length - 1; IdxWell++)
                        {
                            //cWell TmpWell0 = CompleteScreening.GetCurrentDisplayPlate().GetWell(item[IdxWell], IdxValue0, true);

                            if ((item[IdxWell] != null) && (item[IdxWell + 1] != null) && (item[IdxWell].GetCurrentClassIdx() >= -1))
                            {
                                double StartX = (item[IdxWell].ListSignatures[DescX].GetValue() - MinValueX) / (MaxValueX - MinValueX);
                                double StartY = (item[IdxWell].ListSignatures[DescY].GetValue() - MinValueY) / (MaxValueY - MinValueY);
                                double StartZ = (item[IdxWell].ListSignatures[DescZ].GetValue() - MinValueZ) / (MaxValueZ - MinValueZ);
                                double EndX = (item[IdxWell + 1].ListSignatures[DescX].GetValue() - MinValueX) / (MaxValueX - MinValueX);
                                double EndY = (item[IdxWell + 1].ListSignatures[DescY].GetValue() - MinValueY) / (MaxValueY - MinValueY);
                                double EndZ = (item[IdxWell + 1].ListSignatures[DescZ].GetValue() - MinValueZ) / (MaxValueZ - MinValueZ);
                                cPoint3D StartPt = new cPoint3D(StartX, StartY, StartZ);
                                cPoint3D EndPt = new cPoint3D(EndX, EndY, EndZ);
                                c3DLine NewLine = new c3DLine(StartPt, EndPt);
                                CurrentWorld.AddGeometric3DObject(NewLine);
                            }

                        }
                    }
                    /*List<cDRC> ListDRC = new List<cDRC>();
                    for (int i = 0; i < CompleteScreening.ListDescriptors.Count; i++)
                    {
                        if (CompleteScreening.ListDescriptors[i].IsActive())
                        {
                            cDRC CurrentDRC = new cDRC(TmpRegion, CompleteScreening.ListDescriptors[i]);

                            ListDRC.Add(CurrentDRC);
                            cpt++;
                        }

                    }
                    */
                    //cDRCDisplay DRCDisplay = new cDRCDisplay(ListDRC, GlobalInfo);

                    //if (DRCDisplay.CurrentChart.Series.Count == 0) continue;

                    //DRCDisplay.CurrentChart.Location = new Point((DRCDisplay.CurrentChart.Width + 50) * 0, (DRCDisplay.CurrentChart.Height + 10 + DRCDisplay.CurrentRichTextBox.Height) * h++);
                    //DRCDisplay.CurrentRichTextBox.Location = new Point(DRCDisplay.CurrentChart.Location.X, DRCDisplay.CurrentChart.Location.Y + DRCDisplay.CurrentChart.Height + 5);

                    //WindowforDRCsDisplay.LChart.Add(DRCDisplay.CurrentChart);
                    //WindowforDRCsDisplay.LRichTextBox.Add(DRCDisplay.CurrentRichTextBox);
                }
            }
            #endregion

            #region Build axis
            // vtkAxesActor axis = vtkAxesActor.New();
            vtkAxisActor axisX = vtkAxisActor.New();
            axisX.SetPoint1(0, 0, 0);
            axisX.SetPoint2(1, 0, 0);
            axisX.SetTickLocationToBoth();
            axisX.SetDeltaMajor(0.1);
            axisX.SetMajorTickSize(0);
            axisX.MinorTicksVisibleOff();
            //axisX.Maj
            CurrentWorld.ren1.AddActor(axisX);

            vtkAxisActor axisY = vtkAxisActor.New();
            axisY.SetPoint1(0, 0, 0);
            axisY.SetPoint2(0, 1, 0);
            axisY.SetTickLocationToBoth();
            axisY.SetDeltaMajor(0.1);
            axisY.SetMajorTickSize(0.05);
            axisY.MinorTicksVisibleOff();
            CurrentWorld.ren1.AddActor(axisY);

            vtkAxisActor axisZ = vtkAxisActor.New();
            axisZ.SetPoint1(0, 0, 0);
            axisZ.SetPoint2(0, 0, 1);
            axisZ.SetTickLocationToBoth();
            axisZ.SetDeltaMajor(0.1);
            axisZ.SetMajorTickSize(0.05);
            axisZ.MinorTicksVisibleOff();
            CurrentWorld.ren1.AddActor(axisZ);

            if (widget == null)
            {
                widget = vtkOrientationMarkerWidget.New();

                axes = vtkAxesActor.New();
                widget.SetOutlineColor(0.9300, 0.5700, 0.1300);

                widget.SetInteractor(CurrentWorld.iren);
                widget.SetViewport(0.0, 0.0, 0.4, 0.4);
                widget.SetEnabled(0);
                // widget.InteractiveOn();

                if (this.comboBoxDescriptorX.SelectedItem == null)
                    axes.SetXAxisLabelText(this.comboBoxDescriptorX.Items[0].ToString());
                else
                    axes.SetXAxisLabelText(this.comboBoxDescriptorX.SelectedItem.ToString());

                if (this.comboBoxDescriptorY.SelectedItem == null)
                    axes.SetYAxisLabelText(this.comboBoxDescriptorY.Items[0].ToString());
                else
                    axes.SetYAxisLabelText(this.comboBoxDescriptorY.SelectedItem.ToString());

                if (this.comboBoxDescriptorZ.SelectedItem == null)
                    axes.SetZAxisLabelText(this.comboBoxDescriptorZ.Items[0].ToString());
                else
                    axes.SetZAxisLabelText(this.comboBoxDescriptorZ.SelectedItem.ToString());

                widget.SetOrientationMarker(axes);
            }
            else
            {
                if (this.comboBoxDescriptorX.SelectedItem != null)
                    axes.SetXAxisLabelText(this.comboBoxDescriptorX.SelectedItem.ToString());

                if (this.comboBoxDescriptorY.SelectedItem != null)
                    axes.SetYAxisLabelText(this.comboBoxDescriptorY.SelectedItem.ToString());

                if (this.comboBoxDescriptorZ.SelectedItem != null)
                    axes.SetZAxisLabelText(this.comboBoxDescriptorZ.SelectedItem.ToString());

                widget.SetOrientationMarker(axes);
            }

            if ((this.checkBoxForDisplayAxesInformation.Checked) && (ListPtX.Count > 0))
            {
                double CurrentFontSize = this.FontSize / 400.0;// 0.02;

                c3DText MaxAxeX = new c3DText(CurrentWorld, MaxValueX.ToString("N2"), new cPoint3D(1, 0, 0), Color.White, CurrentFontSize);
                CurrentWorld.AddGeometric3DObject(MaxAxeX);

                c3DText MaxAxeY = new c3DText(CurrentWorld, MaxValueY.ToString("N2"), new cPoint3D(0, 1, 0), Color.White, CurrentFontSize);
                CurrentWorld.AddGeometric3DObject(MaxAxeY);

                c3DText MaxAxeZ = new c3DText(CurrentWorld, MaxValueZ.ToString("N2"), new cPoint3D(0, 0, 1), Color.White, CurrentFontSize);
                CurrentWorld.AddGeometric3DObject(MaxAxeZ);

                c3DText MinAxeX = new c3DText(CurrentWorld, MinValueX.ToString("N2"), new cPoint3D(0, -0.1, -0.1), Color.White, CurrentFontSize);
                CurrentWorld.AddGeometric3DObject(MinAxeX);

                c3DText MinAxeY = new c3DText(CurrentWorld, MinValueY.ToString("N2"), new cPoint3D(-0.1, -0.1, 0), Color.White, CurrentFontSize);
                CurrentWorld.AddGeometric3DObject(MinAxeY);

                c3DText MinAxeZ = new c3DText(CurrentWorld, MinValueZ.ToString("N2"), new cPoint3D(-0.1, 0, -0.1), Color.White, CurrentFontSize);
                CurrentWorld.AddGeometric3DObject(MinAxeZ);
            }
            #endregion

            //vtkCameraWidget Wid = vtkCameraWidget.New();
            //Wid.SetInteractor(CurrentWorld.iren);
            //Wid.SetEnabled(1);
            //  Wid.InteractiveOn();

            //vtkDistanceWidget distanceWidget = vtkDistanceWidget.New();
            //distanceWidget.SetInteractor(CurrentWorld.iren);
            //distanceWidget.SetEnabled(1);
            //distanceWidget.CreateDefaultRepresentation();
            //((vtkDistanceRepresentation)distanceWidget.GetRepresentation()).SetLabelFormat("%-#6.3g mm");
            /*static_cast<vtkDistanceRepresentation*>(distanceWidget->GetRepresentation())
              ->SetLabelFormat("%-#6.3g mm");

                      */
            //  Plate3D.GenerateAndDisplayBoundingBox(1, Color.White, false, CurrentWorld);
            //c3DText CaptionX = new c3DText(CurrentWorld, CompleteScreening.ListDescriptors[DescX].GetName(), new cPoint3D(MaxX, MinY, MinZ), Color.DarkRed, this.FontSize);
            //c3DLine LineX = new c3DLine(new cPoint3D(MinX, MinY, MinZ), new cPoint3D(MaxX, MinY, MinZ), Color.DarkRed);
            //CurrentWorld.AddGeometric3DObject(LineX);

            //c3DText CaptionY = new c3DText(CurrentWorld, CompleteScreening.ListDescriptors[DescY].GetName(), new cPoint3D(MinX, MaxY, MinZ), Color.DarkGreen, this.FontSize);
            //c3DLine LineY = new c3DLine(new cPoint3D(MinX, MinY, MinZ), new cPoint3D(MinX, MaxY, MinZ), Color.DarkGreen);
            //CurrentWorld.AddGeometric3DObject(LineY);

            //c3DText CaptionZ = new c3DText(CurrentWorld, CompleteScreening.ListDescriptors[DescZ].GetName(), new cPoint3D(MinX, MinY, MaxZ), Color.DarkBlue, this.FontSize);
            //c3DLine LineZ = new c3DLine(new cPoint3D(MinX, MinY, MinZ), new cPoint3D(MinX, MinY, MaxZ), Color.DarkBlue);
            //CurrentWorld.AddGeometric3DObject(LineZ);

            #region Update ComboBoxes
            if (comboBoxDescriptorX.Text == "")
                ToolTipForX.SetToolTip(comboBoxDescriptorX, comboBoxDescriptorX.Items[0].ToString());
            else
                ToolTipForX.SetToolTip(comboBoxDescriptorX, comboBoxDescriptorX.Text);

            if (comboBoxDescriptorY.Text == "")
                ToolTipForY.SetToolTip(comboBoxDescriptorY, comboBoxDescriptorY.Items[0].ToString());
            else
                ToolTipForY.SetToolTip(comboBoxDescriptorY, comboBoxDescriptorY.Text);

            if (comboBoxDescriptorZ.Text == "")
                ToolTipForZ.SetToolTip(comboBoxDescriptorZ, comboBoxDescriptorZ.Items[0].ToString());
            else
                ToolTipForZ.SetToolTip(comboBoxDescriptorZ, comboBoxDescriptorZ.Text);
            #endregion

            CurrentWorld.SimpleRender();// Render();
        }
Ejemplo n.º 12
0
        private void ToolStripMenuItem_DisplaySingleCellHistogram(object sender, EventArgs e)
        {
            cListWells ListWells = new cListWells();
            List<cDescriptorType> LCDT = new List<cDescriptorType>();
            LCDT.Add(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor());

            List<cWellClassType> ListForCurrentClass = new List<cWellClassType>();
            ListForCurrentClass.Add(this);

            cGUI_ListClasses GUIClasses = new cGUI_ListClasses();
            GUIClasses.IsCheckBoxes = true;
            GUIClasses.IsSelectAll = true;
            GUIClasses.ClassType = eClassType.PHENOTYPE;
            if (!GUIClasses.Run().IsSucceed) return;

            cDesignerTab DT = new cDesignerTab();

            if (cGlobalInfo.WindowHCSAnalyzer.ProcessModeEntireScreeningToolStripMenuItem.Checked)
            {
                foreach (cPlate CurrentPlate in cGlobalInfo.CurrentScreening.ListPlatesActive)
                {
                    ListWells.AddRange(CurrentPlate.ListWells.Filter(ListForCurrentClass));
                }
                    cExtendedTable FinalTable = new cExtendedTable();
                    FinalTable.Name = "Stacked Histogram: " + ListWells.Count + " wells";

                    int Idx = 0;
                    foreach (var item in cGlobalInfo.ListCellularPhenotypes)
                    {
                        FinalTable.Add(new cExtendedList());
                        FinalTable[Idx].Name = item.Name;
                        FinalTable[Idx].Tag = item;

                        Idx++;
                    }

                    foreach (cWell TmpWell in ListWells)
                    {
                        TmpWell.AssociatedPlate.DBConnection = new cDBConnection(TmpWell.AssociatedPlate, TmpWell.SQLTableName);

                        int IDx = 0;
                        foreach (var item in cGlobalInfo.ListCellularPhenotypes)
                        {
                            if (GUIClasses.GetOutPut()[0][IDx] == 0) { IDx++; continue; }
                            List<cCellularPhenotype> ListCellularPhenotypesToBeSelected = new List<cCellularPhenotype>();
                            ListCellularPhenotypesToBeSelected.Add(item);

                            cExtendedTable TmpET = TmpWell.AssociatedPlate.DBConnection.GetWellValues(TmpWell,
                                                     LCDT, ListCellularPhenotypesToBeSelected);

                            if (TmpET.Count > 0) FinalTable[IDx].AddRange(TmpET[0]);
                            IDx++;
                        }
                        TmpWell.AssociatedPlate.DBConnection.CloseConnection();
                    }

                    cViewerStackedHistogram VSH = new cViewerStackedHistogram();
                    VSH.SetInputData(FinalTable);
                    VSH.Chart.BinNumber = LCDT[0].GetBinNumber();
                    VSH.Chart.IsShadow = false;
                    VSH.Chart.IsBorder = false;
                    VSH.Chart.IsXGrid = true;
                    VSH.Chart.IsYGrid = true;
                    VSH.Chart.LabelAxisX = LCDT[0].GetName();

                    VSH.Run();
                    VSH.Chart.Width = 0;
                    VSH.Chart.Height = 0;
                    VSH.GetOutPut().Title = cGlobalInfo.CurrentScreening.GetName();
                    DT.SetInputData(VSH.GetOutPut());
            }
            else
            {
                cListPlates ListPlates = new cListPlates();
                if (cGlobalInfo.WindowHCSAnalyzer.ProcessModeplateByPlateToolStripMenuItem.Checked)
                    ListPlates = cGlobalInfo.CurrentScreening.ListPlatesActive;
                else
                    ListPlates.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());

                foreach (cPlate CurrentPlate in ListPlates)
                {
                    ListWells = CurrentPlate.ListWells.Filter(ListForCurrentClass);

                    cExtendedTable FinalTable = new cExtendedTable();
                    FinalTable.Name = "Stacked Histogram: " + ListWells.Count + " wells - " + CurrentPlate.GetName();

                    int Idx = 0;
                    foreach (var item in cGlobalInfo.ListCellularPhenotypes)
                    {
                        FinalTable.Add(new cExtendedList());
                        FinalTable[Idx].Name = item.Name;
                        FinalTable[Idx].Tag = item;

                        if (GUIClasses.GetOutPut()[0][Idx] == 0)
                        {
                            Idx++;
                            continue;
                        }

                        Idx++;
                    }

                    foreach (cWell TmpWell in ListWells)
                    {
                        TmpWell.AssociatedPlate.DBConnection = new cDBConnection(TmpWell.AssociatedPlate, TmpWell.SQLTableName);

                        int IDx = 0;
                        foreach (var item in cGlobalInfo.ListCellularPhenotypes)
                        {
                            if (GUIClasses.GetOutPut()[0][IDx] == 0) { IDx++; continue; }
                            List<cCellularPhenotype> ListCellularPhenotypesToBeSelected = new List<cCellularPhenotype>();
                            ListCellularPhenotypesToBeSelected.Add(item);

                            cExtendedTable TmpET = TmpWell.AssociatedPlate.DBConnection.GetWellValues(TmpWell,
                                                     LCDT, ListCellularPhenotypesToBeSelected);

                            if (TmpET.Count > 0) FinalTable[IDx].AddRange(TmpET[0]);
                            IDx++;
                        }
                        TmpWell.AssociatedPlate.DBConnection.CloseConnection();
                    }

                    cViewerStackedHistogram VSH = new cViewerStackedHistogram();
                    VSH.SetInputData(FinalTable);
                    VSH.Chart.BinNumber = LCDT[0].GetBinNumber();
                    VSH.Chart.IsShadow = false;
                    VSH.Chart.IsBorder = false;
                    VSH.Chart.IsXGrid = true;
                    VSH.Chart.IsYGrid = true;
                    VSH.Chart.LabelAxisX = LCDT[0].GetName();

                    VSH.Run();
                    VSH.Chart.Width = 0;
                    VSH.Chart.Height = 0;
                    VSH.GetOutPut().Title = CurrentPlate.GetName();
                    DT.SetInputData(VSH.GetOutPut());
                }
            }
            DT.Run();

            cDisplayToWindow DTW = new cDisplayToWindow();
            DTW.SetInputData(DT.GetOutPut());
            DTW.Title = "Single Cell Histograms";
            DTW.Run();
            DTW.Display();
        }
Ejemplo n.º 13
0
        public bool DisplayXY()
        {
            if (CompleteScreening == null) return false;

            int DescX = this.comboBoxDescriptorX.SelectedIndex;
            int DescY = this.comboBoxDescriptorY.SelectedIndex;

            if (DescX < 0) DescX = 0;
            if (DescY < 0) DescY = 0;

            CurrentSeries = new Series("ScatterPoints");
            CurrentSeries.ShadowOffset = 1;

            double MinX = double.MaxValue;
            double MinY = double.MaxValue;
            double MaxX = double.MinValue;
            double MaxY = double.MinValue;

            double TempX, TempY;
            int Idx = 0;

            cListPlates ListPlate = new cListPlates();
            if (!IsFullScreen)
                ListPlate.Add(CompleteScreening.GetCurrentDisplayPlate());
            else
                ListPlate = CompleteScreening.ListPlatesActive;

            for (int i = 0; i < ListPlate.Count; i++)
            {
                cPlate CurrentPlate = ListPlate[i];
                for (int IdxValue = 0; IdxValue < CompleteScreening.Columns; IdxValue++)
                    for (int IdxValue0 = 0; IdxValue0 < CompleteScreening.Rows; IdxValue0++)
                    {
                        cWell TmpWell = CurrentPlate.GetWell(IdxValue, IdxValue0, true);
                        if (TmpWell != null)
                        {

                            TempX = TmpWell.ListSignatures[DescX].GetValue();
                            if (TempX < MinX) MinX = TempX;
                            if (TempX > MaxX) MaxX = TempX;

                            TempY = TmpWell.ListSignatures[DescY].GetValue();
                            if (TempY < MinY) MinY = TempY;
                            if (TempY > MaxY) MaxY = TempY;

                            CurrentSeries.Points.AddXY(TempX, TempY);
                            CurrentSeries.Points[Idx].Color = TmpWell.GetClassColor();

                            if (IsFullScreen)
                                CurrentSeries.Points[Idx].ToolTip = TmpWell.AssociatedPlate.GetName() + "\n" + TmpWell.GetPosX() + "x" + TmpWell.GetPosY();
                            else
                                CurrentSeries.Points[Idx].ToolTip = TmpWell.GetPosX() + "x" + TmpWell.GetPosY();
                            CurrentSeries.Points[Idx].Tag = TmpWell;
                            CurrentSeries.Points[Idx].MarkerStyle = MarkerStyle.Circle;
                            CurrentSeries.Points[Idx].MarkerSize = 8;
                            Idx++;
                        }
                    }
            }

            if (CurrentSeries.Points.Count < 2)
            {
                MessageBox.Show("Statistical Analyses - More than one data point needed.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return false;
            }

            CurrentChartArea.CursorX.IsUserSelectionEnabled = true;
            CurrentChartArea.CursorY.IsUserSelectionEnabled = true;
            CurrentChartArea.BorderColor = Color.Black;
            this.chartForSimpleFormXY.ChartAreas.Clear();
            this.chartForSimpleFormXY.ChartAreas.Add(CurrentChartArea);

            this.chartForSimpleFormXY.TextAntiAliasingQuality = TextAntiAliasingQuality.High;
            CurrentChartArea.BackColor = Color.FromArgb(164, 164, 164);

            CurrentChartArea.Axes[0].Title = CompleteScreening.ListDescriptors[DescX].GetName();
            CurrentChartArea.Axes[0].Minimum = MinX;
            CurrentChartArea.Axes[0].Maximum = MaxX;

            CurrentChartArea.Axes[1].Title = CompleteScreening.ListDescriptors[DescY].GetName();
            CurrentChartArea.Axes[1].Minimum = MinY;
            CurrentChartArea.Axes[1].Maximum = MaxY;

            CurrentChartArea.AxisX.LabelStyle.Format = "N2";
            CurrentChartArea.AxisY.LabelStyle.Format = "N2";
            CurrentSeries.ChartType = SeriesChartType.FastPoint;

            this.chartForSimpleFormXY.Series.Clear();
            this.chartForSimpleFormXY.Series.Add(CurrentSeries);

            this.Text = "Scatter Point / " + Idx + " points";

            //  this.chartForSimpleFormXY.GetToolTipText += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.ToolTipEventArgs>(this.chartForSimpleFormXY_GetToolTipText);

            this.chartForSimpleFormXY.Update();
            return true;
        }
Ejemplo n.º 14
0
        void LoadProperty()
        {
            cGUI_ListWellProperty GUI_ListWellProperty = new cGUI_ListWellProperty();
            GUI_ListWellProperty.IsCheckBoxes = false;

            if (GUI_ListWellProperty.Run().IsSucceed == false) return;
            List<cPropertyType> ListSelectedProp = GUI_ListWellProperty.GetOutPut();

            cCSVToTable CSVT = new cCSVToTable();
            CSVT.IsDisplayUIForFilePath = true;
            CSVT.IsContainRowNames = true;
            CSVT.IsContainColumnHeaders = true;
            CSVT.AddAsObject = true;
            CSVT.Run();

            cExtendedTable PlateDesign = CSVT.GetOutPut();
            if (PlateDesign == null) return;


            cListPlates LP = new cListPlates();

            if (ProcessModeCurrentPlateOnlyToolStripMenuItem.Checked)
            {
                LP.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
            }
            else if (ProcessModeEntireScreeningToolStripMenuItem.Checked)
            {
                LP = cGlobalInfo.CurrentScreening.ListPlatesActive;
            }
            else
            {
                cGUI_ListPlates GUIListPlate = new cGUI_ListPlates();
                if (GUIListPlate.Run().IsSucceed == false) return;
                LP = GUIListPlate.GetOutPut();
            }


            for (int Col = 0; Col < cGlobalInfo.CurrentScreening.Columns; Col++)
                for (int Row = 0; Row < cGlobalInfo.CurrentScreening.Rows; Row++)
                {
                    if ((Col < PlateDesign.Count) && (Row < PlateDesign[Col].ListTags.Count))
                    {
                        object TmpObj = PlateDesign[Col].ListTags[Row];

                        //string TmpVal = "";

                        //if (TmpObj != null)
                        //    TmpVal = (string)TmpObj;

                        foreach (cPlate CurrentPlate in LP)
                        {
                            cWell TmpWell = CurrentPlate.GetWell(Col, Row, false);
                            if ((TmpWell != null))
                            {
                                if (TmpObj == null)
                                {
                                    TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, null);
                                }
                                else
                                {
                                    if (/*(TmpObj.GetType() == typeof(string)) &&*/ (ListSelectedProp[0].Type == eDataType.STRING))
                                        TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, (string)TmpObj);
                                    else if (/*(TmpObj.GetType() == typeof(double)) &&*/ (ListSelectedProp[0].Type == eDataType.DOUBLE))
                                    {
                                        double Res;
                                        if (double.TryParse((string)TmpObj, out Res))
                                            TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, Res);
                                        else
                                            TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, null);
                                    }
                                    else if (/*(TmpObj.GetType() == typeof(int)) &&*/ (ListSelectedProp[0].Type == eDataType.INTEGER))
                                    {
                                        int IntRes;
                                        if (int.TryParse((string)TmpObj, out IntRes))
                                            TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, IntRes);
                                        else
                                            TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, null);

                                    }
                                }

                                // TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, (int)Convert.ToDouble(TmpObj.ToString()));

                                //else if (TmpObj.GetType() == typeof(int) && (ListSelectedProp[0].Type == eDataType.INTEGER))
                                //  TmpWell.ListProperties.UpdateValueByName(ListSelectedProp[0].Name, (int)TmpObj);
                            }

                        }
                    }
                }

            richTextBoxConsole.AppendText(LP.Count + " plates updated !\n");

            cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().DisplayDistribution(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptor(), false);

        }
Ejemplo n.º 15
0
        private void GeneratePCADescriptorItem(object sender, EventArgs e)
        {
            FormForProjections WindowClassification = new FormForProjections();
            //WindowClassification.buttonClassification.Text = "Process";
            WindowClassification.label1.Text = "Class of Interest";
            WindowClassification.Text = "PCA";
            WindowClassification.IsPCA = true;
            WindowClassification.numericUpDownNumberOfAxis.Maximum = cGlobalInfo.CurrentScreening.GetNumberOfActiveDescriptor();

            PanelForClassSelection ClassSelectionPanel = new PanelForClassSelection(true, eClassType.WELL);
            ClassSelectionPanel.Height = WindowClassification.panelForClasses.Height;
            ClassSelectionPanel.UnSelectAll();
            ClassSelectionPanel.Select(2);
            WindowClassification.panelForClasses.Controls.Add(ClassSelectionPanel);

            cListPlates PlatesToProcess = new cListPlates(null);
            if (WindowClassification.radioButtonFromCurrentPlate.Checked)
                PlatesToProcess.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
            else
                PlatesToProcess = cGlobalInfo.CurrentScreening.ListPlatesActive;

            WindowClassification.PlatesToProcess = PlatesToProcess;
            if (WindowClassification.ShowDialog() != System.Windows.Forms.DialogResult.OK) return;
        }
Ejemplo n.º 16
0
 private void displayGraphToolStripMenuItem_Click_1(object sender, EventArgs e)
 {
     cListPlates ListToProcess = new cListPlates();
     ListToProcess.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
     ComputeAndDisplayLDA(ListToProcess);
 }
Ejemplo n.º 17
0
        public void UpDateWellsSelection()
        {
            int SelectionType = ParentScreening.GetSelectionType();
            if (SelectionType == -2) return;

            int PosMouseXMax = ParentScreening.ClientPosLast.X;
            int PosMouseXMin = ParentScreening.ClientPosFirst.X;

            if (ParentScreening.ClientPosFirst.X > PosMouseXMax)
            {
                PosMouseXMax = ParentScreening.ClientPosFirst.X;
                PosMouseXMin = ParentScreening.ClientPosLast.X;
            }

            int PosMouseYMax = ParentScreening.ClientPosLast.Y;
            int PosMouseYMin = ParentScreening.ClientPosFirst.Y;
            if (ParentScreening.ClientPosFirst.Y > PosMouseYMax)
            {
                PosMouseYMax = ParentScreening.ClientPosFirst.Y;
                PosMouseYMin = ParentScreening.ClientPosLast.Y;
            }

            int GutterSize = (int)cGlobalInfo.OptionsWindow.FFAllOptions.numericUpDownGutter.Value;
            int ScrollShiftX = cGlobalInfo.WindowHCSAnalyzer.panelForPlate.HorizontalScroll.Value;
            int ScrollShiftY = cGlobalInfo.WindowHCSAnalyzer.panelForPlate.VerticalScroll.Value;

            cListPlates ListPlateToProcess = new cListPlates();

            if (ParentScreening.IsSelectionApplyToAllPlates == true)
            {
                ListPlateToProcess = ParentScreening.ListPlatesActive;
            }
            else
            {
                ListPlateToProcess.Add(ParentScreening.GetCurrentDisplayPlate());
            }
            int NumberOfPlates = ParentScreening.ListPlatesActive.Count;

            //Point ResMin = cGlobalInfo.WindowHCSAnalyzer.panelForPlate.GetChildAtPoint(new Point(PosMouseXMin, PosMouseYMin));

            int PosWellMinX = (int)((PosMouseXMin - ScrollShiftX) / (cGlobalInfo.SizeHistoWidth + GutterSize));
            int PosWellMinY = (int)((PosMouseYMin - ScrollShiftY) / (cGlobalInfo.SizeHistoHeight + GutterSize));

            int PosWellMaxX = (int)((PosMouseXMax - ScrollShiftX) / (cGlobalInfo.SizeHistoWidth + GutterSize));
            int PosWellMaxY = (int)((PosMouseYMax - ScrollShiftY) / (cGlobalInfo.SizeHistoHeight + GutterSize));

            if (PosWellMaxX > ParentScreening.Columns) PosWellMaxX = ParentScreening.Columns;
            if (PosWellMaxY > ParentScreening.Rows) PosWellMaxY = ParentScreening.Rows;
            if (PosWellMinX < 0) PosWellMinX = 0;
            if (PosWellMinY < 0) PosWellMinY = 0;

            foreach (cPlate CurrentPlate in ListPlateToProcess)
            {

                for (int j = PosWellMinY; j < PosWellMaxY; j++)
                    for (int i = PosWellMinX; i < PosWellMaxX; i++)
                    {
                        cWell TempWell = CurrentPlate.GetWell(i, j, false);

                        if (TempWell == null) continue;
                        if (SelectionType == -1)
                            TempWell.SetAsNoneSelected();
                        else
                            TempWell.SetClass(SelectionType);
                    }
            }
            ParentScreening.GetCurrentDisplayPlate().UpdateNumberOfClass();
            ParentScreening.UpdateListActiveWell();
        }