public static Line GetRoiLineFromRectangle2Phi(this HRectangle2 rectangle2)
 {
     return(GetRoiLineFromRectangle2Phi(rectangle2.Row,
                                        rectangle2.Column,
                                        rectangle2.Phi,
                                        rectangle2.Length1));
 }
        public static RoiRectangle GetRoiRectangle(this HRectangle2 rectangle2)
        {
            var roiLine = rectangle2.GetRoiLineFromRectangle2Phi();
            var roiRect = new RoiRectangle
            {
                StartX   = roiLine.X1,
                StartY   = roiLine.Y1,
                EndX     = roiLine.X2,
                EndY     = roiLine.Y2,
                ROIWidth = rectangle2.Length2
            };

            return(roiRect);
        }
        public static HRectangle2 GetSmallestHRectangle2(this HRegion region)
        {
            double row;
            double column;
            double phi;
            double length1;
            double length2;

            region.SmallestRectangle2(out row, out column, out phi, out length1, out length2);
            var smallestRect = new HRectangle2()
            {
                Row     = row,
                Column  = column,
                Phi     = phi,
                Length1 = length1,
                Length2 = length2,
            };

            return(smallestRect);
        }