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); } }
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); } }
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 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 void UpdateDisplayComponents(TestExecution testExecution, ref List <ROIInstance> roiInstances, ref List <IDecorationInstance> decorationInstances) { roiInstances.Clear(); decorationInstances.Clear(); if (testExecution == null) { return; } if (testExecution.Sequence() != mTestSequence) { throw new ArgumentException("3244289"); } foreach (ROIDefinition roiDef in roisToShow) { if (roiDef == null) { continue; } ROIInstance roi = testExecution.ROIRegistry.GetObjectIfExists(roiDef.Name); if (roi != null) { roiInstances.Add(roi); } } foreach (IDecorationDefinition decorationDef in decorationsToShow) { if (decorationDef == null) { continue; } IDecorationInstance decoration = testExecution.DecorationRegistry.GetObjectIfExists(decorationDef.Name); if (decoration != null) { decorationInstances.Add(decoration); } } }
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; }