Exemplo n.º 1
0
        private void AnalyseSequence(cImage SeqToAnalyse)
        {
            //    //FormForThumbnails WindThumbnail = new FormForThumbnails();

            //    //for (int k = 0; k < ListFormForControl.Count; k++)
            //    //{
            //    //        FormForControl Obj = ListFormForControl.ElementAt(ListFormForControl.Count - k-1);
            //    //        Obj.DisplayThumbnail(WindThumbnail);
            //    //}
            //    //WindThumbnail.Show();

            //    //return;

            #region initialization

            if (SeqToAnalyse == null) return;

            // create World
            if (Current3DWorld == null)
            {
                Current3DWorld = new c3DNewWorld(new cPoint3D(SeqToAnalyse.Width, SeqToAnalyse.Height, SeqToAnalyse.Depth),
                                                 new cPoint3D(SeqToAnalyse.Resolution));
            }
              else
            {
            //     //   Current3DWorld.ren1.
              //  Current3DWorld.Terminate();
                Current3DWorld = null;
                 Current3DWorld = new c3DNewWorld(new cPoint3D(SeqToAnalyse.Width, SeqToAnalyse.Height, SeqToAnalyse.Depth),
                                                         new cPoint3D(SeqToAnalyse.Resolution));

            }

            for (int k = 0; k < ListFormForControl.Count; k++)
            {
                FormForControl Obj = ListFormForControl.ElementAt(ListFormForControl.Count - k-1);
                if (Obj.numericUpDownChannel.Value >= SeqToAnalyse.GetNumChannels())
                {
                    MessageBox.Show("Wrong number of channels", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }

            //   // Current3DWorld.ListObjControl = ListFormForControl;
            //    //   dataGridViewForClassif.DataSource = CurrentTable;
            //    if (DataGrid == null)
            //    {
            //        DataGrid = new FormForDataGridView();
            //        DataGrid.Show();
            //    }
            //    Current3DWorld.SetLinkToDataGridView(DataGrid.dataGridViewForResults);

            Current3DWorld.ListMetaObjectList = new List<cMetaBiologicalObjectList>();
            cMetaBiologicalObjectList ListMetacells = new cMetaBiologicalObjectList("List Meta Objects");
            Current3DWorld.ListMetaObjectList.Add(ListMetacells);
            #endregion

            #region Detection
            for (int k = 0; k < ListFormForControl.Count; k++)
            {
                FormForControl Obj = ListFormForControl.ElementAt(ListFormForControl.Count - k -1);

                if (Obj.radioButtonIsVolume.Checked)    // we have to detect a volume !
                {
                    cVolumeDetection Detection = new cVolumeDetection(SeqToAnalyse, (int)Obj.numericUpDownChannel.Value, Obj.WindowForVolumeDetection.checkBoxIsBorderKill.Checked);
                    Detection.SetShift(new cPoint3D((float)Obj.WindowForPreProcessing.numericUpDownShiftX.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftY.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftZ.Value));

                    if ((Obj.checkBoxPreProcessings.Checked == false) || (Obj.WindowForPreProcessing.checkBoxMedianIsDisabled.Checked))
                    {
                        Detection.SetMedian(-1);
                        Detection.SetShift(new cPoint3D(0, 0, 0));
                    }
                    else
                    {
                        Detection.SetMedian((int)Obj.WindowForPreProcessing.numericUpDownMedianKernel.Value);
                        Detection.SetShift(new cPoint3D((float)Obj.WindowForPreProcessing.numericUpDownShiftX.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftY.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftZ.Value));
                    }

                    if (Obj.WindowForVolumeDetection.checkBoxVolumeSmooth.Checked)
                        Detection.MeshSmoother = new cMeshSmoother((int)Obj.WindowForVolumeDetection.numericUpDownSmoothIterations.Value);

                    if ((Obj.comboBoxContainer.SelectedItem !=null) && (Obj.comboBoxContainer.SelectedItem.ToString() != ""))
                    {
                        Detection.SetContainers(Current3DWorld.GetListBiologicalObjectsOfType(Obj.comboBoxContainer.Items[0].ToString()));
                        if (Obj.InOrOut.radioButtonIn.Checked) Detection.SetContainersMode(0);
                        else Detection.SetContainersMode(1);
                    }
                    else
                        Detection.SetContainers(null);

                    if (Obj.WindowForVolumeDetection.checkBoxIsRegionGrowing.Checked == false)  // no region growing direct detection
                    {
                        Obj.AssociatedBiologicalObjectList = Detection.IntensityThreshold((float)Obj.WindowForVolumeDetection.numericUpDownIntensityThreshold.Value,
                                                                                          (float)Obj.WindowForVolumeDetection.numericUpDownVolumeMinVol.Value,
                                                                                          (float)Obj.WindowForVolumeDetection.numericUpDownVolumeMaxVol.Value);
                    }
                   else // region growing
                   {
                        if (Obj.WindowForVolumeDetection.radioButtonRegionsBased.Checked) // start from a segmentation
                        {
                            if (Obj.WindowForVolumeDetection.radioButtonVolumeDetectionNew.Checked) // a new segmentation has to be performed
                            {
            //                        // Image3D CurrentPatch = new Image3D(2 * Radius, 2 * Radius, 1, CurrentImageToProcess.NumBands);
                                cImage CurrentBinary = new cImage(SeqToAnalyse.Width, SeqToAnalyse.Height, SeqToAnalyse.Depth, 1);

                                for (int i = 0; i < CurrentBinary.ImageSize; i++)
                                {
                                    if (SeqToAnalyse.SingleChannelImage[(int)Obj.numericUpDownChannel.Value].Data[i] >= (float)Obj.WindowForVolumeDetection.numericUpDownIntensityThreshold.Value)
                                        CurrentBinary.SingleChannelImage[0].Data[i] = 1;
                                }

                                eConnectivity CurrentConnectivity = eConnectivity.TWOD_4;
                                if (CurrentBinary.Depth > 1)
                                    CurrentConnectivity = eConnectivity.THREED_6;

                                ConnectedComponentSet OFNucleus = new ConnectedComponentSet(CurrentBinary, null, null, 0, CurrentConnectivity, (int)Obj.WindowForVolumeDetection.numericUpDownRegionBasedMinArea.Value, (int)Obj.WindowForVolumeDetection.numericUpDownRegionBasedMaxArea.Value);
            //                      //  RegionGrowing = new cRegionGrowing(OFNucleus, NewSeq[0], (int)numericUpDownChannelForRegionGrowing.Value, (float)numericUpDownIntensityForRegionGrowing.Value, (int)numericUpDownMaxNucleusArea.Value);
                                int NumIterations = -1;
                                if (Obj.WindowForVolumeDetection.checkBoxIsConvergence.Checked == false) NumIterations = (int)Obj.WindowForVolumeDetection.numericUpDownIterationNumber.Value;

                                float MergingRatio = (float)((Obj.WindowForVolumeDetection.trackBarMergingStrength.Maximum - Obj.WindowForVolumeDetection.trackBarMergingStrength.Value) / 100.0);
                                Obj.AssociatedBiologicalObjectList = Detection.RegionGrowing(OFNucleus,
                                                                                            (float)Obj.WindowForVolumeDetection.numericUpDownIntensityForRegionGrowing.Value,
                                                                                            (float)Obj.WindowForVolumeDetection.numericUpDownVolumeMinVol.Value,
                                                                                            (float)Obj.WindowForVolumeDetection.numericUpDownVolumeMaxVol.Value, NumIterations, MergingRatio);

                            }
            //                    else
            //                    {
            //                        throw new System.ArgumentException("Not implemented", "Error");
            //                    }
            //                }
            //                else // start from seeds points
            //                {

            //                        // first gather the seeds
            //                        if (Obj.WindowForVolumeDetection.comboBoxExistingSpotsDetected.Items.Count == 0) break;
            //                       List<cBiological3DObject> ListSeeds = Current3DWorld.GetListBiologicalObjectsOfType(Obj.WindowForVolumeDetection.comboBoxExistingSpotsDetected.Items[0].ToString());

            //                       int NumIterations = -1;
            //                       if (Obj.WindowForVolumeDetection.checkBoxIsConvergence.Checked == false) NumIterations = (int)Obj.WindowForVolumeDetection.numericUpDownIterationNumber.Value;

            //                       float MergingRatio = (float)((Obj.WindowForVolumeDetection.trackBarMergingStrength.Maximum - Obj.WindowForVolumeDetection.trackBarMergingStrength.Value) / 100.0);
            //                       Obj.AssociatedBiologicalObjectList = Detection.RegionGrowing(ListSeeds,
            //                                                                                   (float)Obj.WindowForVolumeDetection.numericUpDownIntensityForRegionGrowing.Value,
            //                                                                                   (float)Obj.WindowForVolumeDetection.numericUpDownVolumeMinVol.Value,
            //                                                                                   (float)Obj.WindowForVolumeDetection.numericUpDownVolumeMaxVol.Value, NumIterations, MergingRatio);
                        }
                    }
                    if (Obj.AssociatedBiologicalObjectList != null)
                    {
                        Obj.richTextBoxInfo.AppendText(Obj.AssociatedBiologicalObjectList.Count + " objects detected.");

                        for (int i = 0; i < Obj.AssociatedBiologicalObjectList.Count; i++)
                        {
                            cBiological3DVolume TmpVol = (cBiological3DVolume)Obj.AssociatedBiologicalObjectList[i];
                            Obj.AssociatedBiologicalObjectList[i].SetType(Obj.textBoxName.Text);
            //                    TmpVol.ThumbnailnewImage = imageListForThumbnail.Images[Obj.AssociatedBiologicalObjectList[i].GetType() + ".jpg"];
                            Obj.AssociatedBiologicalObjectList[i].Name = Obj.textBoxName.Text + " " + i;
              //                  Obj.AssociatedBiologicalObjectList[i].IsMaster = Obj.IsMasterObject();
            //                    List<double> Res = TmpVol.Information.GetInformation();

                            if (Obj.checkBoxIsDisplayName.Checked)
                            {
                                cGeometric3DObject AssociatedText = TmpVol.AttachText(TmpVol.Name, 10, Color.White);
                                AssociatedText.IsStayInFrontOfCamera = true;
                                Current3DWorld.AddGeometric3DObject(AssociatedText);

                                //                        TmpVol.AddText(TmpVol.Name, Current3DWorld, (double)Obj.ForText.numericUpDownArrowScale.Value, Obj.ForText.buttonChangeColorPositive.BackColor);
                            }

                            if (Obj.checkIsBoxPointingArrow.Checked)
                            {
                                cGeometric3DObject AssociatedArrow = TmpVol.AttachPointingArrow((double)Obj.ForArrow.numericUpDownArrowScale.Value,
                                                            Obj.ForArrow.buttonChangeColorPositive.BackColor);

                                Current3DWorld.AddGeometric3DObject(AssociatedArrow);

                            }

                            Obj.AssociatedBiologicalObjectList[i].SetOpacity((double)Obj.ColorOpacity.numericUpDownValue.Value);

                            // if the object it the Master then create a meta-object and put it inside
                            if (Obj.IsMasterObject())
                            {
                                cMetaBiologicalObject Cell = new cMetaBiologicalObject(Obj.WindowForMaster.textBoxName.Text + i, Current3DWorld.ListMetaObjectList[0], Obj.AssociatedBiologicalObjectList[i]);
            //                        // Cell.AddObject(Obj.AssociatedBiologicalObjectList[i]);
                                Current3DWorld.ListMetaObjectList[0].Add(Cell);
                            }
                        }

                        if (Obj.radioButtonColorSingle.Checked)
                            Current3DWorld.AddBiological3DObjects(Obj.AssociatedBiologicalObjectList, Obj.buttonChangeColorPositive.BackColor, eColorMode.Regular);
                        else if (Obj.radioButtonColorRandom.Checked)
                            Current3DWorld.AddBiological3DObjects(Obj.AssociatedBiologicalObjectList, Obj.buttonChangeColorPositive.BackColor, eColorMode.Random);
                        else if (Obj.radioButtonColorIndexed.Checked)
                            Current3DWorld.AddBiological3DObjects(Obj.AssociatedBiologicalObjectList, Obj.buttonChangeColorPositive.BackColor, eColorMode.Indexed);
                    }

                }
                else if (Obj.RadioButtonIsSpot.Checked)
                {
                    cSpotDetection Detection = new cSpotDetection(SeqToAnalyse, (int)Obj.numericUpDownChannel.Value);

                    if ((Obj.checkBoxPreProcessings.Checked == false) || (Obj.WindowForPreProcessing.checkBoxMedianIsDisabled.Checked))
                    {
                        Detection.SetMedian(-1);
                        Detection.SetShift(new cPoint3D(0, 0, 0));
                    }
                    else
                    {
                        Detection.SetMedian((int)Obj.WindowForPreProcessing.numericUpDownMedianKernel.Value);
                        Detection.SetShift(new cPoint3D((float)Obj.WindowForPreProcessing.numericUpDownShiftX.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftY.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftZ.Value));
                    }

                    if ((Obj.comboBoxContainer.Items.Count > 0) && (Obj.comboBoxContainer.SelectedItem != null))
                    {
                        Detection.SetContainers(Current3DWorld.GetListBiologicalObjectsOfType(Obj.comboBoxContainer.SelectedItem.ToString()));
                        if (Obj.InOrOut.radioButtonIn.Checked) Detection.SetContainersMode(0);
                        else Detection.SetContainersMode(1);
                    }

                    Obj.AssociatedBiologicalObjectList = Detection.HessianDetection((float)Obj.WindowForSpotDetection.numericUpDownSpotRadius.Value,
                                                                                    (float)Obj.WindowForSpotDetection.numericUpDownIntensityThreshold.Value,
                                                                                    (int)Obj.WindowForSpotDetection.numericUpDownSpotLocality.Value,
                                                                                    (double)Obj.WindowForSpotDetection.numericUpDownSphereDisplayRadius.Value);

                    Obj.richTextBoxInfo.AppendText(Obj.AssociatedBiologicalObjectList.Count + " objects detected.");
                    for (int i = 0; i < Obj.AssociatedBiologicalObjectList.Count; i++)
                    {
                        cBiologicalSpot TmpSpot = (cBiologicalSpot)Obj.AssociatedBiologicalObjectList[i];
                        TmpSpot.Name = Obj.textBoxName.Text + " " + i;
                        TmpSpot.SetType(Obj.textBoxName.Text);
            //                TmpSpot.ThumbnailnewImage = imageListForThumbnail.Images[Obj.AssociatedBiologicalObjectList[i].GetType() + ".jpg"];

            //                if (Obj.checkBoxIsDisplayName.Checked)
            //                    TmpSpot.AddText(TmpSpot.Name, Current3DWorld, (double)Obj.ForText.numericUpDownArrowScale.Value, Obj.ForText.buttonChangeColorPositive.BackColor);

                            if (Obj.checkIsBoxPointingArrow.Checked)
                            {
                                cGeometric3DObject AssociatedArrow = TmpSpot.AttachPointingArrow((double)Obj.ForArrow.numericUpDownArrowScale.Value, Obj.ForArrow.buttonChangeColorPositive.BackColor);
                                Current3DWorld.AddGeometric3DObject(AssociatedArrow);
                            }

            //                TmpSpot.SetOpacity((double)Obj.ColorOpacity.numericUpDownValue.Value);

            //                // if the object it the Master then create a meta-object and put it inside
                        if (Obj.IsMasterObject())
                        {
                            cMetaBiologicalObject Cell = new cMetaBiologicalObject("Cell " + i, Current3DWorld.ListMetaObjectList[0], Obj.AssociatedBiologicalObjectList[i]);
            //                 //   Cell.AddObject(Obj.AssociatedBiologicalObjectList[i]);
                            Current3DWorld.ListMetaObjectList[0].Add(Cell);
                        }

            //                /*cMetaBiologicalObject Cell = */
            //                //Current3DWorld.ListMetaObjectList[0].AssociateWith(Current3DWorld.ListMetaObjectList[0].FindTheClosestVolumeFrom(TmpSpot.GetCentroid(), 20), TmpSpot);
                    }

            //            if (Obj.radioButtonColorSingle.Checked)
            //                Current3DWorld.AddBiological3DObjects(Obj.AssociatedBiologicalObjectList, Obj.buttonChangeColorPositive.BackColor, eColorMode.Regular);
            //            else if (Obj.radioButtonColorRandom.Checked)
            //                Current3DWorld.AddBiological3DObjects(Obj.AssociatedBiologicalObjectList, Obj.buttonChangeColorPositive.BackColor, eColorMode.Random);
            //            else if (Obj.radioButtonColorIndexed.Checked)
            //                Current3DWorld.AddBiological3DObjects(Obj.AssociatedBiologicalObjectList, Obj.buttonChangeColorPositive.BackColor, eColorMode.Indexed);

                }
                else if (Obj.radioButtonIsVolumeRendering.Checked)
                {
                    Current3DWorld.AddVolume3D(new cVolumeRendering3D(this.AssociatedImage.SingleChannelImage[(int)Obj.numericUpDownChannel.Value],
                                               new cPoint3D((float)Obj.WindowForPreProcessing.numericUpDownShiftX.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftY.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftZ.Value),
                                               null, Current3DWorld));

                  //  cVolume3D Volume = new cVolume3D(SeqToAnalyse, (int)Obj.numericUpDownChannel.Value, new cPoint3D((float)Obj.WindowForPreProcessing.numericUpDownShiftX.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftY.Value, (float)Obj.WindowForPreProcessing.numericUpDownShiftZ.Value));
                  //  Current3DWorld.AddVolume3D(Volume, Color.Black, Obj.buttonChangeColorPositive.BackColor);
                }

            //        Thread oThread = new Thread(new ThreadStart(Obj.DisplayDone));

            }
            #endregion

            #region Objects Association
            cMetaBiologicalObjectList MetaCellList = Current3DWorld.ListMetaObjectList[0];

            // let's associate the objects
            for (int k = 0; k < ListFormForControl.Count; k++)
            {
                FormForControl Obj = ListFormForControl.ElementAt(ListFormForControl.Count - k -1);

                // that's a volume rendering ... no connection
                if (Obj.radioButtonIsVolumeRendering.Checked) continue;

                // the object is the master
                if (Obj.IsMasterObject()) continue;

                // this object has not connections ... is not associated to the master
                if (Obj.comboBoxLinkToTheMaster.SelectedIndex == 0) continue;

                cPoint3D ClosestPt = new cPoint3D(0, 0, 0);

                foreach (cBiological3DVolume CurrentSubObj in Obj.AssociatedBiologicalObjectList)
                {
                    cBiological3DVolume ObjectToIdentify = null;
                    switch (Obj.comboBoxLinkToTheMaster.SelectedIndex)
                    {
                        case 1:         // association by distance to the master centroid
                            ObjectToIdentify = MetaCellList.FindTheClosestVolumeCentroidFrom(CurrentSubObj.GetCentroid(), (double)Obj.WindowDistanceToMaster.numericUpDownDistanceMaxToMaster.Value);
                            break;
                        case 2:
            //                    //cBiological3DVolume CurrentVolume
                            ObjectToIdentify = MetaCellList.FindTheClosestVolumeFrom(CurrentSubObj, (double)Obj.WindowDistanceToMaster.numericUpDownDistanceMaxToMaster.Value, out ClosestPt);
                            break;
                        default:
                            break;
                   }

                    if (ObjectToIdentify == null) continue;
                    cMetaBiologicalObject Cell = MetaCellList.AssociateWith(ObjectToIdentify, CurrentSubObj);

            //            // --------------  draw information and links between the objects ---------------------
                    if (Obj.WindowDistanceToMaster.checkBoxDrawLinkToMasterCenter.Checked)
                    {
                        c3DLine CurrLine = new c3DLine(CurrentSubObj.GetCentroid(), ObjectToIdentify.GetCentroid());
                        Current3DWorld.AddGeometric3DObject(CurrLine);

                        //if (Obj.WindowDistanceToMaster.checkBoxDisplayBranchToCenterDistance.Checked)
                        //    CurrLine.DisplayLenght(Current3DWorld, 0.4);
                    }

            //            // --------------  draw information and links between the objects ---------------------
                    if (Obj.WindowDistanceToMaster.checkBoxDrawLinkToMasterEdges.Checked)
                    {
                        c3DLine CurrLine1 = new c3DLine(CurrentSubObj.GetCentroid(), ClosestPt);

                        Current3DWorld.AddGeometric3DObject(CurrLine1);

                        //if(Obj.WindowDistanceToMaster.checkBoxDisplayBranchToEdgesDistance.Checked)
                        //    CurrLine1.DisplayLenght(Current3DWorld, 0.4);
                    }
                }
            }
            #endregion

            #region Post Processings
            for (int k = 0; k < ListFormForControl.Count; k++)
            {
                FormForControl Obj = ListFormForControl.ElementAt(ListFormForControl.Count - k - 1);
                // the object is the master
            //      //  if (!Obj.IsMasterObject()) continue;

                if (!Obj.WindowForMaster.checkBoxDrawAssociatedDelaunay.Checked) continue;
                foreach (cMetaBiologicalObject CurrentMeta in MetaCellList)
                {
                    Current3DWorld.AddGeometric3DObject(CurrentMeta.GenerateDelaunay(2.0f,true));
                }
            }

            if (PostProcessWindow.checkBoxRemoveUnAssociatedObjects.Checked)
            {
                int RemovedObjects = Current3DWorld.RemoveNonAssociatedObjects();
                Console.WriteLine(RemovedObjects + " objects removed.");
            }

            //    if (PostProcessWindow.checkBoxExportMetaObjectSignatures.Checked)
            //    {
            //        if (CurrentTable == null)
            //        {
            //            CurrentTable = new DataTable();

            //            if (CurrentExperiment == null)
            //                CurrentTable.Columns.Add(new DataColumn("Image Idx", typeof(int)));
            //            else
            //            {
            //                CurrentTable.Columns.Add(new DataColumn("Image Col.", typeof(int)));
            //                CurrentTable.Columns.Add(new DataColumn("Image Row", typeof(int)));
            //            }

            //            CurrentTable.Columns.Add(new DataColumn("Meta Object Name", typeof(string)));

            //            foreach (string DescName in MetaCellList[0].GetSignatureNames())
            //                CurrentTable.Columns.Add(new DataColumn(DescName, typeof(double)));

            //            CurrentTable.Columns.Add(new DataColumn("Class", typeof(double)));
            //        }

            //        foreach (cMetaBiologicalObject CurrentMeta in MetaCellList)
            //        {
            //            List<double> CurrentSignature = CurrentMeta.GetSignature();

            //            CurrentTable.Rows.Add();
            //            if (CurrentExperiment == null)
            //            {
            //                CurrentTable.Rows[CurrentTable.Rows.Count - 1][0] = IdxImageProcessed;
            //                CurrentTable.Rows[CurrentTable.Rows.Count - 1][1] = CurrentMeta.Name;

            //                for (int Idx = 0; Idx < CurrentSignature.Count; Idx++)
            //                    CurrentTable.Rows[CurrentTable.Rows.Count - 1][Idx + 2] = CurrentSignature[Idx];
            //            }
            //            else
            //            {
            //                CurrentTable.Rows[CurrentTable.Rows.Count - 1][0] = CurrentExperiment.Column;
            //                CurrentTable.Rows[CurrentTable.Rows.Count - 1][1] = CurrentExperiment.Row;
            //                CurrentTable.Rows[CurrentTable.Rows.Count - 1][2] = CurrentMeta.Name;

            //                for (int Idx = 0; Idx < CurrentSignature.Count; Idx++)
            //                    CurrentTable.Rows[CurrentTable.Rows.Count - 1][Idx + 3] = CurrentSignature[Idx];
            //            }

            //            // Current3DWorld.CopyMetaObjectSignatureToTable(CurrentMeta, 0);
            //        }
            //        if (DataGrid != null)
            //        {
            //            DataGrid.dataGridViewForResults.DataSource = CurrentTable;
            //            DataGrid.Update();
            //            IdxImageProcessed++;
            //        }
            //    }

            #endregion

            //    //CurrentTable = new DataTable();
            //    if (CurrentExperiment == null)
            //    {
            //        if (PostProcessWindow.checkBoxDisplayBottomPlate.Checked) Current3DWorld.DisplayBottom(Color.FromArgb(255, 255, 255));
            //        Current3DWorld.SetBackgroundColor(PostProcessWindow.buttonChangeColorPositive.BackColor);
            //        Current3DWorld.Render();
            //    }
            //    // Current3DWorld.SetLinkToDataGridView(dataGridViewForClassif);

            cViewer3D V3D = new cViewer3D();
            V3D.SetInputData(Current3DWorld);
            V3D.Run();

            cDisplayToWindow DTW = new cDisplayToWindow();
            DTW.SetInputData(V3D.GetOutPut());
            DTW.Run();
            DTW.Display();
        }
Exemplo n.º 2
0
        public void CopyMetaObjectSignatureToTable(cMetaBiologicalObject MetaObject, int ObjectClass)
        {
            List<string> Descriptors = MetaObject.Information.GetGlobalDescriptorNames();
            cInteractive3DObject MasterObj = MetaObject.GetMasterObject();
            List<double> ListDescMaster = null;

            List<string> ListProfilName = null;

            cObject3D Master3d = (cObject3D)(MasterObj);

            if (Master3d.GetType().ToString().IndexOf("cBiological3DVolume") != -1)
            {
                cBiological3DVolume TmpVol = (cBiological3DVolume)Master3d;
                ListProfilName = TmpVol.Information.GetDescriptorNames();
                ListDescMaster = TmpVol.Information.GetInformation();
            }
            else if (Master3d.GetType().ToString().IndexOf("cBiologicalSpot") != -1)
            {
                cBiologicalSpot TmpSpot = (cBiologicalSpot)Master3d;
                ListProfilName = TmpSpot.Information.GetDescriptorNames();
                ListDescMaster = TmpSpot.Information.GetInformation();
            }

            if ((CurrentTable == null) || (CurrentTable.Columns.Count == 0) || (CurrentTable.Rows.Count == 0))
            {
                CurrentTable = new DataTable();

                //cBiological3DObject MasterObj = MetaObject.GetMasterObject();

                CurrentTable.Columns.Add(new DataColumn("Meta Object Name", typeof(string)));

                foreach (string DescName in ListProfilName)
                    CurrentTable.Columns.Add(new DataColumn(DescName, typeof(double)));

                for (int iDesc = 0; iDesc < Descriptors.Count; iDesc++)
                    CurrentTable.Columns.Add(new DataColumn(Descriptors[iDesc], typeof(double)));

                //for (int iDesc = 0; iDesc < Descriptors.Count; iDesc++)
                //    CurrentTable.Columns.Add(new DataColumn(Descriptors[iDesc], typeof(double)));
                CurrentTable.Columns.Add(new DataColumn("Class", typeof(double)));

                if (pDataGridView == null) Console.WriteLine("c3Dworld does not contains the link to the datagridview control");
            }

            List<double> Res = MetaObject.Information.GetInformation(Descriptors);
            List<object> objectNumbers = new List<object>();

            if (Res == null) return;

            foreach (double number in Res)
                objectNumbers.Add((object)number);
            objectNumbers.Add(ObjectClass);

            CurrentTable.Rows.Add();

            CurrentTable.Rows[CurrentTable.Rows.Count - 1][0] = MetaObject.Name;

            for (int Idx = 0; Idx < ListDescMaster.Count; Idx++)
                CurrentTable.Rows[CurrentTable.Rows.Count - 1][Idx + 1] = ListDescMaster[Idx];

            for (int Idx = 0; Idx <= Res.Count; Idx++)
                CurrentTable.Rows[CurrentTable.Rows.Count - 1][Idx + ListDescMaster.Count + 1] = objectNumbers[Idx];

            if (pDataGridView != null)
            {
                pDataGridView.DataSource = CurrentTable;
                pDataGridView.Update();
            }
        }
Exemplo n.º 3
0
 internal void DefineMetaContainer(cMetaBiologicalObject cMetaBiologicalObjectContainer)
 {
     this.MetaObjectContainer = cMetaBiologicalObjectContainer;
 }
        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);
            }

            CurrentWorld.SetBackgroundColor(Color.Black);
            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;

            cExtendPlateList ListPlate = new cExtendPlateList();

            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();

            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.ListDescriptors[DescX].GetValue();
                            if (TempX < MinX) MinX = TempX;
                            if (TempX > MaxX) MaxX = TempX;

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

                            TempZ = TmpWell.ListDescriptors[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.GetColor().R));
                            Col.Add((char)(TmpWell.GetColor().G));
                            Col.Add((char)(TmpWell.GetColor().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(MinValueX, MaxValueX);

            double MinValueY = ListPtY.Min();
            double MaxValueY = ListPtY.Max();
            cExtendedList NormY = ListPtY.Normalize(MinValueY, MaxValueY);

            double MinValueZ = ListPtZ.Min();
            double MaxValueZ = ListPtZ.Max();
            cExtendedList NormZ = ListPtZ.Normalize(MinValueZ, MaxValueZ);

            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);
            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());
            vtkActor actor = vtkActor.New();
            actor.SetMapper(mapper);

            CurrentWorld.ren1.AddActor(actor);

            if ((CompleteScreening.GetCurrentDisplayPlate().ListDRCRegions != null) && (CompleteScreening.GlobalInfo.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].GetClass() >= -1))
                            {

                                double StartX = (item[IdxWell].ListDescriptors[DescX].GetValue() - MinValueX) / (MaxValueX - MinValueX);
                                double StartY = (item[IdxWell].ListDescriptors[DescY].GetValue() - MinValueY) / (MaxValueY - MinValueY);
                                double StartZ = (item[IdxWell].ListDescriptors[DescZ].GetValue() - MinValueZ) / (MaxValueZ - MinValueZ);
                                double EndX = (item[IdxWell + 1].ListDescriptors[DescX].GetValue() - MinValueX) / (MaxValueX - MinValueX);
                                double EndY = (item[IdxWell + 1].ListDescriptors[DescY].GetValue() - MinValueY) / (MaxValueY - MinValueY);
                                double EndZ = (item[IdxWell + 1].ListDescriptors[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);
                }
            }

            // 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);

            }
            //

            //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);
            CurrentWorld.SimpleRender();// Render();
        }
Exemplo n.º 5
0
        public void Display3Dplate(int IdxDescriptor, cPoint3D MinimumPosition)
        {
            ParentScreening._3DWorldForPlateDisplay.ListMetaObjectList = new List<cMetaBiologicalObjectList>();
            cMetaBiologicalObjectList ListMetacells = new cMetaBiologicalObjectList("List Meta Objects");
            ParentScreening._3DWorldForPlateDisplay.ListMetaObjectList.Add(ListMetacells);

            c3DWell NewPlate3D = new c3DWell(new cPoint3D(0, 0, 0), new cPoint3D(ParentScreening.Columns, ParentScreening.Rows, 1), Color.Black, null);
            NewPlate3D.SetOpacity(0.0);

            cMetaBiologicalObject Plate3D = new cMetaBiologicalObject(this.Name, ListMetacells, NewPlate3D);

            #region  display the well list

            foreach (cWell TmpWell in this.ListWell)
            {
                if ((TmpWell == null) || (TmpWell.GetCurrentClassIdx() == -1)) continue;

                double PosZ = 8 - ((TmpWell.ListSignatures[IdxDescriptor].GetValue() - this.ListMinMax[IdxDescriptor][0]) * 8) / (this.ListMinMax[IdxDescriptor][1] - this.ListMinMax[IdxDescriptor][0]);

                double WellSize = (double)cGlobalInfo.OptionsWindow.numericUpDownWellSize.Value;
                double WellBorder = (1 - WellSize) / 2.0;

                cPoint3D CurrentPos = new cPoint3D(TmpWell.GetPosX() - WellBorder + MinimumPosition.X, TmpWell.GetPosY() + WellBorder + MinimumPosition.Y - WellSize / 2, PosZ + MinimumPosition.Z - WellBorder);
                Color WellColor = Color.Black;

                if (cGlobalInfo.IsDisplayClassOnly)
                    WellColor = TmpWell.GetClassColor();
                else
                {
                    int ConvertedValue;
                    byte[][] LUT = cGlobalInfo.CurrentPlateLUT;

                    if (this.ListMinMax[IdxDescriptor][0] == this.ListMinMax[IdxDescriptor][1])
                        ConvertedValue = 0;
                    else
                        ConvertedValue = (int)(((TmpWell.ListSignatures[IdxDescriptor].GetValue() - this.ListMinMax[IdxDescriptor][0]) * (LUT[0].Length - 1)) / (this.ListMinMax[IdxDescriptor][1] - this.ListMinMax[IdxDescriptor][0]));
                    if ((ConvertedValue >= 0) && (ConvertedValue < LUT[0].Length))
                        WellColor = Color.FromArgb(LUT[0][ConvertedValue], LUT[1][ConvertedValue], LUT[2][ConvertedValue]);
                }

                c3DWell New3DWell = new c3DWell(CurrentPos, new cPoint3D(CurrentPos.X + WellSize, CurrentPos.Y + WellSize, CurrentPos.Z + WellSize / 2.0), WellColor, TmpWell);
                New3DWell.SetType("[" + TmpWell.GetPosX() + " x " + TmpWell.GetPosY() + "]");

                cPropertyType WellPropertyType = null;
                foreach (object item in cGlobalInfo.WindowHCSAnalyzer.toolStripDropDownButtonDisplayMode.DropDownItems)
                {

                    if (item.GetType() == typeof(ToolStripMenuItem))
                    {
                        ToolStripMenuItem TmpMenuItem = ((ToolStripMenuItem)item);

                        if (TmpMenuItem.Checked && (TmpMenuItem.Tag != null) && (TmpMenuItem.Tag.GetType() == typeof(cPropertyType)))
                        {
                            WellPropertyType = ((cPropertyType)(TmpMenuItem).Tag);
                            break;
                        }
                    }
                }

                if ((WellPropertyType != null) && (cGlobalInfo.ViewMode != eViewMode.PIE))
                {
                    Title MainLegend = new Title();

                    string ToDisp = "";

                    if (WellPropertyType != null)
                    {

                        object CurrentValue = TmpWell.ListProperties.FindValueByName(WellPropertyType.Name);
                        if (CurrentValue != null) ToDisp = CurrentValue.ToString();//((double)CurrentValue).ToString("e4");
                        else
                            ToDisp = "n.a.";

                    }

                    New3DWell.AddText(ToDisp, ParentScreening._3DWorldForPlateDisplay, 0.1);
                }

                New3DWell.SetOpacity((double)cGlobalInfo.OptionsWindow.numericUpDownWellOpacity.Value);
                ParentScreening._3DWorldForPlateDisplay.AddBiological3DObject(New3DWell);
                Plate3D.AddObject(New3DWell);
            }

            #endregion

            #region Well numbering
            if (cGlobalInfo.OptionsWindow.checkBox3DPlateInformation.Checked)
            {
                for (int i = 1; i <= ParentScreening.Columns; i++)
                {
                    c3DText CurrentText = new c3DText(ParentScreening._3DWorldForPlateDisplay, i.ToString(), new cPoint3D(i - 1 + MinimumPosition.X, -0.5 + MinimumPosition.Y, 0 + MinimumPosition.Z), Color.White, 0.35);
                    ParentScreening._3DWorldForPlateDisplay.AddGeometric3DObject(CurrentText);
                }
                for (int j = 1; j <= ParentScreening.Rows; j++)
                {
                    c3DText CurrentText1;

                    if (cGlobalInfo.OptionsWindow.radioButtonWellPosModeDouble.Checked)
                        CurrentText1 = new c3DText(ParentScreening._3DWorldForPlateDisplay, j.ToString(), new cPoint3D(-1 + MinimumPosition.X, j - 0.5 + MinimumPosition.Y, 0 + MinimumPosition.Z), Color.White, 0.35);
                    else
                        CurrentText1 = new c3DText(ParentScreening._3DWorldForPlateDisplay, cGlobalInfo.ConvertIntPosToStringPos(j), new cPoint3D(-1 + MinimumPosition.X, j - 0.5 + MinimumPosition.Y, 0 + MinimumPosition.Z), Color.White, 0.35);

                    ParentScreening._3DWorldForPlateDisplay.AddGeometric3DObject(CurrentText1);
                }
            }
            #endregion

            if (this.ListDRCRegions != null)
            {
                foreach (cDRC_Region Region in this.ListDRCRegions)
                {

                    if (cGlobalInfo.OptionsWindow.checkBox1.Checked)
                    {

                        cDRC CurrentDRC = Region.GetDRC(this.ParentScreening.ListDescriptors[IdxDescriptor]);
                        if ((CurrentDRC == null) || (CurrentDRC.ResultFit == null) || (CurrentDRC.ResultFit.Y_Estimated.Count <= 1)) continue;

                        c3DDRC New3DDRC = new c3DDRC(CurrentDRC, Region, Color.White, this.ListMinMax[IdxDescriptor][0], this.ListMinMax[IdxDescriptor][1]);
                        New3DDRC.SetOpacity((double)cGlobalInfo.OptionsWindow.numericUpDownDRCOpacity.Value);
                        //New3DDRC.SetType("[" + TmpWell.GetPosX() + " x " + TmpWell.GetPosY() + "]");
                        ParentScreening._3DWorldForPlateDisplay.AddGeometric3DObject(New3DDRC);
                        //Plate3D.AddObject(New3DDRC);
                    }

                    if (cGlobalInfo.OptionsWindow.checkBox3DComputeThinPlate.Checked)
                    {
                        c3DThinPlate NewThinPlate = new c3DThinPlate(Region, (double)cGlobalInfo.OptionsWindow.numericUpDown3DThinPlateRegularization.Value);

                        if (cGlobalInfo.OptionsWindow.checkBox3DDisplayThinPlate.Checked)
                        {
                            NewThinPlate.SetOpacity(0.5);
                            NewThinPlate.SetToWireFrame();
                            ParentScreening._3DWorldForPlateDisplay.AddGeometric3DObject(NewThinPlate);
                        }
                        if (cGlobalInfo.OptionsWindow.checkBox3DDisplayIsoboles.Checked)
                        {
                            for (double PosZContour = 0; PosZContour <= 10.0; PosZContour += 1.5)
                            {
                                c3DIsoContours NewContour = new c3DIsoContours(NewThinPlate, Region, Color.Red, PosZContour, true);
                                ParentScreening._3DWorldForPlateDisplay.AddBiological3DObject(NewContour);
                            }
                        }
                        if (cGlobalInfo.OptionsWindow.checkBox3DDisplayIsoRatioCurves.Checked)
                        {
                            //   for (double PosZContour = 0; PosZContour <= 15.0; PosZContour += 3)
                            {
                                c3DIsoContours NewContour = new c3DIsoContours(NewThinPlate, Region, Color.Blue, 0/*PosZContour*/, false);
                                ParentScreening._3DWorldForPlateDisplay.AddBiological3DObject(NewContour);
                            }
                        }
                    }
                }
            }
        }