Example #1
0
        public FindCenterOfColorOnLineInstance(FindCenterOfColorOnLineDefinition 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.SearchColorDefinition == null)
            {
                throw new ArgumentException(Name + " doesn't have ObjectColorDefinition defined.");
            }
            mSearchColorDefinition = testExecution.GetColorMatcher(theDefinition.SearchColorDefinition.Name);

            if (theDefinition.SearchPath == null)
            {
                throw new ArgumentException(Name + " doesn't have SearchPath defined.");
            }
            mSearchPath = testExecution.ObjectBasedLineDecorationRegistry.GetObject(theDefinition.SearchPath.Name);

            //if (theDefinition.RequiredConsecutiveColorMatches != null)
            //{
            //    mRequiredConsecutiveColorMatches = testExecution.DataValueRegistry.GetObject(theDefinition.RequiredConsecutiveColorMatches.Name);
            //}

            mResultX = new GeneratedValueInstance(theDefinition.ResultX, testExecution);
            mResultY = new GeneratedValueInstance(theDefinition.ResultY, testExecution);
        }
Example #2
0
        public ColorMatchCountInstance(ColorMatchCountDefinition 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.ColorMatchDefinition == null)
            {
                throw new ArgumentException(Name + " doesn't have ColorMatchDefinition defined.");
            }
            mColorMatcher = testExecution.GetColorMatcher(theDefinition.ColorMatchDefinition.Name);

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

            mResult = new GeneratedValueInstance(theDefinition.Result, testExecution);

            mCreateMarkedImage = theDefinition.CreateMarkedImage;
            mMarkColor         = theDefinition.MarkColor;
            if (theDefinition.ImageToMark != null)
            {
                mImageToMark = testExecution.ImageRegistry.GetObject(theDefinition.ImageToMark.Name);
            }
        }
        public ProximityCollectorWith2GridsScoreFilterInstance(ProximityCollectorWith2GridsScoreFilterDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            if (theDefinition.GridCellHeight == null)
            {
                throw new ArgumentException("Score Filter tool '" + theDefinition.Name + "' doesn't have a value assigned to GridHeight");
            }
            mGridCellHeight = testExecution.DataValueRegistry.GetObject(theDefinition.GridCellHeight.Name);

            if (theDefinition.GridCellWidth == null)
            {
                throw new ArgumentException("Score Filter tool '" + theDefinition.Name + "' doesn't have a value assigned to GridWidth");
            }
            mGridCellWidth = testExecution.DataValueRegistry.GetObject(theDefinition.GridCellWidth.Name);

            if (theDefinition.MinNumScoresRequired == null)
            {
                throw new ArgumentException("Score Filter tool '" + theDefinition.Name + "' doesn't have a value assigned to MinNumScoresRequired");
            }
            mMinNumScoresRequired = testExecution.DataValueRegistry.GetObject(theDefinition.MinNumScoresRequired.Name);

            if (theDefinition.MinScoreThreshold == null)
            {
                throw new ArgumentException("Score Filter tool '" + theDefinition.Name + "' doesn't have a value assigned to MinScoreThreshold");
            }
            mMinScoreThreshold = testExecution.DataValueRegistry.GetObject(theDefinition.MinScoreThreshold.Name);

            mMaxScore       = new GeneratedValueInstance(theDefinition.MaxScore, testExecution);
            mNumScoresInMax = new GeneratedValueInstance(theDefinition.NumScoresInMax, testExecution);

            mMaxDebugDetails = theDefinition.MaxDebugDetails;
        }
        public ColorMatchCountOverRectangleInstance(ColorMatchCountOverRectangleDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            // TODO: should this effort be part of the definition?
            mColorMatcher = testExecution.GetColorMatcher(theDefinition.ColorMatchDefinition.Name);
            ROIInstance theROI = testExecution.ROIRegistry.GetObject(theDefinition.ROI.Name);

            if (theROI is IRectangleROIInstance)
            {
                mROI = (IRectangleROIInstance)theROI;
            }
            else
            {
                throw new ArgumentException("ColorMatchCount currently only supports Rectangle ROIs.");
            }
            mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name);
            mResult      = new GeneratedValueInstance(theDefinition.Result, testExecution);

            mCreateMarkedImage = theDefinition.CreateMarkedImage;
            mMarkColor         = theDefinition.MarkColor;
            if (theDefinition.ImageToMark != null)
            {
                mImageToMark = testExecution.ImageRegistry.GetObject(theDefinition.ImageToMark.Name);
            }
        }
Example #5
0
        public PatternMatchOfAvgGrayVariationInstance(PatternMatchOfAvgGrayVariationDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            if (theDefinition.VariationThreshhold == null)
            {
                throw new ArgumentException("Pattern Match tool '" + theDefinition.Name + "' doesn't have a value assigned to VariationThreshhold");
            }
            mVariationThreshhold = testExecution.DataValueRegistry.GetObject(theDefinition.VariationThreshhold.Name);

            if (theDefinition.Sloppiness == null)
            {
                throw new ArgumentException("Pattern Match tool '" + theDefinition.Name + "' doesn't have a value assigned to Sloppiness");
            }
            mSloppiness = testExecution.DataValueRegistry.GetObject(theDefinition.Sloppiness.Name);

            if (theDefinition.MinWindow == null)
            {
                throw new ArgumentException("Pattern Match tool '" + theDefinition.Name + "' doesn't have a value assigned to MinWindow");
            }
            mMinWindow = testExecution.DataValueRegistry.GetObject(theDefinition.MinWindow.Name);

            if (theDefinition.BrightPixelFactor == null)
            {
                throw new ArgumentException("Pattern Match tool '" + theDefinition.Name + "' doesn't have a value assigned to BrightPixelFactor");
            }
            mBrightPixelFactor = testExecution.DataValueRegistry.GetObject(theDefinition.BrightPixelFactor.Name);

            if (theDefinition.DarkPixelFactor == null)
            {
                throw new ArgumentException("Pattern Match tool '" + theDefinition.Name + "' doesn't have a value assigned to DarkPixelFactor");
            }
            mDarkPixelFactor = testExecution.DataValueRegistry.GetObject(theDefinition.DarkPixelFactor.Name);

            if (theDefinition.ROI == null)
            {
                throw new ArgumentException("Pattern Match tool '" + theDefinition.Name + "' doesn't have an ROI assigned");
            }
            mROI = testExecution.ROIRegistry.GetObject(theDefinition.ROI.Name);

            if (theDefinition.SourceImage == null)
            {
                throw new ArgumentException("Pattern Match tool '" + theDefinition.Name + "' doesn't have an image assigned to SourceImage");
            }
            mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name);

            mDeepAnalysisEnabled = theDefinition.DeepAnalysisEnabled;
            mDeepAnalysisTop     = theDefinition.DeepAnalysisTop;
            mDeepAnalysisBottom  = theDefinition.DeepAnalysisBottom;
            mDeepAnalysisRight   = theDefinition.DeepAnalysisRight;
            mDeepAnalysisLeft    = theDefinition.DeepAnalysisLeft;

            mResult = new GeneratedValueInstance(theDefinition.Result, testExecution);

            mCreateMarkedImage = theDefinition.CreateMarkedImage;
            if (mCreateMarkedImage)
            {
                mMarkedImage = new GeneratedImageInstance(theDefinition.MarkedImage, testExecution);
            }
            mMarkColor = theDefinition.MarkColor;
        }
        public FindBrightestSpotInstance(FindBrightestSpotDefinition 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.ROI == null)
            {
                throw new ArgumentException(Name + " doesn't have ROI defined.");
            }
            mROI = testExecution.ROIRegistry.GetObject(theDefinition.ROI.Name);

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

            mBrightSpot_X = new GeneratedValueInstance(theDefinition.BrightSpot_X, testExecution);
            mBrightSpot_Y = new GeneratedValueInstance(theDefinition.BrightSpot_Y, testExecution);

            mAutoSave = theDefinition.AutoSave;
        }
        public MeasurementToolInstance(MeasurementToolDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            if (theDefinition.ReferencePoint1 == null)
            {
                throw new ArgumentException(Name + " doesn't have ReferencePoint1 defined.");
            }
            mReferencePoint1 = testExecution.ReferencePointRegistry.GetObject(theDefinition.ReferencePoint1.Name);

            if (theDefinition.ReferencePoint2 == null)
            {
                throw new ArgumentException(Name + " doesn't have ReferencePoint2 defined.");
            }
            mReferencePoint2 = testExecution.ReferencePointRegistry.GetObject(theDefinition.ReferencePoint2.Name);

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

            if (theDefinition.Ensure1Before2 != null)
            {
                mEnsure1Before2 = testExecution.DataValueRegistry.GetObject(theDefinition.Ensure1Before2.Name);
            }

            mDistance = new GeneratedValueInstance(theDefinition.Distance, testExecution);
            if (theDefinition.Distance_pixels != null)
            {
                mDistance_pixels = new GeneratedValueInstance(theDefinition.Distance_pixels, testExecution);
            }
        }
Example #8
0
        public IntensityVariationOverRectangleInstance(IntensityVariationOverRectangleDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            if (theDefinition.VariationThreshhold == null)
            {
                throw new ArgumentException("Intensity Variation tool '" + theDefinition.Name + "' doesn't have a value assigned to VariationThreshhold");
            }
            mVariationThreshhold = testExecution.DataValueRegistry.GetObject(theDefinition.VariationThreshhold.Name);
            mTestXAxis           = theDefinition.TestXAxis;
            mTestYAxis           = theDefinition.TestYAxis;
            ROIInstance theROI = testExecution.ROIRegistry.GetObject(theDefinition.ROI.Name);

            if (theROI is IRectangleROIInstance)
            {
                mROI = (IRectangleROIInstance)theROI;
            }
            else
            {
                throw new ArgumentException("IntensityVariation currently only supports Rectangle ROIs.");
            }
            mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name);
            mResult      = new GeneratedValueInstance(theDefinition.Result, testExecution);

            mCreateMarkedImage = theDefinition.CreateMarkedImage;
            if (mCreateMarkedImage)
            {
                mMarkedImage = new GeneratedImageInstance(theDefinition.MarkedImage, testExecution);
            }
        }
Example #9
0
 public ReadValueFromTNDInstance(ReadValueFromTNDDefinition theDefinition, TestExecution testExecution)
     : base(theDefinition, testExecution)
 {
     mDataValueInstance = new GeneratedValueInstance(theDefinition.DataValue, testExecution);
     if (mDataValueInstance.Type == DataType.NotDefined)
     {
         // we shouldn't get here since this should be trapped in the GeneratedValueInstance ctor
         throw new ArgumentException("Data Type for '" + mDataValueInstance.Name + "' is not defined. Can't copy value from TND.");
     }
 }
Example #10
0
        public AddNumbersInstance(AddNumbersDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            //
            // TODO: Add constructor logic here
            //

            mValue1 = testExecution.DataValueRegistry.GetObject(theDefinition.Value1.Name);
            mValue2 = testExecution.DataValueRegistry.GetObject(theDefinition.Value2.Name);
            mResult = new GeneratedValueInstance(theDefinition.Result, testExecution);
        }
Example #11
0
        public CopyValueInstance(CopyValueDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            if (theDefinition.SourceValue == null)
            {
                throw new ArgumentException(Name + " doesn't have SourceValue defined.");
            }
            mSourceValue = testExecution.DataValueRegistry.GetObject(theDefinition.SourceValue.Name);

            mDestinationValue = new GeneratedValueInstance(theDefinition.DestinationValue, testExecution);
        }
Example #12
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;
        }
        public FindColorOnLineInstance(FindColorOnLineDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            if (theDefinition.ColorMatchDefinition == null)
            {
                throw new ArgumentException(Name + " doesn't have ColorMatchDefinition defined.");
            }
            mColorMatcher = testExecution.GetColorMatcher(theDefinition.ColorMatchDefinition.Name);

            if (theDefinition.SourceImage == null)
            {
                throw new ArgumentException(Name + " doesn't have SourceImage defined.");
            }
            mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name);

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

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

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

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

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

            mResultX = new GeneratedValueInstance(theDefinition.ResultX, testExecution);
            mResultY = new GeneratedValueInstance(theDefinition.ResultY, testExecution);

            mSearchEndX = new GeneratedValueInstance(theDefinition.SearchEndX, testExecution);
            mSearchEndY = new GeneratedValueInstance(theDefinition.SearchEndY, testExecution);

            mSearchPath = new ObjectBasedLineDecorationInstance(theDefinition.SearchPath, testExecution);
        }
Example #14
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 OperatorQueryInstance(OperatorQueryDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            mOperatorQueryDefinition = theDefinition;

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

            if (theDefinition.QueryMessage == null || theDefinition.QueryMessage == string.Empty)
            {
                throw new ArgumentException(Name + " doesn't have QueryMessage defined.");
            }
            mQueryMessage = theDefinition.QueryMessage;

            mOperatorAnswer = new GeneratedValueInstance(theDefinition.OperatorAnswer, testExecution);
        }
        public IntensityVariationInstance(IntensityVariationDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            if (theDefinition.VariationThreshhold == null)
            {
                throw new ArgumentException("Intensity Variation tool '" + theDefinition.Name + "' doesn't have a value assigned to VariationThreshhold");
            }
            mVariationThreshhold = testExecution.DataValueRegistry.GetObject(theDefinition.VariationThreshhold.Name);
            mTestXAxis           = theDefinition.TestXAxis;
            mTestYAxis           = theDefinition.TestYAxis;
            mROI         = testExecution.ROIRegistry.GetObject(theDefinition.ROI.Name);
            mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name);
            mResult      = new GeneratedValueInstance(theDefinition.Result, testExecution);

            mCreateMarkedImage = theDefinition.CreateMarkedImage;
            if (mCreateMarkedImage)
            {
                mMarkedImage = new GeneratedImageInstance(theDefinition.MarkedImage, testExecution);
            }
            mMarkColor = theDefinition.MarkColor;
        }
Example #17
0
        public PatternMatchOfGrayValueInstance(PatternMatchOfGrayValueDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            if (theDefinition.VariationThreshhold == null)
            {
                throw new ArgumentException("Pattern Match tool '" + theDefinition.Name + "' doesn't have a value assigned to VariationThreshhold");
            }
            mVariationThreshhold = testExecution.DataValueRegistry.GetObject(theDefinition.VariationThreshhold.Name);
            mSloppiness          = testExecution.DataValueRegistry.GetObject(theDefinition.Sloppiness.Name);
            mMinWindow           = testExecution.DataValueRegistry.GetObject(theDefinition.MinWindow.Name);
            mBrightPixelFactor   = testExecution.DataValueRegistry.GetObject(theDefinition.BrightPixelFactor.Name);
            mDarkPixelFactor     = testExecution.DataValueRegistry.GetObject(theDefinition.DarkPixelFactor.Name);
            mROI         = testExecution.ROIRegistry.GetObject(theDefinition.ROI.Name);
            mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name);
            mResult      = new GeneratedValueInstance(theDefinition.Result, testExecution);

            mCreateMarkedImage = theDefinition.CreateMarkedImage;
            if (mCreateMarkedImage)
            {
                mMarkedImage = new GeneratedImageInstance(theDefinition.MarkedImage, testExecution);
            }
            mMarkColor = theDefinition.MarkColor;
        }
Example #18
0
        public CalibrationToolInstance(CalibrationToolDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            if (theDefinition.ReferencePoint1 == null)
            {
                throw new ArgumentException(Name + " doesn't have ReferencePoint1 defined.");
            }
            mReferencePoint1 = testExecution.ReferencePointRegistry.GetObject(theDefinition.ReferencePoint1.Name);

            if (theDefinition.ReferencePoint2 == null)
            {
                throw new ArgumentException(Name + " doesn't have ReferencePoint2 defined.");
            }
            mReferencePoint2 = testExecution.ReferencePointRegistry.GetObject(theDefinition.ReferencePoint2.Name);

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

            mConversionFactor = new GeneratedValueInstance(theDefinition.ConversionFactor, testExecution);
        }
        public FindCornerFromInsideInstance(FindCornerFromInsideDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            //            mColorMatcher = testExecution.GetColorMatcher(theDefinition.ColorMatchDefinition);
            mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name);
            mStartX      = testExecution.DataValueRegistry.GetObject(theDefinition.StartX.Name);
            mStartY      = testExecution.DataValueRegistry.GetObject(theDefinition.StartY.Name);
            mFollowingEdgeColorDefinition    = testExecution.GetColorMatcher(theDefinition.FollowingEdgeColorDefinition.Name);
            mTargetEdgeColorDefinition       = testExecution.GetColorMatcher(theDefinition.TargetEdgeColorDefinition.Name);
            mSearchBackgroundColorDefinition = testExecution.GetColorMatcher(theDefinition.SearchBackgroundColorDefinition.Name);
            mSearchDirection     = theDefinition.SearchDirection;
            mTargetEdgeDirection = theDefinition.TargetEdgeDirection;
            mTargetEdgeWidth     = testExecution.DataValueRegistry.GetObject(theDefinition.TargetEdgeWidth.Name);

            mResultX = new GeneratedValueInstance(theDefinition.ResultX, testExecution);
            mResultY = new GeneratedValueInstance(theDefinition.ResultY, testExecution);

            /*
             * mSearchEndX = new GeneratedValueInstance(theDefinition.SearchEndX, testExecution);
             * mSearchEndY = new GeneratedValueInstance(theDefinition.SearchEndY, testExecution);
             *
             * mSearchPath = new LineDecorationInstance(theDefinition.SearchPath, testExecution);
             */
        }
        public ColorAnalysisInstance(ColorAnalysisDefinition 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.ROI == null)
            {
                throw new ArgumentException(Name + " doesn't have ROI defined.");
            }
            mROI = testExecution.ROIRegistry.GetObject(theDefinition.ROI.Name);

            if (theDefinition.H_Average != null)
            {
                mH_Average = new GeneratedValueInstance(theDefinition.H_Average, testExecution);
            }
            if (theDefinition.H_Min != null)
            {
                mH_Min = new GeneratedValueInstance(theDefinition.H_Min, testExecution);
            }
            if (theDefinition.H_Max != null)
            {
                mH_Max = new GeneratedValueInstance(theDefinition.H_Max, testExecution);
            }
            if (theDefinition.H_StdDev != null)
            {
                mH_StdDev = new GeneratedValueInstance(theDefinition.H_StdDev, testExecution);
            }

            if (theDefinition.S_Average != null)
            {
                mS_Average = new GeneratedValueInstance(theDefinition.S_Average, testExecution);
            }
            if (theDefinition.S_Min != null)
            {
                mS_Min = new GeneratedValueInstance(theDefinition.S_Min, testExecution);
            }
            if (theDefinition.S_Max != null)
            {
                mS_Max = new GeneratedValueInstance(theDefinition.S_Max, testExecution);
            }
            if (theDefinition.S_StdDev != null)
            {
                mS_StdDev = new GeneratedValueInstance(theDefinition.S_StdDev, testExecution);
            }

            if (theDefinition.I_Average != null)
            {
                mI_Average = new GeneratedValueInstance(theDefinition.I_Average, testExecution);
            }
            if (theDefinition.I_Min != null)
            {
                mI_Min = new GeneratedValueInstance(theDefinition.I_Min, testExecution);
            }
            if (theDefinition.I_Max != null)
            {
                mI_Max = new GeneratedValueInstance(theDefinition.I_Max, testExecution);
            }
            if (theDefinition.I_StdDev != null)
            {
                mI_StdDev = new GeneratedValueInstance(theDefinition.I_StdDev, testExecution);
            }

            if (theDefinition.R_Average != null)
            {
                mR_Average = new GeneratedValueInstance(theDefinition.R_Average, testExecution);
            }
            if (theDefinition.R_Min != null)
            {
                mR_Min = new GeneratedValueInstance(theDefinition.R_Min, testExecution);
            }
            if (theDefinition.R_Max != null)
            {
                mR_Max = new GeneratedValueInstance(theDefinition.R_Max, testExecution);
            }
            if (theDefinition.R_StdDev != null)
            {
                mR_StdDev = new GeneratedValueInstance(theDefinition.R_StdDev, testExecution);
            }

            if (theDefinition.G_Average != null)
            {
                mG_Average = new GeneratedValueInstance(theDefinition.G_Average, testExecution);
            }
            if (theDefinition.G_Min != null)
            {
                mG_Min = new GeneratedValueInstance(theDefinition.G_Min, testExecution);
            }
            if (theDefinition.G_Max != null)
            {
                mG_Max = new GeneratedValueInstance(theDefinition.G_Max, testExecution);
            }
            if (theDefinition.G_StdDev != null)
            {
                mG_StdDev = new GeneratedValueInstance(theDefinition.G_StdDev, testExecution);
            }

            if (theDefinition.B_Average != null)
            {
                mB_Average = new GeneratedValueInstance(theDefinition.B_Average, testExecution);
            }
            if (theDefinition.B_Min != null)
            {
                mB_Min = new GeneratedValueInstance(theDefinition.B_Min, testExecution);
            }
            if (theDefinition.B_Max != null)
            {
                mB_Max = new GeneratedValueInstance(theDefinition.B_Max, testExecution);
            }
            if (theDefinition.B_StdDev != null)
            {
                mB_StdDev = new GeneratedValueInstance(theDefinition.B_StdDev, testExecution);
            }

            if (theDefinition.Grey_Average != null)
            {
                mGrey_Average = new GeneratedValueInstance(theDefinition.Grey_Average, testExecution);
            }
            if (theDefinition.Grey_Min != null)
            {
                mGrey_Min = new GeneratedValueInstance(theDefinition.Grey_Min, testExecution);
            }
            if (theDefinition.Grey_Max != null)
            {
                mGrey_Max = new GeneratedValueInstance(theDefinition.Grey_Max, testExecution);
            }
            if (theDefinition.Grey_StdDev != null)
            {
                mGrey_StdDev = new GeneratedValueInstance(theDefinition.Grey_StdDev, testExecution);
            }
        }
        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);
            }
        }
        public FindBlobOfSizeAndColorInstance(FindBlobOfSizeAndColorDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            mFindBlobOfSizeAndColorDefinition = theDefinition;

            if (theDefinition.SourceImage == null)
            {
                throw new ArgumentException(Name + " doesn't have SourceImage defined.");
            }
            mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name);

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

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

            if (theDefinition.ExpectedObjectWidth != null)
            {
                mExpectedObjectWidth = testExecution.DataValueRegistry.GetObject(theDefinition.ExpectedObjectWidth.Name);
            }

            if (theDefinition.ExpectedObjectHeight != null)
            {
                mExpectedObjectHeight = testExecution.DataValueRegistry.GetObject(theDefinition.ExpectedObjectHeight.Name);
            }

            if (theDefinition.AllowedSizeVariation != null)
            {
                mAllowedSizeVariation = testExecution.DataValueRegistry.GetObject(theDefinition.AllowedSizeVariation.Name);
            }

            if (theDefinition.MinObjectHeight != null)
            {
                mMinObjectHeight = testExecution.DataValueRegistry.GetObject(theDefinition.MinObjectHeight.Name);
            }

            if (theDefinition.MinObjectWidth != null)
            {
                mMinObjectWidth = testExecution.DataValueRegistry.GetObject(theDefinition.MinObjectWidth.Name);
            }

            if (theDefinition.MaxObjectHeight != null)
            {
                mMaxObjectHeight = testExecution.DataValueRegistry.GetObject(theDefinition.MaxObjectHeight.Name);
            }

            if (theDefinition.MaxObjectWidth != null)
            {
                mMaxObjectWidth = testExecution.DataValueRegistry.GetObject(theDefinition.MaxObjectWidth.Name);
            }

            if (theDefinition.ColorMatchDefinition == null)
            {
                throw new ArgumentException(Name + " doesn't have ColorMatchDefinition defined.");
            }
            mColorMatchDefinition = testExecution.GetColorMatcher(theDefinition.ColorMatchDefinition.Name);

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

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

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

            mLeftBound   = new GeneratedValueInstance(theDefinition.LeftBound, testExecution);
            mRightBound  = new GeneratedValueInstance(theDefinition.RightBound, testExecution);
            mTopBound    = new GeneratedValueInstance(theDefinition.TopBound, testExecution);
            mBottomBound = new GeneratedValueInstance(theDefinition.BottomBound, testExecution);

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

            if (theDefinition.ImageToMark != null)
            {
                mImageToMark = testExecution.ImageRegistry.GetObject(theDefinition.ImageToMark.Name);
            }

            //mResultantRay = new ValueBasedLineDecorationInstance(theDefinition.ResultantRay, testExecution);

            mAutoSave  = theDefinition.AutoSave;
            mMarkColor = theDefinition.MarkColor;
        }
        public FindBoundingRectangleInstance(FindBoundingRectangleDefinition theDefinition, TestExecution testExecution)
            : base(theDefinition, testExecution)
        {
            mFindBoundingRectangleDefinition = theDefinition;

            if (theDefinition.SourceImage == null)
            {
                throw new ArgumentException(Name + " doesn't have SourceImage defined.");
            }
            mSourceImage = testExecution.ImageRegistry.GetObject(theDefinition.SourceImage.Name);

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

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

            if (theDefinition.ColorMatchDefinition == null)
            {
                throw new ArgumentException(Name + " doesn't have ColorMatchDefinition defined.");
            }
            mColorMatchDefinition = testExecution.GetColorMatcher(theDefinition.ColorMatchDefinition.Name);

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

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

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

            mLeftBound   = new GeneratedValueInstance(theDefinition.LeftBound, testExecution);
            mRightBound  = new GeneratedValueInstance(theDefinition.RightBound, testExecution);
            mTopBound    = new GeneratedValueInstance(theDefinition.TopBound, testExecution);
            mBottomBound = new GeneratedValueInstance(theDefinition.BottomBound, testExecution);

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

            if (theDefinition.ImageToMark != null)
            {
                mImageToMark = testExecution.ImageRegistry.GetObject(theDefinition.ImageToMark.Name);
            }

            //mResultantRay = new ValueBasedLineDecorationInstance(theDefinition.ResultantRay, testExecution);

            mAutoSave  = theDefinition.AutoSave;
            mMarkColor = theDefinition.MarkColor;
        }