Пример #1
0
        //Matches a point on the screen with the sample match pixels
        public bool MatchSamplePoint(Point p)
        {
            bool found = false;

            foreach (Point sample in samplePointPixels)
            {
                if (sample.X == p.X && sample.Y == p.Y)
                {
                    found = true;
                }
            }

            if (!found)
            {
                return(false);
            }

            List <Point> pointsExisting = PointSets.CurveCoordinates(currentCurveName);

            List <PointMatchTriplet> pointsCreated = new List <PointMatchTriplet>();

            NuGenPointMatch.MatchSamplePoint(processedImage, pointMatchSettings,
                                             samplePointPixels, pointsExisting, pointsCreated);

            if (pointsCreated.Count < 1)
            {
                MessageBox.Show("No points successfully matched the sample point!\nSkipping the matching of sample points using arrow keys", "Point Match Error!");
            }
            else
            {
                matchSet.AddCreatedPoints(pointsCreated, p);
            }

            return(true);
        }
Пример #2
0
        // add axis or curve point, depending on state. axis point graph coordinates are set later by
        // setAxisPoint so user can see where the new axis point lies while editing the graph coordinatees
        public NuGenPoint AddPoint(int xScreen, int yScreen, NuGenPointSet destination)
        {
            double xThetaGraph = 0.0, yRGraph = 0.0;

            NuGenPoint p;

            if ((digitizeState == DigitizeState.CurveState) ||
                (digitizeState == DigitizeState.MeasureState))
            {
                ScreenToXThetaYR(xScreen, yScreen, out xThetaGraph, out yRGraph);

                p = new NuGenPoint(xScreen, yScreen, xThetaGraph, yRGraph);
            }
            else
            {
                p = new NuGenPoint(xScreen, yScreen);
            }

            switch (digitizeState)
            {
            case DigitizeState.AxisState:
                dirtyAxesTransformation = true;
                pointSets.AddPointAxes(p);
                break;

            case DigitizeState.CurveState:
            case DigitizeState.SegmentState:
                pointSets.AddPointCurve(p, currentCurveName);
                break;

            case DigitizeState.MeasureState:
                pointSets.AddPointMeasure(p, currentMeasureName);
                break;

            case DigitizeState.ScaleState:
                dirtyScaleTransformation = true;
                pointSets.AddPointScale(p);
                break;

            case DigitizeState.SelectState:     //Could be any type of point, so decide
                if (destination != null)
                {
                    destination.AddPoint(p);
                }
                break;
            }

            PointSets.UpdateGraphCoordinates(coordSettings, transform);

            return(p);
        }
Пример #3
0
 public void UpdateGraphCoordinates()
 {
     PointSets.UpdateGraphCoordinates(coordSettings, transform);
 }
Пример #4
0
        //Serialization function.
        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("backgroundSelection", this.backgroundSelection);
            info.AddValue("originalImage", this.originalImage);

            info.AddValue("title", this.title);

            info.AddValue("digitizeState", this.digitizeState);

            info.AddValue("curveCmbText", this.currentCurveName);
            info.AddValue("measureCmbText", this.currentMeasureName);

            info.AddValue("coordSettings.frame", this.coordSettings.frame);
            info.AddValue("coordSettings.thetaUnits", this.coordSettings.thetaUnits);
            info.AddValue("coordSettings.xThetaScale", this.coordSettings.xThetaScale);
            info.AddValue("coordSettings.yRScale", this.coordSettings.yRScale);

            info.AddValue("exportSettings.delimiters", this.exportSettings.delimiters);
            info.AddValue("exportSettings.layout", this.exportSettings.layout);
            info.AddValue("exportSettings.pointsSelection", this.exportSettings.pointsSelection);
            info.AddValue("exportSettings.header", this.exportSettings.header);

            info.AddValue("gridRemovalSettings.removeThinLines", this.gridRemovalSettings.removeThinLines);
            info.AddValue("gridRemovalSettings.thinThickness", this.gridRemovalSettings.thinThickness);
            info.AddValue("gridRemovalSettings.removeGridlines", this.gridRemovalSettings.removeGridlines);
            info.AddValue("gridRemovalSettings.gridMesh.initialized", this.gridRemovalSettings.gridMesh.initialized);
            info.AddValue("gridRemovalSettings.gridMesh.countX", this.gridRemovalSettings.gridMesh.countX);
            info.AddValue("gridRemovalSettings.gridMesh.countY", this.gridRemovalSettings.gridMesh.countY);
            info.AddValue("gridRemovalSettings.gridMesh.gridSetX", this.gridRemovalSettings.gridMesh.gridSetX);
            info.AddValue("gridRemovalSettings.gridMesh.gridSetY", this.gridRemovalSettings.gridMesh.gridSetY);
            info.AddValue("gridRemovalSettings.gridMesh.startX", this.gridRemovalSettings.gridMesh.startX);
            info.AddValue("gridRemovalSettings.gridMesh.startY", this.gridRemovalSettings.gridMesh.startY);
            info.AddValue("gridRemovalSettings.gridMesh.stepX", this.gridRemovalSettings.gridMesh.stepX);
            info.AddValue("gridRemovalSettings.gridMesh.stepY", this.gridRemovalSettings.gridMesh.stepY);
            info.AddValue("gridRemovalSettings.gridMesh.stopX", this.gridRemovalSettings.gridMesh.stopX);
            info.AddValue("gridRemovalSettings.gridMesh.stopY", this.gridRemovalSettings.gridMesh.stopY);
            info.AddValue("gridRemovalSettings.gridDistance", this.gridRemovalSettings.gridDistance);
            info.AddValue("gridRemovalSettings.removeColor", this.gridRemovalSettings.removeColor);
            info.AddValue("gridRemovalSettings.color", this.gridRemovalSettings.color);
            info.AddValue("gridRemovalSettings.foregroundThresholdLow", this.gridRemovalSettings.foregroundThresholdLow);
            info.AddValue("gridRemovalSettings.foregroundThresholdHigh", this.gridRemovalSettings.foregroundThresholdHigh);
            info.AddValue("gridRemovalSettings.gapSeparation", this.gridRemovalSettings.gapSeparation);

            info.AddValue("gridDisplaySettings.initialized", this.gridDisplaySettings.initialized);
            info.AddValue("gridDisplaySettings.countX", this.gridDisplaySettings.countX);
            info.AddValue("gridDisplaySettings.countY", this.gridDisplaySettings.countY);
            info.AddValue("gridDisplaySettings.gridSetX", this.gridDisplaySettings.gridSetX);
            info.AddValue("gridDisplaySettings.gridSetY", this.gridDisplaySettings.gridSetY);
            info.AddValue("gridDisplaySettings.startX", this.gridDisplaySettings.startX);
            info.AddValue("gridDisplaySettings.startY", this.gridDisplaySettings.startY);
            info.AddValue("gridDisplaySettings.stepX", this.gridDisplaySettings.stepX);
            info.AddValue("gridDisplaySettings.stepY", this.gridDisplaySettings.stepY);
            info.AddValue("gridDisplaySettings.stopX", this.gridDisplaySettings.stopX);
            info.AddValue("gridDisplaySettings.stopY", this.gridDisplaySettings.stopY);

            info.AddValue("segmentSettings.minPoints", this.segmentSettings.minPoints);
            info.AddValue("segmentSettings.pointSeparation", this.segmentSettings.pointSeparation);
            info.AddValue("segmentSettings.lineSize", this.segmentSettings.lineSize);
            info.AddValue("segmentSettings.lineColor", this.segmentSettings.lineColor);

            info.AddValue("pointMatchSettings.pointSeparation", this.pointMatchSettings.pointSeparation);
            info.AddValue("pointMatchSettings.pointSize", this.pointMatchSettings.pointSize);
            info.AddValue("pointMatchSettings.acceptedColor", this.pointMatchSettings.acceptedColor);
            info.AddValue("pointMatchSettings.rejectedColor", this.pointMatchSettings.rejectedColor);

            info.AddValue("discretizeSettings.discretizeMethod", this.discretizeSettings.discretizeMethod);
            info.AddValue("discretizeSettings.intensityThresholdLow", this.discretizeSettings.intensityThresholdLow);
            info.AddValue("discretizeSettings.intensityThresholdHigh", this.discretizeSettings.intensityThresholdHigh);
            info.AddValue("discretizeSettings.foregroundThresholdLow", this.discretizeSettings.foregroundThresholdLow);
            info.AddValue("discretizeSettings.foregroundThresholdHigh", this.discretizeSettings.foregroundThresholdHigh);
            info.AddValue("discretizeSettings.hueThresholdLow", this.discretizeSettings.hueThresholdLow);
            info.AddValue("discretizeSettings.hueThresholdHigh", this.discretizeSettings.hueThresholdHigh);
            info.AddValue("discretizeSettings.saturationThresholdLow", this.discretizeSettings.saturationThresholdLow);
            info.AddValue("discretizeSettings.saturationThresholdHigh", this.discretizeSettings.saturationThresholdHigh);
            info.AddValue("discretizeSettings.valueThresholdLow", this.discretizeSettings.valueThresholdLow);
            info.AddValue("discretizeSettings.valueThresholdHigh", this.discretizeSettings.valueThresholdHigh);

            PointSets.SerializeWrite(info);
        }
Пример #5
0
        //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();
        }
Пример #6
0
 void OnEnable()
 {
     pcobject = new SerializedObject(target);
     pc       = (PointSets)target;
 }