Ejemplo n.º 1
0
        private void GenerateGraph()
        {
            MyWorld.BackGroundColor = Color.Orange;// GhostWhite;

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

            //// get a reference to the renderwindow of our renderWindowControl1
            //vtkRenderWindow RenderWindow = renderWindowControl1.RenderWindow;
            //// get a reference to the renderer
            //vtkRenderer Renderer = RenderWindow.GetRenderers().GetFirstRenderer();

            //int IdxItem = 0;

            //c3DSphere NewSPhere = new c3DSphere(new cPoint3D(0, 0, 0), 10);

            ////Renderer.AddActor(NewSPhere.

            ////foreach (var item in ListVTKData)
            ////{
            ////    vtkImageActor imageActor = vtkImageActor.New();
            ////    imageActor.SetInput(item);
            ////    imageActor.SetPosition(item.GetDimensions()[0] * (IdxItem++), 0, 0);

            ////    Renderer.AddActor2D(imageActor);
            ////}

            ////if ((this.InputVolume != null) && (this.InputVolume.vtk_volume != null))
            ////{
            ////    Renderer.AddVolume(this.InputVolume.vtk_volume);
            ////}

            //Renderer.SetBackground(0.3, 0.3, 0.3);
            //Renderer.ResetCamera();
        }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
        private void basic3DToolStripMenuItem_Click(object sender, EventArgs e)
        {
            cViewer3D V3D = new cViewer3D();
            c3DNewWorld MyWorld = new c3DNewWorld(new cPoint3D(1, 1, 1), new cPoint3D(1, 1, 1));

            c3DTexturedPlan Plan = new c3DTexturedPlan(new cPoint3D(0, 0, 0), new cImage(256, 256, 1, 1));
            Plan.Run();
            MyWorld.AddGeometric3DObject(Plan);

            V3D.SetInputData(MyWorld);
            V3D.Run();

            cDisplayToWindow DTW = new cDisplayToWindow();
            DTW.SetInputData(V3D.GetOutPut());
            DTW.Run();
            DTW.Display();
        }
Ejemplo n.º 4
0
        private void spiralToolStripMenuItem_Click(object sender, EventArgs e)
        {
            // first let's define all the stimuli
            #region Build the stimuli
            cStimuli ListCellStimuli = new cStimuli();

            cStimulus_Physical Gravity = new cStimulus_Physical("Gravity");
            ListCellStimuli.Add(Gravity);
            //cStimulus_Physical WorldEdges = new cStimulus_Physical("World Edges");
            //ListCellStimuli.Add(WorldEdges);
            cStimulus_Physical BrownianMotion = new cStimulus_Physical("Brownian Motion");
            ListCellStimuli.Add(BrownianMotion);


            cStimulus_Chemical ToxicCompound1 = new cStimulus_Chemical("ToxicCompound1");
            ListCellStimuli.Add(ToxicCompound1);
            #endregion


            #region build the cell agents
            #endregion

            cNewAgent BiologicalExperiment_DRC = new cNewAgent(new cPoint3D(0, 0, 0), new cPoint3D(5, 5, 5), "DRC");

            double Concentration = 0.01;
            for (int i = 0; i < 2; i++)
            {
                double WellSpacing = 1;
                cNewAgent BiologicalExperiment_Well = new cNewAgent(new cPoint3D(WellSpacing, 0, 0), new cPoint3D(1, 1, 1), "Well " + i);

                // add a new Property to the well
                cInternalProperty Cpd1Concentration = new cInternalProperty();
                Cpd1Concentration.Name = "Compound 1 Concentration";
                BiologicalExperiment_Well.AddProperty(Cpd1Concentration);

                // add the cellular agents in the well
                int RegularCellsNumber = 20;
                for (int CellIdx = 0; CellIdx < RegularCellsNumber; CellIdx++)
                {
                    cAgent_Cell Agent_RegularCell = new cAgent_Cell(new cPoint3D(0.02 * CellIdx, 0.2, 0.0200 * i), new cPoint3D(0.0100, 0.0100, 0.0100), "Regular Cell " + CellIdx);
                    Agent_RegularCell.AssociatedStimuli = ListCellStimuli;
                    BiologicalExperiment_Well.AddNewAgent(Agent_RegularCell);
                }

                int CancerCellsNumber = 30;
                for (int CellIdx = 0; CellIdx < CancerCellsNumber; CellIdx++)
                {
                    cAgent_Cell Agent_CancerCell = new cAgent_Cell(new cPoint3D(0.0100 * i, 0.0100 * CellIdx, 0.1000), new cPoint3D(0.0200, 0.0200, 0.0200), "Cancer Cell " + CellIdx);
                    Agent_CancerCell.AssociatedStimuli = ListCellStimuli;
                    BiologicalExperiment_Well.AddNewAgent(Agent_CancerCell);
                }


                // add the well agent in the DRC
                BiologicalExperiment_DRC.AddNewAgent(BiologicalExperiment_Well);

                Concentration *= 2;
            }

            for (int Iteration = 0; Iteration < 1; Iteration++)
            {
                BiologicalExperiment_DRC.Run();
            }

            // display objects in 3D
            cViewer3D V3D = new cViewer3D();
            // c3DNewWorld MyWorld = new c3DNewWorld((cPoint3D)BiologicalExperiment_DRC.InternalProperties["Volume"], new cPoint3D(1, 1, 1));
            c3DNewWorld MyWorld = new c3DNewWorld(new cPoint3D(1, 1, 1), new cPoint3D(1, 1, 1));
            V3D.SetInputData(MyWorld);
            V3D.Run();

            cDesignerSinglePanel CD = new cDesignerSinglePanel();
            CD.SetInputData(V3D.GetOutPut());
            if (CD.Run().IsSucceed == false) return;

            cListGeometric3DObject GlobalList = new cListGeometric3DObject("Global List");
            cListGeometric3DObject CellsList = new cListGeometric3DObject("Cells");

            cInternalProperty TmpProp;

            foreach (cNewAgent TmpWell in BiologicalExperiment_DRC)
            {

                cPoint3D ObjectPos = TmpWell.GetAbsoluteGetPosition();

                c3DCube SpaceCube = new c3DCube();
                TmpProp = TmpWell.InternalProperties["Volume"];
                cPoint3D VOlume = new cPoint3D(0, 0, 0);
                SpaceCube.Create(ObjectPos, VOlume, Color.Blue);
                SpaceCube.SetOpacity(0.2);
                GlobalList.AddObject(SpaceCube);

                foreach (cNewAgent TmpCell in TmpWell)
                {
                    ObjectPos = TmpCell.GetAbsoluteGetPosition();
                    c3DSphere _3DSphere = new c3DSphere(ObjectPos, 0.05, Color.Red);
                    TmpProp = TmpCell.InternalProperties["Volume"];
                    VOlume = new cPoint3D(0, 0, 0);// (cPoint3D)TmpCell.InternalProperties["Volume"];
                    //_3DSphere.(ObjectPos, 0.5, Color.Red);
                    _3DSphere.SetName(TmpCell.GetName());
                    _3DSphere.SetOpacity(1);

                    CellsList.AddObject(_3DSphere);
                }
            }


            GlobalList.AddRange(CellsList);

            foreach (var item in GlobalList)
                MyWorld.AddGeometric3DObject(item);

            cDisplayToWindow CDW = new cDisplayToWindow();
            CDW.SetInputData(CD.GetOutPut());
            CDW.Title = "3D world";
            if (CDW.Run().IsSucceed == false) return;
            CDW.Display();
            return;
        }
Ejemplo n.º 5
0
        private void dDisplayToolStripMenuItem_Click(object sender, EventArgs e)
        {
            cViewer3D V3D = new cViewer3D();
            c3DNewWorld MyWorld = new c3DNewWorld(new cPoint3D(1, 1, 1), new cPoint3D(1, 1, 1));

            MyWorld.BackGroundColor = cGlobalInfo.OptionsWindow.FFAllOptions.panelFor3DBackColor.BackColor;

            V3D.SetInputData(MyWorld);
            V3D.Run();


            cDesignerSinglePanel CD = new cDesignerSinglePanel();
            CD.SetInputData(V3D.GetOutPut());
            if (CD.Run().IsSucceed == false) return;

            cDisplayToWindow CDW = new cDisplayToWindow();
            CDW.SetInputData(CD.GetOutPut());
            CDW.Title = "3D world";
            if (CDW.Run().IsSucceed == false) return;
            CDW.Display();
        }
Ejemplo n.º 6
0
        private void dToolStripMenuItemScatterPlot3D_Click(object sender, EventArgs e)
        {
            int MaxNumberOfPts = (int)cGlobalInfo.OptionsWindow.FFAllOptions.numericUpDownMinNumPointForFastDisp.Value;

            if (cGlobalInfo.CurrentScreening.ListPlatesActive.GetListActiveWells().Count > MaxNumberOfPts)
            {
                cExtendedTable ET = cGlobalInfo.CurrentScreening.ListPlatesActive.GetListActiveWells().GetAverageDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors(), false, false);
                cNormalize N = new cNormalize();
                N.SetInputData(ET);
                N.NormalizationType = eNormalizationType.MIN_MAX;
                N.Run();
                cExtendedTable NormTable = N.GetOutPut();

                cViewer3D V3D = new cViewer3D();
                c3DPointCloud _3DPtCloud = new c3DPointCloud(NormTable);
                _3DPtCloud.AutomatedPtColorMode = 1;
                _3DPtCloud.Create(new cPoint3D(0, 0, 0));
                _3DPtCloud.SetName("_3DPtCloud");
                cListGeometric3DObject GlobalList = new cListGeometric3DObject("3D Point Cloud MetaObject");

                GlobalList.Add(_3DPtCloud);

                c3DObject_Axis Axis = new c3DObject_Axis();
                cExtendedTable T = new cExtendedTable();
                T.Add(new cExtendedList(ET[0].Name));

                T[0].Tag = ET[0].Tag;
                T[0].Add(0);
                T[0].Add(1);
                T.Add(new cExtendedList(ET[1].Name));
                T[1].Tag = ET[1].Tag;
                T[1].Add(0);
                T[1].Add(1);

                if (ET.Count > 2)
                {
                    T.Add(new cExtendedList(ET[2].Name));
                    T[2].Tag = ET[2].Tag;
                    T[2].Add(0);
                    T[2].Add(1);
                }

                Axis.SetInputData(T);

                c3DNewWorld MyWorld = new c3DNewWorld(new cPoint3D(1, 1, 1), new cPoint3D(1, 1, 1));
                Axis.Run(MyWorld);

                GlobalList.AddRange(Axis.GetOutPut());

                // GlobalList.Add(Axis);

                foreach (var item in GlobalList)
                {
                    MyWorld.AddGeometric3DObject(item);
                }

                //  MyWorld.BackGroundColor = cGlobalInfo.OptionsWindow.FFAllOptions.panelFor3DBackColor.BackColor;

                V3D.SetInputData(MyWorld);
                V3D.Run();

                cDisplayToWindow DTW = new cDisplayToWindow();
                DTW.SetInputData(V3D.GetOutPut());
                DTW.Title = "3D Cloud Point - " + ET[0].Count + " points";
                DTW.Run();

                DTW.Display();
            }
            else
            {
                cGlobalInfo.OptionsWindow.checkBoxConnectDRCPts.Checked = false;
                FormFor3DDataDisplay FormToDisplayXYZ = new FormFor3DDataDisplay(ProcessModeEntireScreeningToolStripMenuItem.Checked, cGlobalInfo.CurrentScreening);
                for (int i = 0; i < (int)cGlobalInfo.CurrentScreening.ListDescriptors.Count; i++)
                {
                    FormToDisplayXYZ.comboBoxDescriptorX.Items.Add(cGlobalInfo.CurrentScreening.ListDescriptors[i].GetName());
                    FormToDisplayXYZ.comboBoxDescriptorY.Items.Add(cGlobalInfo.CurrentScreening.ListDescriptors[i].GetName());
                    FormToDisplayXYZ.comboBoxDescriptorZ.Items.Add(cGlobalInfo.CurrentScreening.ListDescriptors[i].GetName());
                }
                FormToDisplayXYZ.Show();
                FormToDisplayXYZ.comboBoxDescriptorX.Text = cGlobalInfo.CurrentScreening.ListDescriptors[0].GetName() + " ";
                FormToDisplayXYZ.comboBoxDescriptorY.Text = cGlobalInfo.CurrentScreening.ListDescriptors[0].GetName() + " ";
                FormToDisplayXYZ.comboBoxDescriptorZ.Text = cGlobalInfo.CurrentScreening.ListDescriptors[0].GetName() + " ";
            }
            return;
        }
Ejemplo n.º 7
0
        private void dRC3DToolStripMenuItem_Click(object sender, EventArgs e)
        {

            if (cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors().Count < 3)
            {
                MessageBox.Show("At least 3 descriptors are required for this operation !", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            cListExtendedTable LET = new cListExtendedTable();

            //List<cListWells> ListWells = new List<cListWells>();
            //ListWells.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells);

            // firstly, wells are grouped by class
            //foreach (var item in cGlobalInfo.ListWellClasses)
            //{
            //    List<cWellClassType> TypeForFilter = new List<cWellClassType>();
            //    TypeForFilter.Add(item);
            //    cListWells TmpListWells = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells.Filter(TypeForFilter);
            //    cGeneralDRC gDRC = new cGeneralDRC(TmpListWells);
            //    LET.Add(gDRC.ListAverageValues);
            //}


            for (int i = 0; i < 3; i++)
            {
                List<int> GroupForFilter = new List<int>();
                GroupForFilter.Add(i);
                cListWells TmpListWells = cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells.FilterByGroup(GroupForFilter);
                cGeneralDRC gDRC = new cGeneralDRC(TmpListWells);
                LET.Add(gDRC.ListAverageValues);
            }



            cViewer3D V3D = new cViewer3D();
            c3DNewWorld MyWorld = new c3DNewWorld(new cPoint3D(1, 1, 1), new cPoint3D(1, 1, 1));

            c3DObjectScatterPoints _3DScatterPt = new c3DObjectScatterPoints();
            //_3DScatterPt.SetInputData(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells.GetDescriptorValues(cGlobalInfo.CurrentScreening.ListDescriptors.GetActiveDescriptors(), false));
            //  _3DScatterPt.GlobalInfo = this.GlobalInfo;
            _3DScatterPt.SetInputData(LET);
            // _3DScatterPt.IsLinked = true;
            _3DScatterPt.Run(MyWorld);

            cListGeometric3DObject GlobalList = _3DScatterPt.GetOutPut();

            foreach (var item in GlobalList)
            {
                MyWorld.AddGeometric3DObject(item);
            }


            MyWorld.BackGroundColor = cGlobalInfo.OptionsWindow.FFAllOptions.panelFor3DBackColor.BackColor;

            V3D.SetInputData(MyWorld);
            V3D.Run();

            cDisplayToWindow DTW = new cDisplayToWindow();
            DTW.SetInputData(V3D.GetOutPut());
            DTW.Title = "3D Dose Response Visualization";
            DTW.Run();
            DTW.Display();
        }
Ejemplo n.º 8
0
        private void ToolStripMenuItem_Display3DTexture(object sender, EventArgs e)
        {
            cViewer3D V3D = new cViewer3D();
            c3DNewWorld MyWorld = new c3DNewWorld(new cPoint3D(1, 1, 1), new cPoint3D(1, 1, 1));

            cListGeometric3DObject GlobalList = new cListGeometric3DObject("2D Texture Metaobject");

            c3DTexturedPlan _3DPlan = new c3DTexturedPlan(new cPoint3D(0, 0, 0), this.AssociatedImage);

            //   c3DElevationMap _3DMap = new c3DElevationMap(new cPoint3D(0, 0, 0), this.Input, this.LUT);

            _3DPlan.SetName("2D Texture");
            _3DPlan.Run();
            GlobalList.Add(_3DPlan);

            foreach (var item in GlobalList)
                MyWorld.AddGeometric3DObject(item);

            //  MyWorld.AddLight(Color.White);

            V3D.SetInputData(MyWorld);
            V3D.Run();

            cDisplayToWindow DTW = new cDisplayToWindow();
            DTW.SetInputData(V3D.GetOutPut());
            DTW.Title = "2D texture (" + this.AssociatedImage.Name + ")";
            DTW.Run();
            DTW.Display();
        }
Ejemplo n.º 9
0
        private void ToolStripMenuItem_3DTest(object sender, EventArgs e)
        {
            Plugin3D NewPlug = new Plugin3D(this.AssociatedImage);
            NewPlug.Show();

            return;

            c3DNewWorld MyWorld = new c3DNewWorld(new cPoint3D(this.AssociatedImage.Width, this.AssociatedImage.Height, this.AssociatedImage.Depth),
                                                    new cPoint3D(1, 1, 1));

            cVolumeDetection Detection = new cVolumeDetection(this.AssociatedImage, 2, false);
            Detection.SetShift(new cPoint3D(0, 0, 0));
            Detection.SetContainers(null);

            List<cInteractive3DObject> AssociatedBiologicalObjectList = Detection.IntensityThreshold(150f,
                                         10,
                                         float.MaxValue);

            for (int i = 0; i < AssociatedBiologicalObjectList.Count; i++)
            {
                cBiological3DVolume TmpVol = (cBiological3DVolume)AssociatedBiologicalObjectList[i];

                // MyWorld.AddGeometric3DObject(TmpVol.AttachText("Object " + i, 5, Color.White));

                //    //if (Obj.checkIsBoxPointingArrow.Checked)
                cGeometric3DObject AssociatedArrow = TmpVol.AttachPointingArrow(5f, Color.Tomato);
                MyWorld.AddGeometric3DObject(AssociatedArrow);

                AssociatedBiologicalObjectList[i].SetOpacity(/*(double)Obj.ColorOpacity.numericUpDownValue.Value*/0.5);
                AssociatedBiologicalObjectList[i].Colour = Color.Red;

                MyWorld.AddBiological3DObject(AssociatedBiologicalObjectList[i]);

            }

            MyWorld.AddVolume3D(new cVolumeRendering3D(this.AssociatedImage.SingleChannelImage[0], new cPoint3D(0, 0, 0), null, MyWorld));

            MyWorld.BackGroundColor = Color.LightGray;// GhostWhite;

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

            cDisplayToWindow DTW = new cDisplayToWindow();
            DTW.SetInputData(V3D.GetOutPut());
            DTW.Run();
            DTW.Display();
        }
Ejemplo n.º 10
0
        public cFeedBackMessage Run()
        {
            if (base.Start() == false)
            {
                base.FeedBackMessage.IsSucceed = false;
                return base.FeedBackMessage;
            }

            if ((this.Input == null)||(this.Input.Count==0))
            {

                FeedBackMessage.IsSucceed = false;
                FeedBackMessage.Message = "No input data defined.";
                return FeedBackMessage;
            }
            FeedBackMessage.IsSucceed = true;

            #region Properties Management
            object _firstValue = base.ListProperties.FindByName("Normalized ?");
            bool IsNormalized = false;
            if (_firstValue == null)
            {
                base.GenerateError("-Normalized ?- not found !");
                return base.FeedBackMessage;
            }
            try
            {
                cProperty TmpProp = (cProperty)_firstValue;
                IsNormalized = (bool)TmpProp.GetValue();
            }
            catch (Exception)
            {
                base.GenerateError("-Normalized ?- cast didn't work");
                return base.FeedBackMessage;
            }

            _firstValue = base.ListProperties.FindByName("Draw Axis ?");
            bool IsdrawAxis = true;
            if (_firstValue == null)
            {
                base.GenerateError("-Draw Axis ?- not found !");
                return base.FeedBackMessage;
            }
            try
            {
                cProperty TmpProp = (cProperty)_firstValue;
                IsdrawAxis = (bool)TmpProp.GetValue();
            }
            catch (Exception)
            {
                base.GenerateError("-Draw Axis ?- cast didn't work");
                return base.FeedBackMessage;
            }

            _firstValue = base.ListProperties.FindByName("Link Points ?");
            bool IsLinked = false;
            if (_firstValue == null)
            {
                base.GenerateError("-Link Points ?- not found !");
                return base.FeedBackMessage;
            }
            try
            {
                cProperty TmpProp = (cProperty)_firstValue;
                IsLinked = (bool)TmpProp.GetValue();
            }
            catch (Exception)
            {
                base.GenerateError("-Link Points ?- cast didn't work");
                return base.FeedBackMessage;
            }

            _firstValue = base.ListProperties.FindByName("Desc. 1");
            string Desc1;
            if (_firstValue == null)
            {
                base.GenerateError("-Desc. 1- not found !");
                return base.FeedBackMessage;
            }
            try
            {
                cProperty TmpProp = (cProperty)_firstValue;
                Desc1 = (string)TmpProp.GetValue();
            }
            catch (Exception)
            {
                base.GenerateError("-Desc. 1- cast didn't work");
                return base.FeedBackMessage;
            }
            cDescriptorType DescX = cGlobalInfo.CurrentScreening.ListDescriptors.GetDescriptorByName(Desc1);
            if (DescX == null)
            {
                base.GenerateError(Desc1 + " is not a descriptor !");
                return base.FeedBackMessage;
            }

            _firstValue = base.ListProperties.FindByName("Desc. 2");
            if (_firstValue == null)
            {
                base.GenerateError("-Desc. 2- not found !");
                return base.FeedBackMessage;
            }
            try
            {
                cProperty TmpProp = (cProperty)_firstValue;
                Desc1 = (string)TmpProp.GetValue();
            }
            catch (Exception)
            {
                base.GenerateError("-Desc. 2- cast didn't work");
                return base.FeedBackMessage;
            }
            cDescriptorType DescY = cGlobalInfo.CurrentScreening.ListDescriptors.GetDescriptorByName(Desc1);
            if (DescY == null)
            {
                base.GenerateError(Desc1 + " is not a descriptor !");
                return base.FeedBackMessage;
            }

            _firstValue = base.ListProperties.FindByName("Desc. 3");
            if (_firstValue == null)
            {
                base.GenerateError("-Desc. 3- not found !");
                return base.FeedBackMessage;
            }
            try
            {
                cProperty TmpProp = (cProperty)_firstValue;
                Desc1 = (string)TmpProp.GetValue();
            }
            catch (Exception)
            {
                base.GenerateError("-Desc. 2- cast didn't work");
                return base.FeedBackMessage;
            }
            cDescriptorType DescZ = cGlobalInfo.CurrentScreening.ListDescriptors.GetDescriptorByName(Desc1);
            if (DescZ == null)
            {
                base.GenerateError(Desc1 + " is not a descriptor !");
                return base.FeedBackMessage;
            }

            #endregion

            List<cDescriptorType> ListDesc = new List<cDescriptorType>();
            ListDesc.Add(DescX);
            ListDesc.Add(DescY);
            ListDesc.Add(DescZ);

            cListExtendedTable LET = new cListExtendedTable();
            foreach (var item in cGlobalInfo.ListWellClasses)
            {
                List<cWellClassType> TypeForFilter = new List<cWellClassType>();
                TypeForFilter.Add(item);

                cExtendedTable TmpTable = ((cListWells)this.Input.Filter(TypeForFilter)).GetAverageDescriptorValues(ListDesc,false, false);
                if (TmpTable != null)
                    LET.Add(TmpTable);
            }

            cViewer3D V3D = new cViewer3D();
            c3DNewWorld MyWorld = new c3DNewWorld(new cPoint3D(1, 1, 1), new cPoint3D(1, 1, 1));

            c3DObjectScatterPoints _3DScatterPt = new c3DObjectScatterPoints();

            _3DScatterPt.ListProperties.FindByName("Draw Axis ?").SetNewValue(IsdrawAxis);
            _3DScatterPt.ListProperties.FindByName("Normalized ?").SetNewValue(IsNormalized);
            _3DScatterPt.ListProperties.FindByName("Link Points ?").SetNewValue(IsLinked);
            _3DScatterPt.SetInputData(LET);
            if (_3DScatterPt.Run(MyWorld).IsSucceed == false) return base.FeedBackMessage;

            cListGeometric3DObject GlobalList = _3DScatterPt.GetOutPut();

            foreach (var item in GlobalList)
            {
                MyWorld.AddGeometric3DObject(item);
            }

            MyWorld.BackGroundColor = cGlobalInfo.OptionsWindow.FFAllOptions.panelFor3DBackColor.BackColor;

            V3D.SetInputData(MyWorld);
            V3D.Run();

            cDisplayToWindow DTW = new cDisplayToWindow();
            DTW.SetInputData(V3D.GetOutPut());
               DTW.Title = "3D Scatter Plot(List "+this.Input.Count +" Wells)";
            DTW.Run();

            DTW.Display();

            return base.FeedBackMessage;
        }
Ejemplo n.º 11
0
        private void ToolStripMenuItem_Display3DScatterGraph(object sender, EventArgs e)
        {
            cExtendedTable CET = new cExtendedTable();

            foreach (DataGridViewColumn item in GridView.SelectedColumns)
            {
                CET.Add(Input[item.Index]);
            }

            if (this.Input.ListTags != null)
            {
                CET.ListTags = new List<object>();
                foreach (var item in this.Input.ListTags)
                {
                    CET.ListTags.Add(item);
                }
            }

            cListExtendedTable LET = new cListExtendedTable();
            LET.Add(CET);

            //List<cListWells> ListWells = new List<cListWells>();
            //ListWells.Add(cGlobalInfo.CurrentScreening.GetCurrentDisplayPlate().ListActiveWells);

            cViewer3D V3D = new cViewer3D();
            c3DNewWorld MyWorld = new c3DNewWorld(new cPoint3D(1, 1, 1), new cPoint3D(1, 1, 1));

            c3DObjectScatterPoints _3DScatterPt = new c3DObjectScatterPoints();
            _3DScatterPt.ListProperties.FindByName("Draw Axis ?").SetNewValue((bool)true);
            _3DScatterPt.ListProperties.FindByName("Draw Axis ?").IsGUIforValue = true;
            _3DScatterPt.ListProperties.FindByName("Normalized ?").SetNewValue((bool)true);
            _3DScatterPt.ListProperties.FindByName("Normalized ?").IsGUIforValue = true;
            _3DScatterPt.ListProperties.FindByName("Link Points ?").SetNewValue((bool)false);
            _3DScatterPt.ListProperties.FindByName("Link Points ?").IsGUIforValue = true;

            //_3DScatterPt.GlobalInfo = cGlobalInfo;
            _3DScatterPt.SetInputData(LET);
            if (_3DScatterPt.Run(MyWorld).IsSucceed == false) return;

            cListGeometric3DObject GlobalList = _3DScatterPt.GetOutPut();

            foreach (var item in GlobalList)
            {
                MyWorld.AddGeometric3DObject(item);
            }

            V3D.SetInputData(MyWorld);
            V3D.Run();

            cDisplayToWindow DTW = new cDisplayToWindow();
            DTW.SetInputData(V3D.GetOutPut());
            DTW.Title = "3D Scatter Graph ("+ this.Input.Name +")";
            DTW.Run();
            DTW.Display();
        }
Ejemplo n.º 12
0
        public void Refresh3DScreenView()
        {
            cViewer3D V3D = new cViewer3D();
            c3DNewWorld MyWorld = new c3DNewWorld(new cPoint3D(1, 1, 1), new cPoint3D(1, 1, 1));
            V3D.SetInputData(MyWorld);

            c3DObject_Screening2D Screening2D = new c3DObject_Screening2D();
            Screening2D.SetInputData(cGlobalInfo.CurrentScreening);
            Screening2D.Run(MyWorld);
            MyWorld.AddGeometric3DObjects(Screening2D.GetOutPut());

               // c3DObject_Plate2D Plate2D = new c3DObject_Plate2D();
               // Plate2D.SetInputData(this);
               // Plate2D.Run(MyWorld);
               // MyWorld.AddGeometric3DObjects(Plate2D.GetOutPut());

               // MyWorld.BackGroundColor = Color.White;

            V3D.Run();

            cExtendedControl EXT = V3D.GetOutPut();
            cGlobalInfo.WindowHCSAnalyzer.tabPage3DPlatesView.Controls.Clear();

            EXT.Width = cGlobalInfo.WindowHCSAnalyzer.tabPage3DPlatesView.Width;
            EXT.Height = cGlobalInfo.WindowHCSAnalyzer.tabPage3DPlatesView.Height;

            // EXT.Controls[0].Width = cGlobalInfo.WindowHCSAnalyzer.tabPage3DPlatesView.Width;
            // EXT.Controls[0].Height = cGlobalInfo.WindowHCSAnalyzer.tabPage3DPlatesView.Height;

            cGlobalInfo.WindowHCSAnalyzer.tabPage3DPlatesView.Controls.Add(EXT);

            //cDesignerSinglePanel CD = new cDesignerSinglePanel();
            //CD.SetInputData(V3D.GetOutPut());
            //if (CD.Run().IsSucceed == false) return;

            //cDisplayToWindow CDW = new cDisplayToWindow();
            //CDW.SetInputData(CD.GetOutPut());
            //CDW.Title = "3D world";
            //if (CDW.Run().IsSucceed == false) return;
            //CDW.Display();
        }
Ejemplo n.º 13
0
        private void GenerateGraph()
        {
            V3D = new cViewer3D();
            MyWorld = new c3DNewWorld(new cPoint3D(1, 1, 1), new cPoint3D(1, 1, 1));

            cListGeometric3DObject GlobalList = new cListGeometric3DObject("Elevation Map MetaObject");

            if(this.Input!=null)
            foreach (var item in this.Input)
            {
                c3DElevationMap _3DMap = new c3DElevationMap(new cPoint3D(-this.Input[0].Count / 2, -this.Input[0][0].Count / 2, 0), item, this.LUT);
                _3DMap.SetName("Elevation Map [" + item.Name +"]");
                GlobalList.Add(_3DMap);
            }

            if (this.InputImage != null)
            {
                for (int i = 0; i < this.InputImage.GetNumChannels(); i++)
                {
                    c3DElevationMap _3DMapFromImage = new c3DElevationMap(new cPoint3D(0, 0, 0), this.InputImage, i, 0);
                    if(this.InputImage.AssociatedImagePanel!=null)
                    _3DMapFromImage.SetOpacity(this.InputImage.AssociatedImagePanel.LUTManager.GetImageDisplayProperties().ListOpacity[i]/100.0);
                    _3DMapFromImage.SetName("Elevation Map [" + this.InputImage.SingleChannelImage[i].Name+"]");
                    GlobalList.Add(_3DMapFromImage);
                }
            }

            foreach (var item in GlobalList)
            {
                MyWorld.AddGeometric3DObject(item);
            }

            MyWorld.BackGroundColor = cGlobalInfo.OptionsWindow.FFAllOptions.panelFor3DBackColor.BackColor;
            V3D.SetInputData(MyWorld);
            V3D.Run();

            #region obsolete
            //// get a reference to the renderwindow of our renderWindowControl1
            //vtkRenderWindow RenderWindow = renderWindowControl1.RenderWindow;
            //// get a reference to the renderer
            //vtkRenderer Renderer = RenderWindow.GetRenderers().GetFirstRenderer();
            //vtkPoints points = vtkPoints.New();

            //double MaxZ = this.Input.Max();
            //double MinZ = this.Input.Min();

            //for (int IdxX = 0; IdxX < this.Input.Count; IdxX++)
            //    for (int IdxY = 0; IdxY < this.Input[IdxX].Count; IdxY++)
            //    {
            //        double Value = ((this.Input[IdxX][this.Input[IdxX].Count- IdxY-1] - MinZ) / (MaxZ - MinZ) * this.Input.Count) / 5;
            //        points.InsertNextPoint(IdxX, IdxY, Value);
            //    }

            //double[] bounds = points.GetBounds();

            //// Add the grid points to a polydata object
            //vtkPolyData inputPolyData = vtkPolyData.New();
            //inputPolyData.SetPoints(points);

            //// Triangulate the grid points
            //vtkDelaunay2D delaunay = vtkDelaunay2D.New();
            //delaunay.SetInput(inputPolyData);
            //delaunay.Update();

            //vtkElevationFilter elevationFilter = vtkElevationFilter.New();
            //elevationFilter.SetInputConnection(delaunay.GetOutputPort());
            //elevationFilter.SetLowPoint(0.0, 0.0, bounds[5]);
            //elevationFilter.SetHighPoint(0.0, 0.0, bounds[4]);
            //elevationFilter.Update();

            //vtkPolyData output = vtkPolyData.New();
            //output.ShallowCopy(vtkPolyData.SafeDownCast(elevationFilter.GetOutput()));

            //// Generate the colors for each point based on the color map
            //vtkUnsignedCharArray colors = vtkUnsignedCharArray.New();
            //colors.SetNumberOfComponents(3);
            //colors.SetName("Colors");
            //output.GetPointData().AddArray(colors);

            //// Visualize
            //vtkPolyDataMapper mapper = vtkPolyDataMapper.New();
            //mapper.SetInput(output);

            //// Create the color map
            //vtkLookupTable colorLookupTable = vtkLookupTable.New();
            //colorLookupTable.Build();

            //if (LUT == null)
            //{
            //    cLUT MyLut = new cLUT();
            //    LUT = MyLut.LUT_JET;
            //}

            ////colorLookupTable.SetValueRange(1,0);//bounds[0], bounds[1]);

            //double LUTSize = LUT[0].Length;
            //colorLookupTable.SetNumberOfTableValues((int)LUTSize - 1);

            //for (int i = 0; i < (int)LUTSize - 1; i++)
            //{
            //    colorLookupTable.SetTableValue((int)LUTSize - 1 - i-1, this.LUT[0][i] / LUTSize, this.LUT[1][i] / LUTSize, this.LUT[2][i] / LUTSize, 1);
            //}

            ////colorLookupTable.SetSaturationRange(0, 0);
            ////colorLookupTable.SetTableRange(bounds[4], bounds[5]);
            ////table.SetRange(range[0], range[1]); //shoul here not be the minimum/maximum possible of "data"?
            //// colorLookupTable.SetRampToLinear();
            //colorLookupTable.Build();

            //mapper.SetLookupTable(colorLookupTable);

            //vtkActor NewActor = vtkActor.New();
            //NewActor.SetMapper(mapper);
            //Renderer.AddActor(NewActor);

            //// set background color
            //Renderer.SetBackground(BackGroundColor.R / 255.0, BackGroundColor.G / 255.0, BackGroundColor.B / 255.0);

            //// ensure all actors are visible (in this example not necessarely needed,
            //// but in case more than one actor needs to be shown it might be a good idea)
            //Renderer.ResetCamera();
            #endregion
        }