void ShowSection() { ROI line = roiController.getActiveROI(); HTuple lineCoord = line.getModelData(); HObject Rline = new HObject(); HOperatorSet.GenRegionLine(out Rline, lineCoord[0], lineCoord[1], lineCoord[2], lineCoord[3]); HTuple row, col; HObject Rline1 = new HObject(); HOperatorSet.GenContourRegionXld(Rline, out Rline1, "border"); HOperatorSet.GetContourXld(Rline1, out row, out col); HTuple Zpoint = new HTuple(), Xpoint = new HTuple(); if (row.Length == 0) { return; } HTuple width, height, lessId1, lessId2; HOperatorSet.GetImageSize(sw.hwnd[1].Image, out width, out height); HOperatorSet.TupleLessElem(row, height, out lessId1); HOperatorSet.TupleFind(lessId1, 1, out lessId1); row = row[lessId1]; col = col[lessId1]; HOperatorSet.TupleLessElem(col, width, out lessId2); HOperatorSet.TupleFind(lessId2, 1, out lessId2); row = row[lessId2]; col = col[lessId2]; HOperatorSet.GetGrayval(sw.hwnd[1].Image, row, col, out Zpoint); HTuple EqId = new HTuple(); HOperatorSet.TupleNotEqualElem(Zpoint, -30, out EqId); HOperatorSet.TupleFind(EqId, 1, out EqId); Zpoint = Zpoint[EqId]; HOperatorSet.TupleGenSequence(0, Zpoint.Length, context.xResolution, out Xpoint); Zpoint = Zpoint * 50; Xpoint = Xpoint * 50; HTuple RowNew, ColNew; HObject Region, Contour, ConstImage; GenProfile(true, Zpoint, Xpoint, out RowNew, out ColNew, out Region, out Contour); HOperatorSet.GenImageConst(out ConstImage, "byte", 1000, 1000); sw.hwnd[0].HobjectToHimage(ConstImage); sw.hwnd[0].viewWindow.displayHobject(Region, "red", true); Rline.Dispose(); Rline1.Dispose(); ConstImage.Dispose(); Region.Dispose(); Contour.Dispose(); }
/// <summary> /// Creates and initializes a measure object based on information the ROI object /// about the ROI. /// </summary> /// <param name="roi">ROI instance</param> /// <param name="mAssist">Reference to controller class</param> public Measurement(ROI roi, MeasureAssistant mAssist) { mRoi = roi; mMeasAssist = mAssist; mROICoord = mRoi.getModelData(); mEdgeXLD = new HXLDCont(); mMeasureRegion = new HRegion(); if (mRoi is ROICircularArc) { mROIType = ROI.ROI_TYPE_CIRCLEARC; } else { mROIType = ROI.ROI_TYPE_LINE; } }
private void initROI(ROI roi) { if (roi == null) { return; } mRoi = roi; mROICoord = mRoi.getModelData(); switch (mRoi.ROIMeasureType) { case MeasureType.None: if (mRoi is ROICircularArc) { mROIType = ROI.ROI_TYPE_CIRCLEARC; } else { mROIType = ROI.ROI_TYPE_LINE; } break; case MeasureType.Point: mROIType = ROI.ROI_TYPE_POINT; break; case MeasureType.Line: mROIType = ROI.ROI_TYPE_LINE; break; case MeasureType.FitLine: mROIType = ROI.ROI_TYPE_LINE; break; case MeasureType.Circle: mROIType = ROI.ROI_TYPE_CIRCLE; break; } ROIMeasureType = mRoi.ROIMeasureType; }
/// <summary> /// Triggers an update of the measure object for all /// changes concerning the shape of the ROI or the measurement /// parameters. /// </summary> public void UpdateROI() { mROICoord = mRoi.getModelData(); UpdateMeasure(); }