public void CreateModel(HImage Img, HWindow window, HWindow window1, double row1, double col1, double row2, double col2, double rowMark, double colMark) { HRegion rectangle = new HRegion(row1, col1, row2, col2); rectangle.AreaCenter(out rowOrg, out colOrg); HImage ImgReduced = new HImage(); //HRegion Rectangle1 = new HRegion(); //HRegion Rectangle2 = new HRegion(); //Window.SetColor("red"); //Window.SetDraw("margin"); //Window.SetLineWidth(3); //Rectangle.GenRectangle1(188.0, 182, 298, 412); ImgReduced = Img.ReduceDomain(rectangle); ImgReduced.InspectShapeModel(out ModelRegion, 1, 30); //Rectangle1.GenRectangle2(Rect1Row, Rect1Col, RectPhi, RectLength1, RectLength2); //Rectangle2.GenRectangle2(Rect2Row, Rect2Col, RectPhi, RectLength1, RectLength2); ShapeModel = new HShapeModel(ImgReduced, 4, 0, 0, 0, "none", "use_polarity", 30, 10); ShapeModel.SetShapeModelOrigin(rowMark - rowOrg, colMark - colOrg); //window.SetColor("green"); //window.SetDraw("margin"); window.SetPart((int)row1, (int)col1, (int)row2, (int)col2); ModelRegion.DispObj(window); window1.SetPart((int)row1, (int)col1, (int)row2, (int)col2); ImgReduced.DispImage(window1); //Window.SetColor("blue"); //Window.SetDraw("margin"); //Rectangle1.DispObj(Window); //Rectangle2.DispObj(Window); }
public void SetModelOrigin(double row, double col) { if (shapeModel != null && shapeModel.IsInitialized() && ModelRegion != null && ModelRegion.IsInitialized()) { shapeModel.SetShapeModelOrigin(row - ModelRegion.Row, col - ModelRegion.Column); ModelImgRow = (float)row; ModelImgCol = (float)col; } }