コード例 #1
0
 /// <summary>
 /// 清除所有建立的 ROI对象
 /// </summary>
 public void reset()
 {
     ROIList.Clear();
     activeROIidx = -1;
     ModelROI     = null;
     roiMode      = null;
     NotifyRCObserver(EVENT_DELETED_ALL_ROIS);
 }
コード例 #2
0
        /// <summary>
        /// ROI对象对'mouse button down'事件的反应:改变ROI的形状,如果是“Seed”ROI,则将其添加到ROIList中。
        /// </summary>
        /// <param name="imgX">x coordinate of mouse event</param>
        /// <param name="imgY">y coordinate of mouse event</param>
        /// <returns></returns>
        public int mouseDownAction(double imgX, double imgY)
        {
            int    idxROI = -1;
            double max = 10000, dist = 0;
            double epsilon = 35.0;                //到一个handles的最大直线距离


            if (roiMode == null)      //创建一个新的ROI对象
            {
                try
                {
                    roiMode.createROI(imgX, imgY);
                    ROIList.Add(roiMode);
                    roiMode      = null;
                    activeROIidx = ROIList.Count - 1;
                    viewController.repaint();

                    NotifyRCObserver(ROIController.EVENT_CREATED_ROI);
                }
                catch (Exception)
                { }
            }
            else if (ROIList.Count > 0)                         //或者对现有的一个Roi进行操控
            {
                activeROIidx = -1;

                for (int i = 0; i < ROIList.Count; i++)
                {
                    dist = ((ROI)ROIList[i]).distToClosestHandle(imgX, imgY);
                    if ((dist < max) && (dist < epsilon))
                    {
                        max    = dist;
                        idxROI = i;
                    }
                }

                if (idxROI >= 0)
                {
                    activeROIidx = idxROI;
                    NotifyRCObserver(ROIController.EVENT_ACTIVATED_ROI);
                }

                viewController.repaint();
            }
            return(activeROIidx);
        }
コード例 #3
0
 /// <summary>
 /// Deletes this ROI instance if a 'seed' ROI object has been passed
 /// to the ROIController by the application class.
 ///
 /// </summary>
 public void resetROI()
 {
     activeROIidx = -1;
     roiMode      = null;
 }
コード例 #4
0
 /// <summary>
 ///为了创建一个新的ROI对象,应用程序类初始化了一个
 ///“Seed”ROI实例化,并将其传递给ROIController。
 /// ROIController现在通过操纵这个新的ROI来回应
 ///实例
 /// </summary>
 /// <param name="r">
 ///“Seed”ROI对象由application forms类转发.
 /// </param>
 public void setROIShape(ROI r)
 {
     roiMode = r;
     roiMode.setOperatorFlag(stateROI);
 }