Beispiel #1
0
        public void CanConvertTo()
        {
            var conv = new MatrixConverter();

            Assert.IsTrue(conv.CanConvertTo(typeof(string)));
            Assert.IsFalse(conv.CanConvertTo(typeof(Matrix)));
        }
Beispiel #2
0
        /// <summary>
        /// Strassen`s multiply, use when matrix rows > 32.
        /// </summary>
        /// <param name="a">the matrix a.</param>
        /// <param name="b">the matrix b.</param>
        /// <typeparam name="T">unmanaged type.</typeparam>
        /// <returns>the new matrix from multiply of two matrices.</returns>
        public static Matrix <T> MultiplyStrassen <T>(Matrix <T> a, Matrix <T> b) where T : unmanaged
        {
            if (a.Rows < 32)
            {
                return(a * b);
            }

            a.SplitMatrix(out var a11, out var a12, out var a21, out var a22);
            b.SplitMatrix(out var b11, out var b12, out var b21, out var b22);

            Matrix <T> p1 = MultiplyStrassen(a11 + a22, b11 + b22);
            Matrix <T> p2 = MultiplyStrassen(a21 + a22, b11);
            Matrix <T> p3 = MultiplyStrassen(a11, b12 - b22);
            Matrix <T> p4 = MultiplyStrassen(a22, b21 - b11);
            Matrix <T> p5 = MultiplyStrassen(a11 + a12, b22);
            Matrix <T> p6 = MultiplyStrassen(a21 - a22, b11 + b12);
            Matrix <T> p7 = MultiplyStrassen(a12 - a22, b21 + b22);

            Matrix <T> c11 = p1 + p4 - p5 + p7;
            Matrix <T> c12 = p3 + p5;
            Matrix <T> c21 = p2 + p4;
            Matrix <T> c22 = p1 + p3 - p2 + p6;

            return(MatrixConverter.CollectMatrix(c11, c12, c21, c22));
        }
Beispiel #3
0
        public void ReverseTest_AssertMustBeEqual()
        {
            // Arrange
            Matrix <int> matrixA = new [, ]
            {
                { 1, 2, 3, 4, 5, 6 },
                { 7, 8, 9, 10, 11, 12 },
                { 13, 14, 15, 16, 17, 18 },
                { 19, 20, 21, 22, 23, 24 },
                { 25, 26, 27, 28, 29, 30 },
                { 31, 32, 33, 34, 35, 36 }
            };
            Matrix <int> expected = new [, ]
            {
                { 36, 35, 34, 33, 32, 31 },
                { 30, 29, 28, 27, 26, 25 },
                { 24, 23, 22, 21, 20, 19 },
                { 18, 17, 16, 15, 14, 13 },
                { 12, 11, 10, 9, 8, 7 },
                { 6, 5, 4, 3, 2, 1 }
            };

            // Act
            MatrixConverter.Reverse(matrixA.GetArray());

            // Assert
            Assert.Equal(expected, matrixA);
        }
Beispiel #4
0
        private static ValueTask <Matrix <T> > MultiplyStrassenParallel <T>(Matrix <T> a, Matrix <T> b)
            where T : unmanaged
        {
            if (a.Rows <= 64)
            {
                return(new ValueTask <Matrix <T> >(a * b));
            }

            a.SplitMatrix(out var a11, out var a12, out var a21, out var a22);
            b.SplitMatrix(out var b11, out var b12, out var b21, out var b22);

            var p1 = Task.Run(() => MultiplyStrassen(a11 + a22, b11 + b22));
            var p2 = Task.Run(() => MultiplyStrassen(a21 + a22, b11));
            var p3 = Task.Run(() => MultiplyStrassen(a11, b12 - b22));
            var p4 = Task.Run(() => MultiplyStrassen(a22, b21 - b11));
            var p5 = Task.Run(() => MultiplyStrassen(a11 + a12, b22));
            var p6 = Task.Run(() => MultiplyStrassen(a21 - a11, b11 + b12));
            var p7 = MultiplyStrassen(a12 - a22, b21 + b22);

            Task.WhenAll(p1, p2, p3, p4, p5, p6);

            var c11 = p1.Result + p4.Result - p5.Result + p7;
            var c12 = p3.Result + p5.Result;
            var c21 = p2.Result + p4.Result;
            var c22 = p1.Result + p3.Result - p2.Result + p6.Result;

            return(new ValueTask <Matrix <T> >(MatrixConverter.CollectMatrix(c11, c12, c21, c22)));
        }
Beispiel #5
0
        public void ConvertFrom()
        {
            var    conv = new MatrixConverter();
            object obj  = conv.ConvertFrom("1, 2, 3, 4, 5, 6");

            Assert.AreEqual(typeof(Matrix), obj.GetType());
            CheckMatrix(new Matrix(1, 2, 3, 4, 5, 6), (Matrix)obj);
        }
Beispiel #6
0
        public void ConvertTo()
        {
            var    conv   = new MatrixConverter();
            var    matrix = new Matrix(1, 2, 3, 4, 5, 6);
            object obj    = conv.ConvertTo(null, CultureInfo.InvariantCulture, matrix, typeof(string));

            Assert.AreEqual(typeof(string), obj.GetType());
            Assert.AreEqual("1,2,3,4,5,6", (string)obj);
        }
Beispiel #7
0
        // <SnippetMatrixConverterExample_csharp>
        private Matrix matrixConverterExample()
        {
            MatrixConverter mConverter   = new MatrixConverter();
            Matrix          matrixResult = new Matrix();
            string          string2      = "10,20,30,40,50,60";

            matrixResult = (Matrix)mConverter.ConvertFromString(string2);
            // matrixResult is equal to (10, 20, 30, 40, 50, 60)

            return(matrixResult);
        }
Beispiel #8
0
        public void ReverseSByteTest_CheckMask_AssertMustBeEqual(int m, int n)
        {
            // Arrange
            Matrix <sbyte> actual   = BuildMatrix.RandomSByte(m, n);
            Matrix <sbyte> matrixB  = (Matrix <sbyte>)actual.Clone();
            var            expected = matrixB.GetArray().Reverse();

            // Act
            MatrixConverter.Reverse(actual.GetArray());

            // Assert
            Assert.Equal(expected, actual);
        }
Beispiel #9
0
        private void SearchRouteBttn_Click(object sender, EventArgs e)
        {
            if (!CanSearchRoute())
            {
                MessageBox.Show(Locales.Strings.CantSearchRoute);
                return;
            }

            Graph = MatrixConverter.ConvertMatrixToGraph(Matrix);
            string pathTaken = Searcher.BFS(Graph.GetStartVertex(), Graph.GetDestinationVertices(), Graph);

            DisplayGraphAndBFS(pathTaken);
        }
        public void Return_1_Given_1x1_Matrix()
        {
            // Arrange
            int[,] matrix =
            {
                { 1 }
            };

            // Act
            var result = MatrixConverter.ToArray(matrix);

            // Assert
            Assert.Equal("1", result);
        }
        public void Return_1243_Given_2x2_Matrix()
        {
            // Arrange
            int[,] matrix =
            {
                { 1, 2 },
                { 3, 4 }
            };

            // Act
            var result = MatrixConverter.ToArray(matrix);

            // Assert
            Assert.Equal("1 2 4 3", result);
        }
        public void Return_123654_Given_2x3_Matrix()
        {
            // Arrange
            int[,] matrix =
            {
                { 1, 2, 3 },
                { 4, 5, 6 }
            };

            // Act
            var result = MatrixConverter.ToArray(matrix);

            // Assert
            Assert.Equal("1 2 3 6 5 4", result);
        }
        public void Return_12348765_Given_2x4_Matrix()
        {
            // Arrange
            int[,] matrix =
            {
                { 1, 2, 3, 4 },
                { 5, 6, 7, 8 }
            };

            // Act
            var result = MatrixConverter.ToArray(matrix);

            // Assert
            Assert.Equal("1 2 3 4 8 7 6 5", result);
        }
        public void Return_1236987456_Given_3x4_Matrix()
        {
            // Arrange
            int[,] matrix =
            {
                { 1,  2,  3,  4 },
                { 5,  6,  7,  8 },
                { 9, 10, 11, 12 }
            };

            // Act
            var result = MatrixConverter.ToArray(matrix);

            // Assert
            Assert.Equal("1 2 3 4 8 12 11 10 9 5 6 7", result);
        }
        public void Return_12348121615141395671110_Given_4x4_Matrix()
        {
            // Arrange
            int[,] matrix =
            {
                {  1,  2,  3,  4 },
                {  5,  6,  7,  8 },
                {  9, 10, 11, 12 },
                { 13, 14, 15, 16 },
            };

            // Act
            var result = MatrixConverter.ToArray(matrix);

            // Assert
            Assert.Equal("1 2 3 4 8 12 16 15 14 13 9 5 6 7 11 10", result);
        }
Beispiel #16
0
        public void ReverseSingleTest_AssertMustBeEqual(int m, int n)
        {
            // Arrange
            Matrix <float> matrixA  = new Matrix <float>(m, n);
            Matrix <float> expected = new Matrix <float>(m, n);
            var            arr1     = matrixA.GetArray();
            var            arr2     = expected.GetArray();

            for (int i = 0; i < arr1.Length; i++)
            {
                arr1[i] = i;
            }

            for (int i = 0; i < arr2.Length; i++)
            {
                arr2[i] = arr2.Length - i - 1;
            }

            // Act
            MatrixConverter.Reverse(matrixA.GetArray());

            // Assert
            Assert.Equal(expected, matrixA);
        }
Beispiel #17
0
        public void ReverseSByteTest_AssertMustBeEqual(int m, int n)
        {
            // Arrange
            Matrix <sbyte> matrixA  = new Matrix <sbyte>(m, n);
            Matrix <sbyte> expected = new Matrix <sbyte>(m, n);
            var            arr1     = matrixA.GetArray();
            var            arr2     = expected.GetArray();

            for (byte i = 0; i < arr1.Length; i++)
            {
                arr1[i] = (sbyte)i;
            }

            for (byte i = 0; i < arr2.Length; i++)
            {
                arr2[i] = (sbyte)(arr2.Length - i - 1);
            }

            // Act
            MatrixConverter.Reverse(matrixA.GetArray());

            // Assert
            Assert.Equal(expected, matrixA);
        }
Beispiel #18
0
        public void ReverseUInt64Test_AssertMustBeEqual(int m, int n)
        {
            // Arrange
            Matrix <ulong> matrixA  = new Matrix <ulong>(m, n);
            Matrix <ulong> expected = new Matrix <ulong>(m, n);
            var            arr1     = matrixA.GetArray();
            var            arr2     = expected.GetArray();

            for (uint i = 0; i < arr1.Length; i++)
            {
                arr1[i] = i;
            }

            for (uint i = 0; i < arr2.Length; i++)
            {
                arr2[i] = (ulong)(arr2.Length - i - 1);
            }

            // Act
            MatrixConverter.Reverse(matrixA.GetArray());

            // Assert
            Assert.Equal(expected, matrixA);
        }
Beispiel #19
0
 public void ReverseByteSimd()
 {
     MatrixConverter.Reverse(_matrixByte);
 }
Beispiel #20
0
        public void ConvertFromInvalidType()
        {
            var conv = new MatrixConverter();

            conv.ConvertFrom(new Matrix(10, 20, 30, 40, 50, 60));
        }
Beispiel #21
0
 public void ReverseDoubleSimd()
 {
     MatrixConverter.Reverse(_matrixDouble);
 }
Beispiel #22
0
 public void ReverseFloatSimd()
 {
     MatrixConverter.Reverse(_matrixFloat);
 }
Beispiel #23
0
 /// <summary>
 /// Reverse vector.
 /// </summary>
 /// <param name="vector">vector</param>
 public static void Reverse(Vector <ulong> vector)
 {
     MatrixConverter.Reverse(vector.Array);
 }
Beispiel #24
0
 public void ReverseIntSimd()
 {
     MatrixConverter.Reverse(_matrix.GetArray());
 }
 public void SwapRows()
 {
     MatrixConverter.SwapRows(_matrix1, 0, 124);
 }
Beispiel #26
0
        // This method performs the Point operations
        public void PerformOperation(object sender, RoutedEventArgs e)
        {
            RadioButton li = (sender as RadioButton);

            // Strings used to display the results
            String syntaxString, resultType, operationString;

            // The local variables point1, point2, vector2, etc are defined in each
            // case block for readability reasons. Each variable is contained within
            // the scope of each case statement.
            switch (li.Name)
            {               //begin switch
            case "rb1":
            {
                // Converts a String to a Point using a PointConverter
                // Returns a Point.

                PointConverter pConverter  = new PointConverter();
                Point          pointResult = new Point();
                string         string1     = "10,20";

                pointResult = (Point)pConverter.ConvertFromString(string1);
                // pointResult is equal to (10, 20)

                // Displaying Results
                syntaxString    = "pointResult = (Point)pConverter1.ConvertFromString(string1);";
                resultType      = "Point";
                operationString = "Converting a String to a Point";
                ShowResults(pointResult.ToString(), syntaxString, resultType, operationString);
                break;
            }

            case "rb2":
            {
                // Converts a String to a Vector using a VectorConverter
                // Returns a Vector.

                VectorConverter vConverter   = new VectorConverter();
                Vector          vectorResult = new Vector();
                string          string1      = "10,20";

                vectorResult = (Vector)vConverter.ConvertFromString(string1);
                // vectorResult is equal to (10, 20)

                // Displaying Results
                syntaxString    = "vectorResult = (Vector)vConverter.ConvertFromString(string1);";
                resultType      = "Vector";
                operationString = "Converting a String into a Vector";
                ShowResults(vectorResult.ToString(), syntaxString, resultType, operationString);
                break;
            }

            case "rb3":
            {
                // Converts a String to a Matrix using a MatrixConverter
                // Returns a Matrix.

                MatrixConverter mConverter   = new MatrixConverter();
                Matrix          matrixResult = new Matrix();
                string          string2      = "10,20,30,40,50,60";

                matrixResult = (Matrix)mConverter.ConvertFromString(string2);
                // matrixResult is equal to (10, 20, 30, 40, 50, 60)

                // Displaying Results
                syntaxString    = "matrixResult = (Vector)mConverter.ConvertFromString(string2);";
                resultType      = "Matrix";
                operationString = "Converting a String into a Matrix";
                ShowResults(matrixResult.ToString(), syntaxString, resultType, operationString);
                break;
            }

            case "rb4":
            {
                // Converts a String to a Point3D using a Point3DConverter
                // Returns a Point3D.

                Point3DConverter p3DConverter  = new Point3DConverter();
                Point3D          point3DResult = new Point3D();
                string           string3       = "10,20,30";

                point3DResult = (Point3D)p3DConverter.ConvertFromString(string3);
                // point3DResult is equal to (10, 20, 30)

                // Displaying Results
                syntaxString    = "point3DResult = (Point3D)p3DConverter.ConvertFromString(string3);";
                resultType      = "Point3D";
                operationString = "Converting a String into a Point3D";
                ShowResults(point3DResult.ToString(), syntaxString, resultType, operationString);
                break;
            }

            case "rb5":
            {
                // Converts a String to a Vector3D using a Vector3DConverter
                // Returns a Vector3D.

                Vector3DConverter v3DConverter   = new Vector3DConverter();
                Vector3D          vector3DResult = new Vector3D();
                string            string3        = "10,20,30";

                vector3DResult = (Vector3D)v3DConverter.ConvertFromString(string3);
                // vector3DResult is equal to (10, 20, 30)

                // Displaying Results
                syntaxString    = "vector3DResult = (Vector3D)v3DConverter.ConvertFromString(string3);";
                resultType      = "Vector3D";
                operationString = "Converting a String into a Vector3D";
                ShowResults(vector3DResult.ToString(), syntaxString, resultType, operationString);
                break;
            }

            case "rb6":
            {
                // Converts a String to a Size3D using a Size3DConverter
                // Returns a Size3D.

                Size3DConverter s3DConverter = new Size3DConverter();
                Size3D          size3DResult = new Size3D();
                string          string3      = "10,20,30";

                size3DResult = (Size3D)s3DConverter.ConvertFromString(string3);
                // size3DResult is equal to (10, 20, 30)

                // Displaying Results
                syntaxString    = "size3DResult = (Size3D)v3DConverter.ConvertFromString(string3);";
                resultType      = "Size3D";
                operationString = "Converting a String into a Size3D";
                ShowResults(size3DResult.ToString(), syntaxString, resultType, operationString);
                break;
            }

            case "rb7":
            {
                // Converts a String to a Point4D using a Point4DConverter
                // Returns a Point4D.

                Point4DConverter p4DConverter  = new Point4DConverter();
                Point4D          point4DResult = new Point4D();
                string           string4       = "10,20,30,40";

                point4DResult = (Point4D)p4DConverter.ConvertFromString(string4);
                // point4DResult is equal to (10, 20, 30)

                // Displaying Results
                syntaxString    = "point4DResult = (Point4D)v3DConverter.ConvertFromString(string3);";
                resultType      = "Point4D";
                operationString = "Converting a String into a Point4D";
                ShowResults(point4DResult.ToString(), syntaxString, resultType, operationString);
                break;
            }

            default:
                break;
            } //end switch
        }
Beispiel #27
0
        /// <summary>
        /// Reader의 내용을 이용하여 부품의 좌표계를 변환
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public static Board ConvertBoardData(Reader reader)
        {
            List <KY.KYV.JobReader.Component> compList = new List <KY.KYV.JobReader.Component>();

            if (reader != null)
            {
                #region ComponentInfo
                if (reader.BoardArrays == null)
                {
                    return(null);
                }
                foreach (ElementBoardArray arr in reader.BoardArrays.Items)
                {
                    MatrixConverter arrMtx = new MatrixConverter(arr.x, arr.y, arr.rot);

                    foreach (ElementComponent comp in reader.Components.component)
                    {
                        //get part of comp
                        ElementPart part = reader.Parts.ItemDic[comp.part];

                        //get pack of part
                        ElementPackages.ElementPackage Package;
                        if (!reader.Packages.ItemDic.TryGetValue(part.pkg, out Package))
                        {
                            continue;
                        }

                        //get rotate of comp
                        float           rotate  = comp.fAngleByCompItSelf + comp.fAngleForInsp + part.OffsetAngForUsrRefAng;// + Package.fOrgOffsetAng;
                        MatrixConverter compMtx = new MatrixConverter(comp.x, reader.HeadInfo.board.orgH - comp.y, rotate);

                        List <KY.KYV.JobReader.DrawData> drawDataList = new List <KY.KYV.JobReader.DrawData>();

                        //init data for draw body of comp
                        float angleSum    = arr.rot + rotate;
                        float angleAdjust = 0.0F;
                        if (Package != null && Package.pkgbody != null)
                        {
                            foreach (ElementPackages.ElementPackage.ElementPackageBody pkgbody in Package.pkgbody)
                            {
                                ElementShape shape = reader.PackageBodyShapes.ItemDic[pkgbody.shuid];
                                foreach (ElementRect rect in shape.rc)
                                {
                                    float           rectrot = (pkgbody.rot + rect.rot);
                                    MatrixConverter bodyMtx = new MatrixConverter(pkgbody.x, pkgbody.y, rectrot);

                                    PointF ptRect = bodyMtx.TransformPoint(0, 0);
                                    ptRect = compMtx.TransformPoint(ptRect);
                                    ptRect = arrMtx.TransformPoint(ptRect);

                                    drawDataList.Add(
                                        new DrawData()
                                    {
                                        Offset      = new System.Drawing.PointF(pkgbody.x, pkgbody.y),
                                        Rotate      = (pkgbody.rot + rect.rot),
                                        Size        = new System.Drawing.SizeF(rect.w, rect.h),
                                        Type        = DrawData.DataType.BODY,
                                        AbsLocation = new System.Drawing.PointF(ptRect.X, reader.HeadInfo.board.orgH - ptRect.Y),
                                        AbsRoate    = (pkgbody.rot + rect.rot + angleSum)
                                    });
                                }
                            }
                        }

                        //init data for draw footprint of comp
                        if (Package != null && Package.pkgpins != null)
                        {
                            foreach (ElementPackages.ElementPackage.ElementPackagePins pkgpins in Package.pkgpins)
                            {
                                foreach (ElementPackages.ElementPackage.ElementPackagePins.ElementPackagePin pkgpin in pkgpins.pkgpin)
                                {
                                    ElementShape shape = reader.PackageLeadShapes.ItemDic[pkgpin.shuid];
                                    foreach (ElementRect rect in shape.rc)
                                    {
                                        float           rectrot = (pkgpin.rot + rect.rot);
                                        MatrixConverter pinMtx  = new MatrixConverter(pkgpin.x, pkgpin.y, rectrot);

                                        PointF ptRect = pinMtx.TransformPoint(0, 0);
                                        ptRect = compMtx.TransformPoint(ptRect);
                                        ptRect = arrMtx.TransformPoint(ptRect);

                                        drawDataList.Add(
                                            new DrawData()
                                        {
                                            Offset      = new System.Drawing.PointF(pkgpin.x, pkgpin.y),
                                            Rotate      = (pkgpin.rot + rect.rot),
                                            Size        = new System.Drawing.SizeF(rect.w, rect.h),
                                            Type        = DrawData.DataType.LEAD,
                                            AbsLocation = new System.Drawing.PointF(ptRect.X, reader.HeadInfo.board.orgH - ptRect.Y),
                                            AbsRoate    = (pkgpin.rot + rect.rot + angleSum)
                                        });
                                    }
                                }
                            }
                        }


                        //if (reader.Footprints.ItemDic.ContainsKey(comp.footprint))
                        //{
                        //    ElementFootprint footprint = reader.Footprints.ItemDic[comp.footprint];
                        //    foreach (ElementPin pin in footprint.Items)
                        //    {


                        //        if (reader.FootprintLeadShapes.ItemDic.ContainsKey(pin.shuid))
                        //        {
                        //            ElementShape shape = reader.FootprintLeadShapes.ItemDic[pin.shuid];
                        //            foreach (ElementRect rect in shape.rc)
                        //            {
                        //                System.Drawing.Drawing2D.Matrix mtxRectCenter = new System.Drawing.Drawing2D.Matrix();
                        //                mtxRectCenter.Translate(pin.x, pin.y);
                        //                System.Drawing.Drawing2D.Matrix mtxRectRot = new System.Drawing.Drawing2D.Matrix();
                        //                mtxRectRot.RotateAt(-(pin.rot + rect.rot), new PointF(pin.x, pin.y));

                        //                PointF[] ptRect = new PointF[] { new PointF(0F, 0F) };
                        //                mtxRectCenter.TransformPoints(ptRect);
                        //                mtxRectRot.TransformPoints(ptRect);
                        //                mtxCompCenter.TransformPoints(ptRect);
                        //                mtxCompRot.TransformPoints(ptRect);
                        //                mtxArrayCenter.TransformPoints(ptRect);
                        //                mtxArrayRot.TransformPoints(ptRect);

                        //                drawDataList.Add(
                        //                    new DrawData()
                        //                    {
                        //                        Offset = new System.Drawing.PointF(pin.x, pin.y),
                        //                        Rotate = (pin.rot + rect.rot),
                        //                        Size = new System.Drawing.SizeF(rect.w, rect.h),
                        //                        Type = DrawData.DataType.PAD,
                        //                        AbsLocation = new System.Drawing.PointF(ptRect[0].X, ptRect[0].Y),
                        //                        AbsRoate = (pin.rot + rect.rot + angleSum)
                        //                    });
                        //            }

                        //        }
                        //    }
                        //}


                        //init component list data
                        PointF ptComp = compMtx.TransformPoint(0, 0);
                        ptComp = arrMtx.TransformPoint(ptComp);

                        compList.Add(
                            new KY.KYV.JobReader.Component()
                        {
                            CRD        = comp.name,
                            ArrayIndex = arr.num,
                            Location   = new System.Drawing.PointF(ptComp.X, reader.HeadInfo.board.orgH - ptComp.Y),
                            Rotate     = (comp.fAngleByCompItSelf + comp.fAngleForInsp + angleAdjust + Package.fOrgOffsetAng),
                            DrawDatas  = drawDataList.ToArray()
                        });

                        System.Diagnostics.Debug.WriteLine($"{comp.name}/ {arr.num}");
                    }
                }

                #endregion

                #region PCBImage

                string imagefilepath = System.IO.Path.GetDirectoryName(reader.JobfilePath);

                string[] ImagefileNameList = new string[] { "WholeboardFov.jpg", "WholeBoard.jpg", "WholeBoard.bmp" };
                Image    boardIamge        = null;
                string   boardimagepath    = null;
                foreach (string fileName in ImagefileNameList)
                {
                    System.Diagnostics.Debug.WriteLine(System.IO.Path.Combine(imagefilepath, fileName));
                    if (System.IO.File.Exists(System.IO.Path.Combine(imagefilepath, fileName)))
                    {
                        boardimagepath = System.IO.Path.Combine(imagefilepath, fileName);
                        // boardIamge = Image.FromFile(boardimagepath);
                        break;
                    }
                }

                List <ImageData> fovimages = new List <ImageData>();
                foreach (ElementFov fov in reader.Boardfovs.fovs)
                {
                    Image  fovImage     = null;
                    string fovImagepath = null;
                    string path         = System.IO.Path.Combine(imagefilepath, string.Format("Board-Fov-{0:D3}_T.jpg", fov.id + 1));
                    if (System.IO.File.Exists(path))
                    {
                        fovImagepath = path;
                    }

                    fovimages.Add(new ImageData()
                    {
                        Img         = fovImage,
                        ImgFilePath = fovImagepath,
                        Size        = new System.Drawing.SizeF(reader.Boardfovs.width, reader.Boardfovs.height),
                        Location    = new PointF(fov.left, fov.height)
                    });
                }

                #endregion

                Board board = new Board()
                {
                    Size       = new System.Drawing.SizeF(reader.HeadInfo.board.w, reader.HeadInfo.board.h),
                    WholeImage = new ImageData()
                    {
                        Img         = boardIamge,
                        ImgFilePath = boardimagepath,
                        Size        = new System.Drawing.SizeF(reader.HeadInfo.board.w, reader.HeadInfo.board.h),
                        Location    = new PointF(reader.HeadInfo.board.w / 2, reader.HeadInfo.board.h / 2)
                    },
                    FovImages  = fovimages.ToArray(),
                    Components = compList.ToArray()
                };
                return(board);
            }
            return(null);
        }