//Constructs the document and places it in the provided state public NuGenDocument(DigitizeState state) { listeners = new List <NuGenImageListener>(); pointSets = new NuGenPointSetCollection(); segments = new NuGenSegmentCollection(); transform = new NuGenScreenTranslate(this); gridDisplay = new List <GridlineScreen>(); digitizeState = state; matchSet = new NuGenMatchSet(pointMatchSettings); //load all of the settings NuGenDefaultSettings rSettings = NuGenDefaultSettings.GetInstance(); coordSettings = rSettings.CoordSettings; exportSettings = rSettings.ExportSettings; segmentSettings = rSettings.SegmentSettings; pointMatchSettings = rSettings.PointMatchSettings; gridRemovalSettings = rSettings.GridRemovalSettings; gridDisplaySettings.initialized = false; gridDisplaySettings.gridSetX = rSettings.GridDisplayGridSetX; gridDisplaySettings.gridSetY = rSettings.GridDisplayGridSetY; discretizeSettings = rSettings.DiscretizeSettings; backgroundSelection = rSettings.BackgroundSelection; }
//Removes pixels around user defined gridlines private void RemoveGridlines(PixelState[,] pixels, NuGenScreenTranslate transform, CoordSettings coordSettings, GridRemovalSettings gridRemovalSettings, PixelState pxState) { if (transform.ValidAxes) { List <GridlineScreen> gridlines; gridlines = NuGenGridMesh.MakeGridLines(transform, coordSettings, gridRemovalSettings.gridMesh); foreach (GridlineScreen gridline in gridlines) { int xStart = gridline.Start.X; int yStart = gridline.Start.Y; int xStop = gridline.Stop.X; int yStop = gridline.Stop.Y; if (Math.Abs(xStop - xStart) < Math.Abs(yStop - yStart)) { //Vertical lines RemoveGridlineVertical(pixels, xStart, yStart, xStop, yStop, gridRemovalSettings, pxState); } else { //Horizontal lines RemoveGridlineHorizontal(pixels, xStart, yStart, xStop, yStop, gridRemovalSettings, pxState); } } } }
private static List <GridlineScreen> MakeGridTheta(NuGenScreenTranslate transform, CoordSettings coordSettings, GridMeshSettings gridMeshSettings) { int i; int xStartS, yStartS, xStopS, yStopS; double thetaG = gridMeshSettings.startX; GridlineScreen gridline; List <GridlineScreen> gridlines = new List <GridlineScreen>(); for (i = 0; i < gridMeshSettings.countX; i++) { transform.XThetaYRToScreen(coordSettings, thetaG, gridMeshSettings.startY, out xStartS, out yStartS); transform.XThetaYRToScreen(coordSettings, thetaG, gridMeshSettings.stopY, out xStopS, out yStopS); gridline.Start.X = xStartS; gridline.Start.Y = yStartS; gridline.Stop.X = xStopS; gridline.Stop.Y = yStopS; gridline.R = false; thetaG += gridMeshSettings.stepX; gridlines.Add(gridline); //Maybe not? } return(gridlines); }
private static List <GridlineScreen> MakeGridX(NuGenScreenTranslate transform, CoordSettings coordSettings, GridMeshSettings gridMeshSettings) { int i; int xStartS, yStartS, xStopS, yStopS; double xG = gridMeshSettings.startX; GridlineScreen gridline; List <GridlineScreen> gridlines = new List <GridlineScreen>(); for (i = 0; i < gridMeshSettings.countX; i++) { gridline = new GridlineScreen(); transform.XThetaYRToScreen(coordSettings, xG, gridMeshSettings.startY, out xStartS, out yStartS); transform.XThetaYRToScreen(coordSettings, xG, gridMeshSettings.stopY, out xStopS, out yStopS); gridline.Start.X = xStartS; gridline.Start.Y = yStartS; gridline.Stop.X = xStopS; gridline.Stop.Y = yStopS; gridline.R = false; gridlines.Add(gridline); if (coordSettings.xThetaScale == Scale.Linear) { xG += gridMeshSettings.stepX; } else { xG *= gridMeshSettings.stepX; } } return(gridlines); }
public GridRemovalSettingsDialog(NuGenDocument doc) { this.settings = doc.GridRemovalSettings; this.originalImage = doc.OriginalImage; this.discretizeSettings = doc.DiscretizeSettings; this.transform = doc.Transform; this.bgColor = doc.BackgroundColor; this.coordSettings = doc.CoordSettings; if (doc.ValidAxes) this.gridRemovalMesh = doc.GridDisplaySettings; else this.gridRemovalMesh.initialized = false; discretizeSettings.discretizeMethod = DiscretizeMethod.DiscretizeForeground; InitializeComponent(); InitializeDefaults(); if (!(doc.ValidAxes || doc.ValidScale)) { textBox1.Enabled = false; textBox2.Enabled = false; checkBox2.Enabled = false; checkBox2.Checked = false; checkBox3.Enabled = false; checkBox3.Checked = false; } histogram.ValueChanged = this.ValueChanged; ValueChanged(true); this.MaximumSize = Size; }
// return bounds on the coordinates for just axis, or all, pointsets, and true if // there were any coordinates public bool AxisSetGraphLimits(CoordSettings coord, NuGenScreenTranslate transform, ref double xThetaMin, ref double xThetaMax, ref double yRMin, ref double yRMax) { UpdateGraphCoordinates(coord, transform); // get limits return(axesPointSet.PointSetGraphLimits(ref xThetaMin, ref xThetaMax, ref yRMin, ref yRMax)); }
private static List <GridlineScreen> MakeGridR(NuGenScreenTranslate transform, CoordSettings coordSettings, GridMeshSettings gridMeshSettings) { int i; int xStartS = 0, yStartS = 0, xStopS = 1, yStopS = 1; double rG = gridMeshSettings.startY; GridlineScreen gridline; List <GridlineScreen> gridlines = new List <GridlineScreen>(); for (i = 0; i < gridMeshSettings.countY; i++) { gridline = new GridlineScreen(); // for polar coordinates we simply piecewise define the elliptical arc until motivated // to implement a better drawing algorithm. segments will be evenly spaced in angle // some pdf documents describing alternative algorithms are found in the doc directory. // it would have been elegant to use QCanvasEllipses but those are axis-aligned. double delta = AngleSpacing(coordSettings.thetaUnits); bool first = true; for (double angle = gridMeshSettings.startX; angle < gridMeshSettings.stopX; angle += delta) { transform.XThetaYRToScreen(coordSettings, angle, rG, out xStopS, out yStopS); if (first) { xStartS = xStopS; yStartS = yStopS; } else { if (NuGenMath.VectorMagnitude(xStopS - xStartS, yStopS - yStartS, 0.0) >= pixelSpacing) { gridline.Start.X = xStartS; gridline.Start.Y = yStartS; gridline.Stop.X = xStopS; gridline.Stop.Y = yStopS; gridline.R = true; xStartS = xStopS; yStartS = yStopS; } } first = false; } if (coordSettings.yRScale == Scale.Linear) { rG += gridMeshSettings.stepY; } else { rG *= gridMeshSettings.stepY; } } return(gridlines); }
// apply the transformation to set graph coordinates of the points in the curve and measure pointsets public void UpdateGraphCoordinates(CoordSettings coord, NuGenScreenTranslate transform) { foreach (NuGenPoint point in points) { double xTheta, yR; transform.ScreenToXThetaYR(coord, point.XScreen, point.YScreen, out xTheta, out yR); point.XThetaGraph = xTheta; point.YRGraph = yR; } }
private void InitializeThin(CoordSettings coordSettings, NuGenScreenTranslate transform, double thinThickness) { transform.XBasisScreen(coordSettings, out xBasisXS, out xBasisYS); transform.YBasisScreen(coordSettings, out yBasisXS, out yBasisYS); // initialize search patterns InitializeThinSearch(thinThickness, xBasisXS, yBasisXS, searchPatternPlusX); InitializeThinSearch(thinThickness, xBasisYS, yBasisYS, searchPatternPlusY); InitializeThinSearch(thinThickness, -xBasisXS, yBasisXS, searchPatternMinusX); InitializeThinSearch(thinThickness, xBasisYS, -yBasisYS, searchPatternMinusY); }
// for curve pointsets connected as Single Valued Functions, since the graph coordinates // of all points are updated, we must reconnect any points that were reordered. remember, // a single valued function has only a single value per xTheta value, so the lines cannot overlap public void ForceSingleValued(CoordSettings coord, NuGenScreenTranslate transform) { // quick exit if pointset is a closed contour, which is the case for all axis, scale and // measure pointsets. curve pointsets may be either single valued functions, or closed contours if (style.lineConnectAs != LineConnectAs.SingleValuedFunction) { return; } // quick exit if points are already in order if (SingleValued(coord, transform)) { return; } Comparison <NuGenPoint> comparison = new Comparison <NuGenPoint>(this.XThetaSort); // sort the points by xTheta points.Sort(comparison); // to prevent having to remove N lines and then immediately adding N lines, we only // adjust as many lines as necessary NuGenPoint pOld = points[points.Count - 1]; NuGenPoint pOlder = null; foreach (NuGenPoint pNew in points) { if (pOlder != null) { if ((pOlder.NextLine != pNew.PreviousLine) || (pNew.PreviousLine == null)) { if (pOlder.NextLine == null) { pOlder.NextLine = pOld.NextLine; pOld.NextLine = null; } pOlder.NextLine.start.X = pOlder.XScreen; pOlder.NextLine.start.Y = pOlder.YScreen; pOlder.NextLine.end.X = pNew.XScreen; pOlder.NextLine.end.Y = pNew.YScreen; pNew.PreviousLine = pOlder.NextLine; } } else { pNew.PreviousLine = null; } pOlder = pNew; } }
private static List<GridlineScreen> MakeGridR(NuGenScreenTranslate transform, CoordSettings coordSettings, GridMeshSettings gridMeshSettings) { int i; int xStartS = 0, yStartS = 0, xStopS = 1, yStopS = 1; double rG = gridMeshSettings.startY; GridlineScreen gridline; List<GridlineScreen> gridlines = new List<GridlineScreen>(); for (i = 0; i < gridMeshSettings.countY; i++) { gridline = new GridlineScreen(); // for polar coordinates we simply piecewise define the elliptical arc until motivated // to implement a better drawing algorithm. segments will be evenly spaced in angle // some pdf documents describing alternative algorithms are found in the doc directory. // it would have been elegant to use QCanvasEllipses but those are axis-aligned. double delta = AngleSpacing(coordSettings.thetaUnits); bool first = true; for (double angle = gridMeshSettings.startX; angle < gridMeshSettings.stopX; angle += delta) { transform.XThetaYRToScreen(coordSettings, angle, rG, out xStopS, out yStopS); if (first) { xStartS = xStopS; yStartS = yStopS; } else { if (NuGenMath.VectorMagnitude(xStopS - xStartS, yStopS - yStartS, 0.0) >= pixelSpacing) { gridline.Start.X = xStartS; gridline.Start.Y = yStartS; gridline.Stop.X = xStopS; gridline.Stop.Y = yStopS; gridline.R = true; xStartS = xStopS; yStartS = yStopS; } } first = false; } if (coordSettings.yRScale == Scale.Linear) rG += gridMeshSettings.stepY; else rG *= gridMeshSettings.stepY; } return gridlines; }
// apply the transformation to set graph coordinates of the points in the curves and // measures. if the operation could cause points to be reordered to keep a curve // single-valued then the optional update list should be used public void UpdateGraphCoordinates(CoordSettings coord, NuGenScreenTranslate transform) { // apply transformation foreach (NuGenPointSet pointSet in curveList) { pointSet.UpdateGraphCoordinates(coord, transform); pointSet.ForceSingleValued(coord, transform); } foreach (NuGenPointSet pointSet in measureList) { pointSet.UpdateGraphCoordinates(coord, transform); } }
// true if pointset is single valued private bool SingleValued(CoordSettings coord, NuGenScreenTranslate transform) { bool first = true; double xThetaLast = 0.0, xTheta, yR; foreach (NuGenPoint point in points) { transform.ScreenToXThetaYR(coord, point.XScreen, point.YScreen, out xTheta, out yR); if (!first && (xTheta < xThetaLast)) { return(false); } xThetaLast = xTheta; first = false; } return(true); }
public bool PointSetGraphLimits(CoordSettings coord, NuGenScreenTranslate transform, ref double xThetaMin, ref double xThetaMax, ref double yRMin, ref double yRMax) { // update and get axis limits bool first = AxisSetGraphLimits(coord, transform, ref xThetaMin, ref xThetaMax, ref yRMin, ref yRMax); SinglePointSetGraphLimits(scalePointSet, ref first, ref xThetaMin, ref xThetaMax, ref yRMin, ref yRMax); foreach (NuGenPointSet pointset in curveList) { SinglePointSetGraphLimits(pointset, ref first, ref xThetaMin, ref xThetaMax, ref yRMin, ref yRMax); } foreach (NuGenPointSet pointset in measureList) { SinglePointSetGraphLimits(pointset, ref first, ref xThetaMin, ref xThetaMax, ref yRMin, ref yRMax); } return(!first); }
//Makes gridlines from the given translation public static List<GridlineScreen> MakeGridLines(NuGenScreenTranslate transform, CoordSettings coordSettings, GridMeshSettings gridMeshSettings) { List<GridlineScreen> list = new List<GridlineScreen>(); if (transform.ValidAxes) { if (coordSettings.frame == ReferenceFrame.Cartesian) { list.AddRange(MakeGridX(transform, coordSettings, gridMeshSettings)); list.AddRange(MakeGridY(transform, coordSettings, gridMeshSettings)); return list; } else { list.AddRange(MakeGridTheta(transform, coordSettings, gridMeshSettings)); list.AddRange(MakeGridR(transform, coordSettings, gridMeshSettings)); return list; } } return list; }
//Makes gridlines from the given translation public static List <GridlineScreen> MakeGridLines(NuGenScreenTranslate transform, CoordSettings coordSettings, GridMeshSettings gridMeshSettings) { List <GridlineScreen> list = new List <GridlineScreen>(); if (transform.ValidAxes) { if (coordSettings.frame == ReferenceFrame.Cartesian) { list.AddRange(MakeGridX(transform, coordSettings, gridMeshSettings)); list.AddRange(MakeGridY(transform, coordSettings, gridMeshSettings)); return(list); } else { list.AddRange(MakeGridTheta(transform, coordSettings, gridMeshSettings)); list.AddRange(MakeGridR(transform, coordSettings, gridMeshSettings)); return(list); } } return(list); }
public GridRemovalSettingsDialog(NuGenDocument doc) { this.settings = doc.GridRemovalSettings; this.originalImage = doc.OriginalImage; this.discretizeSettings = doc.DiscretizeSettings; this.transform = doc.Transform; this.bgColor = doc.BackgroundColor; this.coordSettings = doc.CoordSettings; if (doc.ValidAxes) { this.gridRemovalMesh = doc.GridDisplaySettings; } else { this.gridRemovalMesh.initialized = false; } discretizeSettings.discretizeMethod = DiscretizeMethod.DiscretizeForeground; InitializeComponent(); InitializeDefaults(); if (!(doc.ValidAxes || doc.ValidScale)) { textBox1.Enabled = false; textBox2.Enabled = false; checkBox2.Enabled = false; checkBox2.Checked = false; checkBox3.Enabled = false; checkBox3.Checked = false; } histogram.ValueChanged = this.ValueChanged; ValueChanged(true); this.MaximumSize = Size; }
//Remove gridlines and reconnect gaps public void RemoveAndConnect(NuGenScreenTranslate transform, CoordSettings coordSettings, GridRemovalSettings gridRemovalSettings, Color bgColor) { int width = bmp.Width; int height = bmp.Height; PixelState[,] pixels = InitializePixels(); // 1) Color removal if (gridRemovalSettings.removeColor) { RemoveColor(pixels, gridRemovalSettings, PixelState.PixelOnRemovedStage1); } // 2) Remove pixels around gridlines if (gridRemovalSettings.removeGridlines && gridRemovalSettings.gridDistance > 0.0) { RemoveGridlines(pixels, transform, coordSettings, gridRemovalSettings, PixelState.PixelOnRemovedStage2); } // 3) Remove thin lines parallel to the axes if (gridRemovalSettings.removeThinLines && gridRemovalSettings.thinThickness > 0.0) { RemoveThinLines(pixels, coordSettings, transform, gridRemovalSettings.thinThickness, PixelState.PixelOnRemovedStage3, PixelState.PixelOnRemovedStage4); } // Reconnect the gaps created from the prior steps if (gridRemovalSettings.gapSeparation > 0.0) { ConnectNeuronsAcrossGaps(pixels, gridRemovalSettings.gapSeparation); } //Write the image SavePixels(pixels, bgColor); //Save the image discretize.SetImage(bmp); }
private static List<GridlineScreen> MakeGridTheta(NuGenScreenTranslate transform, CoordSettings coordSettings, GridMeshSettings gridMeshSettings) { int i; int xStartS, yStartS, xStopS, yStopS; double thetaG = gridMeshSettings.startX; GridlineScreen gridline; List<GridlineScreen> gridlines = new List<GridlineScreen>(); for (i = 0; i < gridMeshSettings.countX; i++) { transform.XThetaYRToScreen(coordSettings, thetaG, gridMeshSettings.startY, out xStartS, out yStartS); transform.XThetaYRToScreen(coordSettings, thetaG, gridMeshSettings.stopY, out xStopS, out yStopS); gridline.Start.X = xStartS; gridline.Start.Y = yStartS; gridline.Stop.X = xStopS; gridline.Stop.Y = yStopS; gridline.R = false; thetaG += gridMeshSettings.stepX; gridlines.Add(gridline); //Maybe not? } return gridlines; }
private static List<GridlineScreen> MakeGridX(NuGenScreenTranslate transform, CoordSettings coordSettings, GridMeshSettings gridMeshSettings) { int i; int xStartS, yStartS, xStopS, yStopS; double xG = gridMeshSettings.startX; GridlineScreen gridline; List<GridlineScreen> gridlines = new List<GridlineScreen>(); for (i = 0; i < gridMeshSettings.countX; i++) { gridline = new GridlineScreen(); transform.XThetaYRToScreen(coordSettings, xG, gridMeshSettings.startY, out xStartS, out yStartS); transform.XThetaYRToScreen(coordSettings, xG, gridMeshSettings.stopY, out xStopS, out yStopS); gridline.Start.X = xStartS; gridline.Start.Y = yStartS; gridline.Stop.X = xStopS; gridline.Stop.Y = yStopS; gridline.R = false; gridlines.Add(gridline); if (coordSettings.xThetaScale == Scale.Linear) xG += gridMeshSettings.stepX; else xG *= gridMeshSettings.stepX; } return gridlines; }
//Removes pixels around user defined gridlines private void RemoveGridlines(PixelState[,] pixels, NuGenScreenTranslate transform, CoordSettings coordSettings, GridRemovalSettings gridRemovalSettings, PixelState pxState) { if (transform.ValidAxes) { List<GridlineScreen> gridlines; gridlines = NuGenGridMesh.MakeGridLines(transform, coordSettings, gridRemovalSettings.gridMesh); foreach (GridlineScreen gridline in gridlines) { int xStart = gridline.Start.X; int yStart = gridline.Start.Y; int xStop = gridline.Stop.X; int yStop = gridline.Stop.Y; if (Math.Abs(xStop - xStart) < Math.Abs(yStop - yStart)) { //Vertical lines RemoveGridlineVertical(pixels, xStart, yStart, xStop, yStop, gridRemovalSettings, pxState); } else { //Horizontal lines RemoveGridlineHorizontal(pixels, xStart, yStart, xStop, yStop, gridRemovalSettings, pxState); } } } }
//Removes thin lines which are parallel to the user defined axes private void RemoveThinLines(PixelState[,] pixels, CoordSettings coordSettings, NuGenScreenTranslate transform, double thinThickness, PixelState pixelStateRemovedPass1, PixelState pixelStateRemovedPass2) { if (transform.ValidAxes) { InitializeThin(coordSettings, transform, thinThickness); // first pass erases the gridMeshSettings lines, except for the junctions EraseThinPixels(pixels, thinThickness, pixelStateRemovedPass1); // second pass erases the gridMeshSettings line junctions, which are little islands of on-pixels EraseThinPixels(pixels, thinThickness, pixelStateRemovedPass2); } }
// for curve pointsets connected as Single Valued Functions, since the graph coordinates // of all points are updated, we must reconnect any points that were reordered. remember, // a single valued function has only a single value per xTheta value, so the lines cannot overlap public void ForceSingleValued(CoordSettings coord, NuGenScreenTranslate transform) { // quick exit if pointset is a closed contour, which is the case for all axis, scale and // measure pointsets. curve pointsets may be either single valued functions, or closed contours if (style.lineConnectAs != LineConnectAs.SingleValuedFunction) return; // quick exit if points are already in order if (SingleValued(coord, transform)) return; Comparison<NuGenPoint> comparison = new Comparison<NuGenPoint>(this.XThetaSort); // sort the points by xTheta points.Sort(comparison); // to prevent having to remove N lines and then immediately adding N lines, we only // adjust as many lines as necessary NuGenPoint pOld = points[points.Count - 1]; NuGenPoint pOlder = null; foreach (NuGenPoint pNew in points) { if (pOlder != null) { if ((pOlder.NextLine != pNew.PreviousLine) || (pNew.PreviousLine == null)) { if (pOlder.NextLine == null) { pOlder.NextLine = pOld.NextLine; pOld.NextLine = null; } pOlder.NextLine.start.X = pOlder.XScreen; pOlder.NextLine.start.Y = pOlder.YScreen; pOlder.NextLine.end.X = pNew.XScreen; pOlder.NextLine.end.Y = pNew.YScreen; pNew.PreviousLine = pOlder.NextLine; } } else { pNew.PreviousLine = null; } pOlder = pNew; } }
// true if pointset is single valued private bool SingleValued(CoordSettings coord, NuGenScreenTranslate transform) { bool first = true; double xThetaLast = 0.0, xTheta, yR; foreach(NuGenPoint point in points) { transform.ScreenToXThetaYR(coord, point.XScreen, point.YScreen, out xTheta, out yR); if (!first && (xTheta < xThetaLast)) return false; xThetaLast = xTheta; first = false; } return true; }
//Deserialization constructor. public NuGenDocument(SerializationInfo info, StreamingContext ctxt) { backgroundSelection = (BackgroundSelection)info.GetValue("backgroundSelection", typeof(BackgroundSelection)); originalImage = (Image)info.GetValue("originalImage", typeof(Image)); title = (string)info.GetValue("title", typeof(string)); digitizeState = (DigitizeState)info.GetValue("digitizeState", typeof(DigitizeState)); currentCurveName = (string)info.GetValue("curveCmbText", typeof(string)); currentMeasureName = (string)info.GetValue("measureCmbText", typeof(string)); coordSettings.frame = (ReferenceFrame)info.GetValue("coordSettings.frame", typeof(ReferenceFrame)); coordSettings.thetaUnits = (ThetaUnits)info.GetValue("coordSettings.thetaUnits", typeof(ThetaUnits)); coordSettings.xThetaScale = (Scale)info.GetValue("coordSettings.xThetaScale", typeof(Scale)); coordSettings.yRScale = (Scale)info.GetValue("coordSettings.yRScale", typeof(Scale)); exportSettings.delimiters = (ExportDelimiters)info.GetValue("exportSettings.delimiters", typeof(ExportDelimiters)); exportSettings.layout = (ExportLayout)info.GetValue("exportSettings.layout", typeof(ExportLayout)); exportSettings.pointsSelection = (ExportPointsSelection)info.GetValue("exportSettings.pointsSelection", typeof(ExportPointsSelection)); exportSettings.header = (ExportHeader)info.GetValue("exportSettings.header", typeof(ExportHeader)); gridRemovalSettings.removeThinLines = (bool)info.GetValue("gridRemovalSettings.removeThinLines", typeof(bool)); gridRemovalSettings.thinThickness = (double)info.GetValue("gridRemovalSettings.thinThickness", typeof(double)); gridRemovalSettings.removeGridlines = (bool)info.GetValue("gridRemovalSettings.removeGridlines", typeof(bool)); gridRemovalSettings.gridMesh.initialized = (bool)info.GetValue("gridRemovalSettings.gridMesh.initialized", typeof(bool)); gridRemovalSettings.gridMesh.countX = (int)info.GetValue("gridRemovalSettings.gridMesh.countX", typeof(int)); gridRemovalSettings.gridMesh.countY = (int)info.GetValue("gridRemovalSettings.gridMesh.countY", typeof(int)); gridRemovalSettings.gridMesh.gridSetX = (GridSet)info.GetValue("gridRemovalSettings.gridMesh.gridSetX", typeof(GridSet)); gridRemovalSettings.gridMesh.gridSetY = (GridSet)info.GetValue("gridRemovalSettings.gridMesh.gridSetY", typeof(GridSet)); gridRemovalSettings.gridMesh.startX = (double)info.GetValue("gridRemovalSettings.gridMesh.startX", typeof(double)); gridRemovalSettings.gridMesh.startY = (double)info.GetValue("gridRemovalSettings.gridMesh.startY", typeof(double)); gridRemovalSettings.gridMesh.stepX = (double)info.GetValue("gridRemovalSettings.gridMesh.stepX", typeof(double)); gridRemovalSettings.gridMesh.stepY = (double)info.GetValue("gridRemovalSettings.gridMesh.stepY", typeof(double)); gridRemovalSettings.gridMesh.stopX = (double)info.GetValue("gridRemovalSettings.gridMesh.stopX", typeof(double)); gridRemovalSettings.gridMesh.stopY = (double)info.GetValue("gridRemovalSettings.gridMesh.stopY", typeof(double)); gridRemovalSettings.gridDistance = (double)info.GetValue("gridRemovalSettings.gridDistance", typeof(double)); gridRemovalSettings.removeColor = (bool)info.GetValue("gridRemovalSettings.removeColor", typeof(bool)); gridRemovalSettings.color = (Color)info.GetValue("gridRemovalSettings.color", typeof(Color)); gridRemovalSettings.foregroundThresholdLow = (int)info.GetValue("gridRemovalSettings.foregroundThresholdLow", typeof(int)); gridRemovalSettings.foregroundThresholdHigh = (int)info.GetValue("gridRemovalSettings.foregroundThresholdHigh", typeof(int)); gridRemovalSettings.gapSeparation = (double)info.GetValue("gridRemovalSettings.gapSeparation", typeof(double)); gridDisplaySettings.initialized = (bool)info.GetValue("gridDisplaySettings.initialized", typeof(bool)); gridDisplaySettings.countX = (int)info.GetValue("gridDisplaySettings.countX", typeof(int)); gridDisplaySettings.countY = (int)info.GetValue("gridDisplaySettings.countY", typeof(int)); gridDisplaySettings.gridSetX = (GridSet)info.GetValue("gridDisplaySettings.gridSetX", typeof(GridSet)); gridDisplaySettings.gridSetY = (GridSet)info.GetValue("gridDisplaySettings.gridSetY", typeof(GridSet)); gridDisplaySettings.startX = (double)info.GetValue("gridDisplaySettings.startX", typeof(double)); gridDisplaySettings.startY = (double)info.GetValue("gridDisplaySettings.startY", typeof(double)); gridDisplaySettings.stepX = (double)info.GetValue("gridDisplaySettings.stepX", typeof(double)); gridDisplaySettings.stepY = (double)info.GetValue("gridDisplaySettings.stepY", typeof(double)); gridDisplaySettings.stopX = (double)info.GetValue("gridDisplaySettings.stopX", typeof(double)); gridDisplaySettings.stopY = (double)info.GetValue("gridDisplaySettings.stopY", typeof(double)); segmentSettings.minPoints = (int)info.GetValue("segmentSettings.minPoints", typeof(int)); segmentSettings.pointSeparation = (int)info.GetValue("segmentSettings.pointSeparation", typeof(int)); segmentSettings.lineSize = (LineSize)info.GetValue("segmentSettings.lineSize", typeof(LineSize)); segmentSettings.lineColor = (Color)info.GetValue("segmentSettings.lineColor", typeof(Color)); pointMatchSettings.pointSeparation = (int)info.GetValue("pointMatchSettings.pointSeparation", typeof(int)); pointMatchSettings.pointSize = (int)info.GetValue("pointMatchSettings.pointSize", typeof(int)); pointMatchSettings.acceptedColor = (Color)info.GetValue("pointMatchSettings.acceptedColor", typeof(Color)); pointMatchSettings.rejectedColor = (Color)info.GetValue("pointMatchSettings.rejectedColor", typeof(Color)); discretizeSettings.discretizeMethod = (DiscretizeMethod)info.GetValue("discretizeSettings.discretizeMethod", typeof(DiscretizeMethod)); discretizeSettings.intensityThresholdLow = (int)info.GetValue("discretizeSettings.intensityThresholdLow", typeof(int)); discretizeSettings.intensityThresholdHigh = (int)info.GetValue("discretizeSettings.intensityThresholdHigh", typeof(int)); discretizeSettings.foregroundThresholdLow = (int)info.GetValue("discretizeSettings.foregroundThresholdLow", typeof(int)); discretizeSettings.foregroundThresholdHigh = (int)info.GetValue("discretizeSettings.foregroundThresholdHigh", typeof(int)); discretizeSettings.hueThresholdLow = (int)info.GetValue("discretizeSettings.hueThresholdLow", typeof(int)); discretizeSettings.hueThresholdHigh = (int)info.GetValue("discretizeSettings.hueThresholdHigh", typeof(int)); discretizeSettings.saturationThresholdLow = (int)info.GetValue("discretizeSettings.saturationThresholdLow", typeof(int)); discretizeSettings.saturationThresholdHigh = (int)info.GetValue("discretizeSettings.saturationThresholdHigh", typeof(int)); discretizeSettings.valueThresholdLow = (int)info.GetValue("discretizeSettings.valueThresholdLow", typeof(int)); discretizeSettings.valueThresholdHigh = (int)info.GetValue("discretizeSettings.valueThresholdHigh", typeof(int)); pointSets = new NuGenPointSetCollection(); PointSets.SerializeRead(info); saveFileExists = true; dirtyAxesTransformation = true; dirtyScaleTransformation = true; listeners = new List <NuGenImageListener>(); segments = new NuGenSegmentCollection(); transform = new NuGenScreenTranslate(this); gridDisplay = new List <GridlineScreen>(); matchSet = new NuGenMatchSet(pointMatchSettings); ProcessOriginialImage(); }