public bool ExtractCircle(HImage hImage, double centerX, double centerY, double innerCircleRadius,
                              double outerCircleRadius,
                              out Circle foundCircle, out double roundness,
                              int regionsCount,
                              //                                  int regionHeight,
                              int regionWidth,
                              double sigma, double threshold, SelectionMode selectionMode, Transition transition,
                              CircleDirect direct)
    {
        try
        {
            HTuple centerX2, centerY2, radius, roundness2;
            SpokeCircle(hImage, centerY, centerX, outerCircleRadius, innerCircleRadius,
                        regionsCount, regionWidth,
                        sigma, threshold,
                        transition.ToHalconString(),
                        selectionMode.ToHalconString(),
                        direct.ToHalconString(),
                        out centerY2, out centerX2, out radius, out roundness2);

            foundCircle = new Circle(centerX2, centerY2, radius);
            //roundness = roundness2;
            roundness = 0;
            return(true);
        }
        catch (HOperatorException e)
        {
            foundCircle = new Circle();
            roundness   = 0;
            return(false);
        }
    }
    public IList <Line> RakeEdgeLine(HImage hImage, double startX, double startY, double endX, double endY,
                                     int regionsCount, int regionHeight, int regionWidth,
                                     double sigma, double threshold, Transition transition,
                                     SelectionMode selectionMode)
    {
        // Local iconic variables

        HObject ho_Image, ho_Regions;

        // Local control variables

        HTuple hv_Row1 = null, hv_Column1 = null, hv_Row2 = null;
        HTuple hv_Column2 = null, hv_BeginRow = null, hv_BeginCol = null;
        HTuple hv_EndRow = null, hv_EndCol = null;

        // Initialize local and output iconic variables

        HOperatorSet.GenEmptyObj(out ho_Image);
        HOperatorSet.GenEmptyObj(out ho_Regions);

        try
        {
            //                ho_Image.Dispose();
            //                HOperatorSet.ReadImage(out ho_Image, @"B:\ConsoleApplication1\Untitled2.tif");
            ho_Regions.Dispose();

            hv_Row1    = new HTuple(startY);
            hv_Column1 = new HTuple(startX);
            hv_Row2    = new HTuple(endY);
            hv_Column2 = new HTuple(endX);

            RakeEdgeLine(hImage, regionsCount, regionHeight, regionWidth,
                         sigma, threshold, transition.ToHalconString(), selectionMode.ToHalconString(),
                         hv_Row1, hv_Column1, hv_Row2, hv_Column2,
                         out hv_BeginRow, out hv_BeginCol, out hv_EndRow, out hv_EndCol);

            double[] BeginRow    = hv_BeginRow;
            double[] BeginColumn = hv_BeginCol;
            double[] EndRow      = hv_EndRow;
            double[] EndColumn   = hv_EndCol;

            IList <Line> lines = new List <Line>();

            for (int i = 0; i < BeginRow.Length; i++)
            {
                lines.Add(new Line(BeginColumn[i], BeginRow[i], EndColumn[i], EndRow[i]));
            }

            return(lines);
        }
        catch (HalconException HDevExpDefaultException)
        {
            ho_Image.Dispose();
            ho_Regions.Dispose();

            throw HDevExpDefaultException;
        }
        ho_Image.Dispose();
        ho_Regions.Dispose();
    }