Beispiel #1
0
        private void ToolStripMenuItem_DisplayHistograms(object sender, EventArgs e)
        {
            if (GlobalInfo == null) return;
            for (int i = 0; i < cGlobalInfo.ListWellClasses.Count; i++)
            {
                if (cGlobalInfo.ListWellClasses[i].Name == this.Name)
                {
                    Idx = i;
                    break;
                }
            }

            if (Idx == -1) return;

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

            cDisplayToWindow CDW1 = new cDisplayToWindow();

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

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

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

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

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

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

            CV2.Run();

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

            DS.SetInputData(CV2.GetOutPut());

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

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

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

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

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

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

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

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

            cDisplayToWindow CDW1 = new cDisplayToWindow();

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

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

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

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

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

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

            CV2.Run();

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

            DS.SetInputData(CV2.GetOutPut());

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

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

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

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

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

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

            DS.SetInputData(CV1.GetOutPut());

            DS.Run();

            CDW1.SetInputData(DS.GetOutPut());

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

            return;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

            //return;
        }