/// <summary> /// Example test method 2 for the Process call. /// </summary> /// <param name="region">The region to modify.</param> /// <returns>The area of the region.</returns> private double CircularizeAndShrinkRegion(HRegion region) { HRegion circleRegion = new HRegion(); double unusedDouble; double area = 0; try { // Test code. // System.Threading.Thread.Sleep(2000); // Does not block. // throw new Exception("Test Exception"); circleRegion = region.ShapeTrans("circle"); if (this.dilationSize > 0) { this.WaferRegion = circleRegion.ErosionCircle(this.dilationSize); // (400.5); } else { this.WaferRegion = circleRegion.CopyObj(1, -1); } area = this.waferRegion.AreaCenter(out unusedDouble, out unusedDouble); } catch (HalconException) { this.ErrorMessage = "Halcon Exception in FillAndShrinkRegion"; this.ErrorCode = ProcessingErrorCode.ProcessingStep2Error; } catch (Exception) { this.ErrorMessage = "System Exception in FillAndShrinkRegion"; this.ErrorCode = ProcessingErrorCode.ProcessingStep2Error; } finally { circleRegion.Dispose(); } return(area); }