Esempio n. 1
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);

        }
Esempio n. 2
0
 private void displayGraphToolStripMenuItem_Click_1(object sender, EventArgs e)
 {
     cListPlates ListToProcess = new cListPlates();
     ListToProcess.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate());
     ComputeAndDisplayLDA(ListToProcess);
 }
Esempio n. 3
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;
        }
Esempio n. 4
0
        public cListPlates GetListSelectedPlates()
        {
            cListPlates LP = new cListPlates();

            foreach (var item in this.ListCheckBoxes)
            {
                if (item.Checked)
                    LP.Add((cPlate)item.Tag);
            }
            return LP;
        }
Esempio n. 5
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);
        }
Esempio n. 6
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;
        }
Esempio n. 7
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);
        }
Esempio n. 8
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();
        }
Esempio n. 9
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();
        }
Esempio n. 10
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;
        }
Esempio n. 11
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();
        }