public GraphicDescription MovingAverageFiltr(GraphicDescription graphics) { var correctCoordinats = new List <double>(); var windows = new List <double>(); var max = 0.0; for (int i = 0; i < graphics.GraphicsInfluence.Parametrs.Count; i++) { if (windows.Count < stepMedianFiltr) { windows.Add(graphics.GraphicsInfluence.Parametrs[i]); max += graphics.GraphicsInfluence.Parametrs[i]; } else { correctCoordinats.Add(max / stepMovingAverage); max -= windows[0]; windows.RemoveAt(0); } } GraphicDescription changedGraphics = new GraphicDescription(graphics.GraphicsName); changedGraphics.GraphicsColor = graphics.GraphicsColor; changedGraphics.GraphicsInfluence.Position = graphics.GraphicsInfluence.Position; changedGraphics.GraphicsInfluence.Parametrs = correctCoordinats; return(changedGraphics); }
public GraphicDescription MedianFiltr(GraphicDescription graphics) { var correctCoordinats = new List <double>(); var windows = new List <double>(); for (int i = 0; i < graphics.GraphicsInfluence.Parametrs.Count; i++) { if (windows.Count < stepMedianFiltr) { windows.Add(graphics.GraphicsInfluence.Parametrs[i]); } else { var withoutSort = new List <double>(); withoutSort.AddRange(windows); windows.Sort(); var middle = stepMedianFiltr / 2; correctCoordinats.Add(windows[middle]); windows = withoutSort; windows.RemoveAt(0); } } GraphicDescription changedGraphics = new GraphicDescription(graphics.GraphicsName); changedGraphics.GraphicsColor = graphics.GraphicsColor; changedGraphics.GraphicsInfluence.Position = graphics.GraphicsInfluence.Position; changedGraphics.GraphicsInfluence.Parametrs = correctCoordinats; return(changedGraphics); }
public GraphicDescription CreateNewGraphics(int angle, List <double> points, Color graphicsColor) { GraphicDescription newGraphics = new GraphicDescription(angle.ToString(), points); newGraphics.GraphicsColor = graphicsColor; return(newGraphics); }
public GraphicDescription CreateNewGraphics(string name, GraphicDescription graphicParametr, Color graphicsColor) { GraphicDescription newGraphics = new GraphicDescription(name); newGraphics.GraphicsInfluence.Position = graphicParametr.GraphicsInfluence.Position; newGraphics.GraphicsInfluence.Parametrs = graphicParametr.GraphicsInfluence.Parametrs; newGraphics.GraphicsColor = graphicsColor; return(newGraphics); }
public void WriteToExcel(List <GraphicDescription> allIntensityGraphics, GraphicDescription allAngleDiametrGraphic, GraphicDescription temperaturegraphic) { Excel.Application ObjExcel = new Excel.Application(); Excel.Workbook ObjWorkBook; Excel.Worksheet ObjWorkSheet; //Книга. ObjWorkBook = ObjExcel.Workbooks.Add(System.Reflection.Missing.Value); //Таблица. ObjWorkSheet = (Excel.Worksheet)ObjWorkBook.Sheets[1]; ObjWorkSheet.Cells[1, 1] = "Intensity graphics"; var step = 0; for (int i = 0; i < allIntensityGraphics.Count; i++) { ObjWorkSheet.Cells[2 + step, 1] = allIntensityGraphics[i].GraphicsName; ObjWorkSheet.Cells[3 + step, 2] = "Angle:"; ObjWorkSheet.Cells[4 + step, 2] = "Intensity:"; for (int j = 0; j < allIntensityGraphics[i].GraphicsPoints.Count; j++) { ObjWorkSheet.Cells[3 + step, 3 + j] = j; ObjWorkSheet.Cells[4 + step, 3 + j] = allIntensityGraphics[i].GraphicsPoints[j]; } step += 3; } step += 2; ObjWorkSheet.Cells[4 + step, 1] = "Diametr graphic"; ObjWorkSheet.Cells[5 + step, 1] = "Angle:"; ObjWorkSheet.Cells[6 + step, 1] = "Diametr:"; for (int i = 0; i < allAngleDiametrGraphic.GraphicsInfluence.Parametrs.Count; i++) { ObjWorkSheet.Cells[5 + step, 2 + i] = allAngleDiametrGraphic.GraphicsInfluence.Position[i]; ObjWorkSheet.Cells[6 + step, 2 + i] = allAngleDiametrGraphic.GraphicsInfluence.Parametrs[i]; } step += 5; ObjWorkSheet.Cells[2 + step, 1] = "Temperature graphic"; ObjWorkSheet.Cells[3 + step, 1] = "Angle:"; ObjWorkSheet.Cells[4 + step, 1] = "Value:"; for (int i = 0; i < temperaturegraphic.GraphicsInfluence.Parametrs.Count; i++) { ObjWorkSheet.Cells[3 + step, 2 + i] = allAngleDiametrGraphic.GraphicsInfluence.Position[i]; ObjWorkSheet.Cells[4 + step, 2 + i] = allAngleDiametrGraphic.GraphicsInfluence.Parametrs[i]; } ObjExcel.Visible = true; ObjExcel.UserControl = true; }
public void ShowDiametrGraphics(GraphicDescription graphic) { GraphPane pane = ZGDiametr.GraphPane; pane.CurveList.Clear(); PointPairList list = new PointPairList(); for (int i = 0; i < graphic.GraphicsInfluence.Parametrs.Count; i++) { list.Add(graphic.GraphicsInfluence.Position[i], graphic.GraphicsInfluence.Parametrs[i]); } LineItem myCurve = pane.AddCurve(graphic.GraphicsName, list, graphic.GraphicsColor, SymbolType.Diamond); pane.Title.Text = TitleZGDiametr; pane.XAxis.Title.Text = XZGDiametr; pane.YAxis.Title.Text = YZGDiametr; ZGDiametr.PerformAutoScale(); ZGDiametr.AxisChange(); ZGDiametr.Invalidate(); }
public void Filtr(int idFiltr) { if (storage.selectedAreaOfImage != null && storage.CurrentDiametrsGraphic != null && idFiltr >= 0 && idFiltr < storage.Filtres.Count) { var filtrName = storage.Filtres[idFiltr]; var filtredGraphics = new GraphicDescription(""); if (filtrName == "Median") { filtredGraphics = filtres.MedianFiltr(storage.CurrentDiametrsGraphic); } if (filtrName == "MovingAverage") { filtredGraphics = filtres.MovingAverageFiltr(storage.CurrentDiametrsGraphic); } if (filtrName == "NON") { formWindow.ShowDiametrGraphics(storage.CurrentDiametrsGraphic); } formWindow.ShowDiametrGraphics(filtredGraphics); } else { if (storage.CurrentDiametrsGraphic == null) { erroreMessage = "You didn't build any graphic of diameter"; } if (idFiltr < 0 || idFiltr > storage.Filtres.Count) { erroreMessage = "Filtr not exist"; } else { erroreMessage = "You don`t load image"; } formWindow.ShowMessage(erroreMessage); } }