Exemple #1
0
        public FindTransitionInstance(FindTransitionDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            if (theDefinition.SourceImage == null)
            {
                throw new ArgumentException(Name + " doesn't have SourceImage defined.");
            }
            mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name);

            if (theDefinition.SearchArea == null)
            {
                throw new ArgumentException(Name + " doesn't have SearchArea defined.");
            }
            ROIInstance theROI = testExecution.ROIRegistry.GetObject(theDefinition.SearchArea.Name);

            if (!(theROI is IRectangleROIInstance))
            {
                throw new ArgumentException(Name + " requires a rectangle ROI for its SearchArea. " + theROI.Name + " isn't a rectangle.");
            }
            mSearchArea = (IRectangleROIInstance)theROI;

            if (theDefinition.SearchDirection == Direction.NotDefined)
            {
                throw new ArgumentException(Name + " doesn't have SearchDirection defined.");
            }
            mSearchDirection = theDefinition.SearchDirection;

            //if (theDefinition.TransitionDetectionMode == FindTransitionDefinition.TransitionDetectionModes.NotDefined) throw new ArgumentException(Name + " doesn't have TransitionDetectionMode defined.");
            //mTransitionDetectionMode = theDefinition.TransitionDetectionMode;

            mTransitionTypeSelectionFilter = theDefinition.TransitionTypeSelectionFilter;

            if (theDefinition.TransitionThreshold_Min == null)
            {
                throw new ArgumentException(Name + " doesn't have SurfaceNoiseThreshold_Min defined.");
            }
            mSurfaceNoiseThreshold_Min = testExecution.DataValueRegistry.GetObject(theDefinition.TransitionThreshold_Min.Name);

            //if (theDefinition.SurfaceNoiseThreshold_PercentOfSharpestTransition == null) throw new ArgumentException(Name + " doesn't have SurfaceNoiseThreshold_PercentOfSharpestTransition defined.");
            //mSurfaceNoiseThreshold_PercentOfSharpestTransition = testExecution.DataValueRegistry.GetObject(theDefinition.SurfaceNoiseThreshold_PercentOfSharpestTransition.Name);

            mTransitionMarker = new ValueBasedLineDecorationInstance(theDefinition.TransitionMarker, testExecution);

            mTransitionLocation = new GeneratedValueInstance(theDefinition.TransitionLocation, testExecution);

            if (theDefinition.TransitionScore != null)
            {
                mTransitionScore = new GeneratedValueInstance(theDefinition.TransitionScore, testExecution);
            }

            mAutoSave      = theDefinition.AutoSave;
            mVerboseOutput = theDefinition.VerboseOutput;
        }
Exemple #2
0
        public FindEdgeOriginalInstance(FindEdgeOriginalDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            if (theDefinition.SourceImage == null)
            {
                throw new ArgumentException(Name + " doesn't have SourceImage defined.");
            }
            mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name);

            if (theDefinition.SearchArea == null)
            {
                throw new ArgumentException(Name + " doesn't have SearchArea defined.");
            }
            ROIInstance theROI = testExecution.ROIRegistry.GetObject(theDefinition.SearchArea.Name);

            if (!(theROI is IRectangleROIInstance))
            {
                throw new ArgumentException(Name + " requires a rectangle ROI for its SearchArea. " + theROI.Name + " isn't a rectangle.");
            }
            mSearchArea = (IRectangleROIInstance)theROI;

            if (theDefinition.SearchDirection == Direction.NotDefined)
            {
                throw new ArgumentException(Name + " doesn't have SearchDirection defined.");
            }
            mSearchDirection = theDefinition.SearchDirection;

            if (theDefinition.EdgeDetectionMode == FindEdgeOriginalDefinition.EdgeDetectionModes.NotDefined)
            {
                throw new ArgumentException(Name + " doesn't have EdgeDetectionMode defined.");
            }
            mEdgeDetectionMode = theDefinition.EdgeDetectionMode;

            if (theDefinition.SurfaceNoiseThreshold == null)
            {
                throw new ArgumentException(Name + " doesn't have SurfaceNoiseThreshold defined.");
            }
            mSurfaceNoiseThreshold = testExecution.DataValueRegistry.GetObject(theDefinition.SurfaceNoiseThreshold.Name);

            if (theDefinition.MinSurfaceSize == null)
            {
                throw new ArgumentException(Name + " doesn't have MinSurfaceSize defined.");
            }
            mMinSurfaceSize = testExecution.DataValueRegistry.GetObject(theDefinition.MinSurfaceSize.Name);

            mEdgeMarker = new ValueBasedLineDecorationInstance(theDefinition.EdgeMarker, testExecution);

            mEdgeLocation = new GeneratedValueInstance(theDefinition.EdgeLocation, testExecution);

            mAutoSave = theDefinition.AutoSave;
        }
        public FindRadialLineInstance(FindRadialLineDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            if (theDefinition.SourceImage == null)
            {
                throw new ArgumentException(Name + " doesn't have SourceImage defined.");
            }
            mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name);

            if (theDefinition.CenterX == null)
            {
                throw new ArgumentException(Name + " doesn't have CenterX defined.");
            }
            mCenterX = testExecution.DataValueRegistry.GetObject(theDefinition.CenterX.Name);

            if (theDefinition.CenterY == null)
            {
                throw new ArgumentException(Name + " doesn't have CenterY defined.");
            }
            mCenterY = testExecution.DataValueRegistry.GetObject(theDefinition.CenterY.Name);

            if (theDefinition.NumberOfTestsInDonut == null)
            {
                throw new ArgumentException(Name + " doesn't have NumberOfTestsInDonut defined.");
            }
            mNumberOfTestsInDonut = testExecution.DataValueRegistry.GetObject(theDefinition.NumberOfTestsInDonut.Name);

            if (theDefinition.OuterSearchRadius == null)
            {
                throw new ArgumentException(Name + " doesn't have OuterSearchRadius defined.");
            }
            mOuterSearchRadius = testExecution.DataValueRegistry.GetObject(theDefinition.OuterSearchRadius.Name);

            if (theDefinition.InnerSearchRadius == null)
            {
                throw new ArgumentException(Name + " doesn't have InnerSearchRadius defined.");
            }
            mInnerSearchRadius = testExecution.DataValueRegistry.GetObject(theDefinition.InnerSearchRadius.Name);

            if (theDefinition.MarkMergeDistance_Deg == null)
            {
                throw new ArgumentException(Name + " doesn't have MarkMergeDistance_Deg defined.");
            }
            mMarkMergeDistance_Deg = testExecution.DataValueRegistry.GetObject(theDefinition.MarkMergeDistance_Deg.Name);

            /*
             * if (theDefinition.OuterSearchBounds == null) throw new ArgumentException(Name + " doesn't have OuterSearchBounds defined.");
             * mOuterSearchBounds = testExecution.GetCircleDecoration(theDefinition.OuterSearchBounds.Name);
             *
             * if (theDefinition.InnerSearchBounds == null) throw new ArgumentException(Name + " doesn't have InnerSearchBounds defined.");
             * mInnerSearchBounds = testExecution.GetCircleDecoration(theDefinition.InnerSearchBounds.Name);
             */

            mOuterSearchBounds = new CircleDecorationInstance(theDefinition.OuterSearchBounds, testExecution);
            mInnerSearchBounds = new CircleDecorationInstance(theDefinition.InnerSearchBounds, testExecution);

            mResultantAngle = new GeneratedValueInstance(theDefinition.ResultantAngle, testExecution);
            mResultantRay   = new ValueBasedLineDecorationInstance(theDefinition.ResultantRay, testExecution);

            mAutoSave          = theDefinition.AutoSave;
            mCreateMarkedImage = theDefinition.CreateMarkedImage;
            mMarkColor         = theDefinition.MarkColor;
            if (theDefinition.ImageToMark != null)
            {
                mImageToMark = testExecution.ImageRegistry.GetObject(theDefinition.ImageToMark.Name);
            }
        }