Ejemplo n.º 1
0
        public void ShowRegion(ADisplay aDisplay)
        {
            // 2015.06.15
            if (m_cogCaliperTool == null)
            {
                return;
            }

            // 2017.05.08
            if (m_cogCaliperTool.Region == null)
            {
                return;
            }

            // 2014.07.02
            ICogRegion             icogRegion           = m_cogCaliperTool.Region.Copy(CogCopyShapeConstants.GeometryOnly);
            ICogGraphicInteractive icogGraphInteractive = icogRegion as ICogGraphicInteractive;

            if (icogGraphInteractive != null)
            {
                icogGraphInteractive.GraphicDOFEnableBase = CogGraphicDOFConstants.None;
                icogGraphInteractive.Interactive          = false;
                icogGraphInteractive.Color = CogColorConstants.DarkGreen;
                aDisplay.AddOverlay(icogGraphInteractive, "");
            }
        }
Ejemplo n.º 2
0
        // 2015.06.15
        public void ViewResult2(ADisplay aDisplay, bool isShowRegion)
        {
            if (m_cogCaliperTool == null)
            {
                return;
            }

            // 2015.02.09
            if (isShowRegion)
            {
                ShowRegion(aDisplay);
            }

            int nFindCount = m_cogCaliperTool.Results.Count;

            if (nFindCount > 0)
            {
                CogCaliperResults cogCaliperResults = new CogCaliperResults();
                cogCaliperResults = m_cogCaliperTool.Results;

                if (cogCaliperResults != null && cogCaliperResults.Count >= 1)
                {
                    CogCaliperResult caliperResult = new CogCaliperResult();
                    caliperResult = cogCaliperResults[0];

                    CogCompositeShape compositeShape = new CogCompositeShape();

                    compositeShape = caliperResult.CreateResultGraphics((CogCaliperResultGraphicConstants)(1 + 2));
                    aDisplay.AddOverlay((ICogGraphicInteractive)compositeShape, "");
                }
            }
        }
Ejemplo n.º 3
0
        public bool GrabRegion(ADisplay aDisplay)
        {
            try
            {
                aDisplay.ClearOverlay();

                ICogGraphicInteractive icogGraphInteractive = null;
                CogRectangleAffine     cogRectangleAffine   = m_cogCaliperTool.Region;

                if (cogRectangleAffine == null)
                {
                    cogRectangleAffine = new CogRectangleAffine();
                    cogRectangleAffine.FitToImage(aDisplay.GetImage8Grey(), 0.5, 0.5);
                }

                icogGraphInteractive = cogRectangleAffine as ICogGraphicInteractive;

                if (icogGraphInteractive != null)
                {
                    icogGraphInteractive.GraphicDOFEnableBase = CogGraphicDOFConstants.All;
                    icogGraphInteractive.Interactive          = true;
                    icogGraphInteractive.TipText = "Region of Interest";
                    aDisplay.AddOverlay(icogGraphInteractive, "");
                }

                return(true);
            }
            catch
            {
                return(false);
            }
        }
Ejemplo n.º 4
0
        public void Run(ADisplay aDisplay)
        {
            if (m_bCalibrated == true)
            {
                aDisplay.ClearOverlay();
                m_cogCalibNPointToNPointTool.InputImage = aDisplay.Image;

                // 2015.04.08
                m_bRan = false;

                m_cogCalibNPointToNPointTool.Run();

                // 2015.04.08
                WaitRanEvent();

                aDisplay.Display.Image = m_cogCalibNPointToNPointTool.OutputImage;
                aDisplay.Display.Fit(true);

                m_cogCoordinateAxes.OriginX  = 0;
                m_cogCoordinateAxes.OriginY  = 0;
                m_cogCoordinateAxes.Rotation = 0;
                m_cogCoordinateAxes.Skew     = 0;

                m_cogCoordinateAxes.GraphicDOFEnable = CogCoordinateAxesDOFConstants.None;
                m_cogCoordinateAxes.Interactive      = false;
                m_cogCoordinateAxes.Color            = CogColorConstants.Green;
                m_cogCoordinateAxes.XAxisLabel.Color = CogColorConstants.Green;
                m_cogCoordinateAxes.YAxisLabel.Color = CogColorConstants.Green;
                m_cogCoordinateAxes.TipText          = "";
                aDisplay.AddOverlay(m_cogCoordinateAxes as ICogGraphicInteractive, "");
            }
        }
Ejemplo n.º 5
0
        public void ShowCalibratedPoints(ADisplay aDisplay, bool bMove)
        {
            try
            {
                aDisplay.ClearAll();
                aDisplay.Display.Image = m_cogCalibNPointToNPointTool.CalibrationImage;
                aDisplay.Display.Fit(true);

                for (int i = 0; i < 3; i++)
                {
                    m_pcogPointMaker[i].GraphicType = CogPointMarkerGraphicTypeConstants.Crosshair;
                    m_pcogPointMaker[i].Color       = CogColorConstants.Magenta;
                    m_pcogPointMaker[i].X           = m_cogCalibNPointToNPointTool.Calibration.GetUncalibratedPointX(i);
                    m_pcogPointMaker[i].Y           = m_cogCalibNPointToNPointTool.Calibration.GetUncalibratedPointY(i);
                    if (bMove)
                    {
                        m_pcogPointMaker[i].GraphicDOFEnable = CogPointMarkerDOFConstants.Position;
                    }
                    else
                    {
                        m_pcogPointMaker[i].GraphicDOFEnable = CogPointMarkerDOFConstants.None;
                    }

                    m_pcogPointMaker[i].Interactive = true;
                    m_pcogPointMaker[i].TipText     = "Uncalibrated Point " + i.ToString();

                    aDisplay.AddOverlay(m_pcogPointMaker[i] as ICogGraphicInteractive, "");
                }
            }
            catch { }
        }
Ejemplo n.º 6
0
        public void ShowCalibratedOrigin(ADisplay aDisplay, bool isSwapHandedness)
        {
            double               dOriginX, dOriginY;
            ICogTransform2D      transform2D;
            CogTransform2DLinear transform2DLinear = null;

            try
            {
                if (m_bCalibrated == true)
                {
                    TransCalibrated2UncalibratedCoord(m_dOriginX, m_dOriginY, out dOriginX, out dOriginY);

                    m_cogCoordinateAxes.OriginX = dOriginX;
                    m_cogCoordinateAxes.OriginY = dOriginY;

                    transform2D       = m_cogCalibNPointToNPointTool.Calibration.GetComputedUncalibratedFromCalibratedTransform();
                    transform2DLinear = transform2D.LinearTransform(m_dOriginX, m_dOriginY);

                    m_cogCoordinateAxes.Rotation = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation);
                    m_cogCoordinateAxes.Skew     = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation + m_dPI / 2) - (m_cogCoordinateAxes.Rotation + m_dPI / 2);
                }
                else
                {
                    TransCalibrated2UncalibratedCoord(m_dOriginX, m_dOriginY, out dOriginX, out dOriginY);

                    m_cogCoordinateAxes.OriginX = dOriginX;
                    m_cogCoordinateAxes.OriginY = dOriginY;

                    transform2D       = m_cogCalibNPointToNPointTool.Calibration.GetComputedUncalibratedFromCalibratedTransform();
                    transform2DLinear = transform2D.LinearTransform(m_dOriginX, m_dOriginY);

                    m_cogCoordinateAxes.Rotation = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation);
                    if (isSwapHandedness == false)
                    {
                        m_cogCoordinateAxes.Skew = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation + m_dPI / 2) - (m_cogCoordinateAxes.Rotation + m_dPI / 2);
                    }
                    else
                    {
                        m_cogCoordinateAxes.Skew = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation + m_dPI / 2 + m_dPI) - (m_cogCoordinateAxes.Rotation + m_dPI / 2);
                    }
                }

                //m_cogCoordinateAxes.GraphicDOFEnable = (CogCoordinateAxesDOFConstants)(-2147483644);//Position+Rotation
                m_cogCoordinateAxes.GraphicDOFEnable = CogCoordinateAxesDOFConstants.None;
                m_cogCoordinateAxes.Interactive      = true;
                m_cogCoordinateAxes.Color            = CogColorConstants.Cyan;
                m_cogCoordinateAxes.XAxisLabel.Color = CogColorConstants.Cyan;
                m_cogCoordinateAxes.YAxisLabel.Color = CogColorConstants.Cyan;
                m_cogCoordinateAxes.TipText          = "Calibrated Origin";
                aDisplay.AddOverlay(m_cogCoordinateAxes as ICogGraphicInteractive, "");
            }
            catch { }
        }
Ejemplo n.º 7
0
        public void ShowRegion(ADisplay aDisplay)
        {
            ICogRegion             icogRegion           = m_cogBlobTool.Region;
            ICogGraphicInteractive icogGraphInteractive = icogRegion as ICogGraphicInteractive;

            if (icogGraphInteractive != null)
            {
                icogGraphInteractive.GraphicDOFEnableBase = CogGraphicDOFConstants.None;
                icogGraphInteractive.Interactive          = false;
                icogGraphInteractive.Color = CogColorConstants.DarkGreen;
                aDisplay.AddOverlay(icogGraphInteractive, "");
            }
        }
Ejemplo n.º 8
0
        public void ViewLastRegion(ADisplay aDisplay)
        {
            ICogRegion             icogRegion           = m_cogBlobTool.Region;
            ICogGraphicInteractive icogGraphInteractive = icogRegion as ICogGraphicInteractive;

            if (icogGraphInteractive != null)
            {
                icogGraphInteractive.GraphicDOFEnableBase = CogGraphicDOFConstants.All;
                icogGraphInteractive.Interactive          = true;
                // 2016.09.19 by kdi
                icogGraphInteractive.TipText = "Region of Interest";

                aDisplay.AddOverlay(icogGraphInteractive, "");
            }
        }
Ejemplo n.º 9
0
        // 2015.05.05
        public void ShowRegion(ADisplay aDisplay, string strSpaceName)
        {
            ICogRegion icogRegion = m_cogCaliperTool.Region.Copy(CogCopyShapeConstants.GeometryOnly);

            icogRegion.SelectedSpaceName = strSpaceName;
            ICogGraphicInteractive icogGraphInteractive = icogRegion as ICogGraphicInteractive;

            if (icogGraphInteractive != null)
            {
                icogGraphInteractive.GraphicDOFEnableBase = CogGraphicDOFConstants.None;
                icogGraphInteractive.Interactive          = false;
                icogGraphInteractive.Color = CogColorConstants.DarkGreen;

                aDisplay.AddOverlay(icogGraphInteractive, "");
            }
        }
Ejemplo n.º 10
0
        public void ViewResult(ADisplay displayInput, ADisplay displayOutput, bool isShowMedian, bool isShowMean, bool isShowRegion)
        {
            int nOption = 0;

            if (isShowMean)
            {
                nOption = nOption + 64;
            }
            if (isShowMedian)
            {
                nOption = nOption + 128;
            }

            // 2015.02.09
            if (isShowRegion)
            {
                ShowRegion(displayInput);
            }

            if (m_isRun)
            {
                CogHistogramResult histResult = new CogHistogramResult();
                histResult = m_cogHistogramTool.Result;

                if (histResult != null)
                {
                    // 2015.02.09

                    /*
                     * if (isShowRegion)
                     * {
                     *  ShowRegion(displayInput);
                     * }
                     */

                    CogCompositeShape compositeShape = new CogCompositeShape();
                    compositeShape = histResult.CreateResultGraphics((CogHistogramResultGraphicConstants)(1 + 2 + 16 + nOption));

                    if (displayOutput != null)
                    {
                        displayOutput.ClearAll();
                        displayOutput.AddOverlay((ICogGraphicInteractive)compositeShape, "");
                        displayOutput.Display.Fit(true);
                    }
                }
            }
        }
Ejemplo n.º 11
0
        public void ViewResult(ADisplay aDisplay, bool isShowCenter, bool isShowRegion)
        {
            int nOption = 0;

            if (isShowCenter)
            {
                nOption = 2;
            }
            // 2015.02.09
            if (isShowRegion)
            {
                ShowRegion(aDisplay);
            }

            if (m_nFindCount > 0)
            {
                CogBlobResult cogBlobResult = new CogBlobResult();

                // 2016.03.22
                int[] pnID = new int[m_nFindCount];
                pnID = m_cogBlobTool.Results.GetBlobIDs(true);

                for (int i = 0; i < m_nFindCount; i++)
                {
                    // 2016.03.22 i => pnID[i]
                    cogBlobResult = m_cogBlobTool.Results.GetBlobByID(pnID[i]);

                    if (cogBlobResult != null)
                    {
                        CogCompositeShape cogCompositeShape = new CogCompositeShape();
                        cogCompositeShape = cogBlobResult.CreateResultGraphics((CogBlobResultGraphicConstants)(1 + 4 + nOption));
                        aDisplay.AddOverlay((ICogGraphicInteractive)cogCompositeShape, "");
                    }
                }

                // 2015.02.09

                /*
                 * if (isShowRegion)
                 * {
                 *  ShowRegion(aDisplay);
                 * }
                 */
            }
        }
        public void ShowCalibratedPoints(ADisplay aDisplay, bool isShowDistorted, bool isSwapHandedness)
        {
            try
            {
                int pointCount = m_cogCalibCheckerboardTool.Calibration.NumPoints;

                if (isShowDistorted == true)
                {
                    double x, y, mappedX, mappedY;
                    aDisplay.ClearAll();
                    aDisplay.Display.Image = m_cogCalibCheckerboardTool.Calibration.OwnedWarpParams.UndistortedCalibrationImage;
                    aDisplay.Display.Fit(true);
                    ICogGraphic mask = m_cogCalibCheckerboardTool.Calibration.OwnedWarpParams.OutputImageMask as ICogGraphic;
                    if (mask != null)
                    {
                        aDisplay.AddStaticGraphic(mask, "");
                    }

                    for (int i = 0; i < pointCount; i++)
                    {
                        CogPointMarker cogPointMaker = new CogPointMarker();
                        x = m_cogCalibCheckerboardTool.Calibration.GetUncalibratedPointX(i);
                        y = m_cogCalibCheckerboardTool.Calibration.GetUncalibratedPointY(i);

                        ICogTransform2D transform2D = m_cogCalibCheckerboardTool.Calibration.OwnedWarpParams.GetInputPixelFromOutputPixelTransform(aDisplay.Image);
                        transform2D.InvertBase().MapPoint(x, y, out mappedX, out mappedY);

                        cogPointMaker.GraphicType      = CogPointMarkerGraphicTypeConstants.Crosshair;
                        cogPointMaker.Color            = CogColorConstants.Magenta;
                        cogPointMaker.X                = mappedX;
                        cogPointMaker.Y                = mappedY;
                        cogPointMaker.GraphicDOFEnable = CogPointMarkerDOFConstants.None;
                        cogPointMaker.Interactive      = true;
                        cogPointMaker.TipText          = "Uncalibrated Point " + i.ToString();

                        aDisplay.AddOverlay(cogPointMaker as ICogGraphicInteractive, "");
                    }
                }
                else
                {
                    aDisplay.ClearAll();
                    aDisplay.Display.Image = m_cogCalibCheckerboardTool.Calibration.CalibrationImage;
                    aDisplay.Display.Fit(true);

                    for (int i = 0; i < pointCount; i++)
                    {
                        CogPointMarker cogPointMaker = new CogPointMarker();

                        cogPointMaker.GraphicType      = CogPointMarkerGraphicTypeConstants.Crosshair;
                        cogPointMaker.Color            = CogColorConstants.Magenta;
                        cogPointMaker.X                = m_cogCalibCheckerboardTool.Calibration.GetUncalibratedPointX(i);
                        cogPointMaker.Y                = m_cogCalibCheckerboardTool.Calibration.GetUncalibratedPointY(i);
                        cogPointMaker.GraphicDOFEnable = CogPointMarkerDOFConstants.None;
                        cogPointMaker.Interactive      = true;
                        cogPointMaker.TipText          = "Uncalibrated Point " + i.ToString();

                        aDisplay.AddOverlay(cogPointMaker as ICogGraphicInteractive, "");
                    }
                }

                ShowCalibratedOrigin(aDisplay, isShowDistorted, isSwapHandedness);
            }
            catch { }
        }
        public void ShowCalibratedOrigin(ADisplay aDisplay, bool isShowDistorted, bool isSwapHandedness)
        {
            double               dOriginX, dOriginY, dMappedX, dMappedY;
            ICogTransform2D      transform2D;
            CogTransform2DLinear transform2DLinear = null;

            try
            {
                if (m_bCalibrated == true)
                {
                    if (m_emComputationMode == CogCalibFixComputationModeConstants.Linear)
                    {
                        TransCalibrated2UncalibratedCoord(m_dOriginX, m_dOriginY, out dOriginX, out dOriginY);

                        m_cogCoordinateAxes.OriginX = dOriginX;
                        m_cogCoordinateAxes.OriginY = dOriginY;

                        transform2D       = m_cogCalibCheckerboardTool.Calibration.GetComputedUncalibratedFromCalibratedTransform();
                        transform2DLinear = transform2D.LinearTransform(m_dOriginX, m_dOriginY);

                        m_cogCoordinateAxes.Rotation = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation);
                        m_cogCoordinateAxes.Skew     = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation + m_dPI / 2) - (m_cogCoordinateAxes.Rotation + m_dPI / 2);
                    }
                    else if (m_emComputationMode == CogCalibFixComputationModeConstants.PerspectiveAndRadialWarp)
                    {
                        if (isShowDistorted == true)
                        {
                            transform2D = m_cogCalibCheckerboardTool.Calibration.OwnedWarpParams.GetOutputImageRootFromCalibratedTransform();
                            transform2D.MapPoint(m_dOriginX - m_dCaibratedOriginX, m_dOriginY - m_dCaibratedOriginY, out dMappedX, out dMappedY);

                            m_cogCoordinateAxes.OriginX = dMappedX;
                            m_cogCoordinateAxes.OriginY = dMappedY;

                            transform2DLinear            = transform2D.LinearTransform(dMappedX, dMappedY);
                            m_cogCoordinateAxes.Rotation = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation);
                            m_cogCoordinateAxes.Skew     = transform2DLinear.Skew;
                        }
                        else
                        {
                            TransCalibrated2UncalibratedCoord(m_dOriginX, m_dOriginY, out dOriginX, out dOriginY);

                            m_cogCoordinateAxes.OriginX = dOriginX;
                            m_cogCoordinateAxes.OriginY = dOriginY;

                            transform2D       = m_cogCalibCheckerboardTool.Calibration.GetComputedUncalibratedFromCalibratedTransform();
                            transform2DLinear = transform2D.LinearTransform(m_dOriginX, m_dOriginY);

                            m_cogCoordinateAxes.Rotation = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation);
                            m_cogCoordinateAxes.Skew     = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation + m_dPI / 2) - (m_cogCoordinateAxes.Rotation + m_dPI / 2);
                        }
                    }
                }
                else
                {
                    if (m_emComputationMode == CogCalibFixComputationModeConstants.Linear)
                    {
                        TransCalibrated2UncalibratedCoord(m_dOriginX, m_dOriginY, out dOriginX, out dOriginY);

                        m_cogCoordinateAxes.OriginX = dOriginX;
                        m_cogCoordinateAxes.OriginY = dOriginY;

                        transform2D       = m_cogCalibCheckerboardTool.Calibration.GetComputedUncalibratedFromCalibratedTransform();
                        transform2DLinear = transform2D.LinearTransform(m_dOriginX, m_dOriginY);

                        m_cogCoordinateAxes.Rotation = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation);
                        if (isSwapHandedness == false)
                        {
                            m_cogCoordinateAxes.Skew = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation + m_dPI / 2) - (m_cogCoordinateAxes.Rotation + m_dPI / 2);
                        }
                        else
                        {
                            m_cogCoordinateAxes.Skew = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation + m_dPI / 2 + m_dPI) - (m_cogCoordinateAxes.Rotation + m_dPI / 2);
                        }
                    }
                    else if (m_emComputationMode == CogCalibFixComputationModeConstants.PerspectiveAndRadialWarp)
                    {
                        if (isShowDistorted == true)
                        {
                            transform2D = m_cogCalibCheckerboardTool.Calibration.OwnedWarpParams.GetOutputImageRootFromCalibratedTransform();
                            transform2D.MapPoint(m_dOriginX - m_dCaibratedOriginX, m_dOriginY - m_dCaibratedOriginY, out dMappedX, out dMappedY);

                            m_cogCoordinateAxes.OriginX = dMappedX;
                            m_cogCoordinateAxes.OriginY = dMappedY;

                            transform2DLinear            = transform2D.LinearTransform(dMappedX, dMappedY);
                            m_cogCoordinateAxes.Rotation = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation);
                            if (isSwapHandedness == false)
                            {
                                m_cogCoordinateAxes.Skew = transform2DLinear.Skew;
                            }
                            else
                            {
                                m_cogCoordinateAxes.Skew = transform2DLinear.Skew + m_dPI;
                            }
                        }
                        else
                        {
                            TransCalibrated2UncalibratedCoord(m_dOriginX, m_dOriginY, out dOriginX, out dOriginY);

                            m_cogCoordinateAxes.OriginX = dOriginX;
                            m_cogCoordinateAxes.OriginY = dOriginY;

                            transform2D       = m_cogCalibCheckerboardTool.Calibration.GetComputedUncalibratedFromCalibratedTransform();
                            transform2DLinear = transform2D.LinearTransform(m_dOriginX, m_dOriginY);

                            m_cogCoordinateAxes.Rotation = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation);
                            if (isSwapHandedness == false)
                            {
                                m_cogCoordinateAxes.Skew = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation + m_dPI / 2) - (m_cogCoordinateAxes.Rotation + m_dPI / 2);
                            }
                            else
                            {
                                m_cogCoordinateAxes.Skew = transform2DLinear.MapAngle(m_dRotation - m_dCaibratedRotation + m_dPI / 2 + m_dPI) - (m_cogCoordinateAxes.Rotation + m_dPI / 2);
                            }
                        }
                    }
                }

                m_cogCoordinateAxes.GraphicDOFEnable = (CogCoordinateAxesDOFConstants)(-2147483644);//Position+Rotation
                m_cogCoordinateAxes.Interactive      = true;
                m_cogCoordinateAxes.Color            = CogColorConstants.Cyan;
                m_cogCoordinateAxes.XAxisLabel.Color = CogColorConstants.Cyan;
                m_cogCoordinateAxes.YAxisLabel.Color = CogColorConstants.Cyan;
                m_cogCoordinateAxes.TipText          = "Calibrated Origin";
                aDisplay.AddOverlay(m_cogCoordinateAxes as ICogGraphicInteractive, "");
            }
            catch { }
        }
Ejemplo n.º 14
0
        public bool GrabRegion(ADisplay aDisplay, AVisionProBuild._emRegionShape emRegionShape)
        {
            aDisplay.ClearOverlay();

            ICogGraphicInteractive icogGraphInteractive = null;
            ICogRegion             icogRegion           = m_cogBlobTool.Region;

            CogCircle                   circle             = icogRegion as CogCircle;
            CogEllipse                  ellipse            = icogRegion as CogEllipse;
            CogRectangle                rectangle          = icogRegion as CogRectangle;
            CogRectangleAffine          rectangleAffine    = icogRegion as CogRectangleAffine;
            CogCircularAnnulusSection   circularAnnuluns   = icogRegion as CogCircularAnnulusSection;
            CogEllipticalAnnulusSection ellipticalAnnuluns = icogRegion as CogEllipticalAnnulusSection;

            switch (emRegionShape)
            {
            case AVisionProBuild._emRegionShape.Circle:
            {
                if (circle == null)
                {
                    circle = new CogCircle();
                    circle.FitToImage(aDisplay.GetImage8Grey(), 0.5, 0.5);
                }
                icogGraphInteractive = circle as ICogGraphicInteractive;
            }
            break;

            case AVisionProBuild._emRegionShape.Ellipse:
            {
                if (ellipse == null)
                {
                    ellipse = new CogEllipse();
                    ellipse.FitToImage(aDisplay.GetImage8Grey(), 0.5, 0.5);
                }
                icogGraphInteractive = ellipse as ICogGraphicInteractive;
            }
            break;

            case AVisionProBuild._emRegionShape.Rectangle:
            {
                if (rectangle == null)
                {
                    rectangle = new CogRectangle();
                    rectangle.FitToImage(aDisplay.GetImage8Grey(), 0.5, 0.5);
                }
                icogGraphInteractive = rectangle as ICogGraphicInteractive;
            }
            break;

            case AVisionProBuild._emRegionShape.RectangleAffine:
            {
                if (rectangleAffine == null)
                {
                    rectangleAffine = new CogRectangleAffine();
                    rectangleAffine.FitToImage(aDisplay.GetImage8Grey(), 0.5, 0.5);
                }
                icogGraphInteractive = rectangleAffine as ICogGraphicInteractive;
            }
            break;

            case AVisionProBuild._emRegionShape.CircularAnnulusSection:
            {
                if (circularAnnuluns == null)
                {
                    circularAnnuluns = new CogCircularAnnulusSection();
                    circularAnnuluns.FitToImage(aDisplay.GetImage8Grey(), 0.5, 0.5);
                }
                icogGraphInteractive = circularAnnuluns as ICogGraphicInteractive;
            }
            break;

            case AVisionProBuild._emRegionShape.EllipticalAnnulusSection:
            {
                if (ellipticalAnnuluns == null)
                {
                    ellipticalAnnuluns = new CogEllipticalAnnulusSection();
                    ellipticalAnnuluns.FitToImage(aDisplay.GetImage8Grey(), 0.5, 0.5);
                }
                icogGraphInteractive = ellipticalAnnuluns as ICogGraphicInteractive;
            }
            break;

            case AVisionProBuild._emRegionShape.Entire:
            {
                m_icogRegion = null;
                aDisplay.ClearOverlay();
            }
            break;

            default:
                m_icogRegion = null;

                return(false);
            }

            if (icogGraphInteractive != null)
            {
                icogGraphInteractive.GraphicDOFEnableBase = CogGraphicDOFConstants.All;
                icogGraphInteractive.Interactive          = true;
                icogGraphInteractive.TipText = "Region of Interest";
                aDisplay.AddOverlay(icogGraphInteractive, "");
            }

            return(true);
        }