Ejemplo n.º 1
0
        public void createExistingROI(HTuple RoiParameters)
        {
            if (roiMode != null)             //either a new ROI object is created
            {
                roiMode.createROI(RoiParameters);
                ROIList.Add(roiMode);
                roiMode      = null;
                activeROIidx = ROIList.Count - 1;
                viewController.repaint();


                NotifyRCObserver(ROIController.EVENT_CREATED_ROI);
            }
        }
        private void doNormalROIAction(double imgX, double imgY)
        {
            roiMode.createROI(imgX, imgY);
            ROIList.Add(roiMode);
            roiMode      = null;
            activeROIidx = ROIList.Count - 1;
            viewController.repaint();

            NotifyRCObserver(ROIController.EVENT_CREATED_ROI);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Reaction of ROI objects to the 'mouse button down' event: changing
        /// the shape of the ROI and adding it to the ROIList if it is a 'seed'
        /// ROI.
        /// </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;
            int    idxSizeEnableROI = -1;
            double max = 10000, dist = 0;

            //double epsilon = 20.0;	//矩形移动点击生效的区域		//maximal shortest distance to one of
            //the handles

            if (roiMode != null)                                 //either a new ROI object is created
            {
                roiMode.createROI(imgX, imgY);
                ROIList.Add(roiMode);
                roiMode      = null;
                activeROIidx = ROIList.Count - 1;
                viewController.repaint();

                NotifyRCObserver(ROIController.EVENT_CREATED_ROI);
            }
            else if (ROIList.Count > 0)                         // ... or an existing one is manipulated
            {
                activeROIidx = -1;

                for (int i = 0; i < ROIList.Count; i++)
                {
                    if (ROIList[i] is ROIRegion)//ROIRegion例外
                    {
                        continue;
                    }
                    dist = ((ROI)ROIList[i]).distToClosestHandle(imgX, imgY);
                    if ((dist <= max) && (dist < epsilon))
                    {
                        max    = dist;
                        idxROI = i;
                        if (((ROI)ROIList[i]).SizeEnable == true)
                        {
                            idxSizeEnableROI = i;
                        }
                    }
                }                                                        //end of for
                if (idxROI != idxSizeEnableROI && idxSizeEnableROI >= 0) //优先SizeEnable的
                {
                    idxROI = idxSizeEnableROI;
                }
                if (idxROI >= 0)
                {
                    activeROIidx = idxROI;
                    NotifyRCObserver(ROIController.EVENT_ACTIVATED_ROI);
                }

                viewController.repaint();
            }
            return(activeROIidx);
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Reaction of ROI objects to the 'mouse button down' event: changing
        /// the shape of the ROI and adding it to the ROIList if it is a 'seed'
        /// ROI.
        /// </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;                              //maximal shortest distance to one of

            //the handles

            if (roiMode != null)                                 //either a new ROI object is created
            {
                roiMode.createROI(imgX, imgY);
                ROIList.Add(roiMode);

                //添加自己想显示的ROI
                ////userROI.createROI(1000,500);
                ////ROIList.Add(userROI);


                roiMode      = null;
                activeROIidx = ROIList.Count - 1;
                viewController.repaint();

                NotifyRCObserver(ROIController.EVENT_CREATED_ROI);
            }
            else if (ROIList.Count > 0)                         // ... or an existing one is manipulated
            {
                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;
                    }
                }                //end of for

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

                viewController.repaint();
            }
            return(activeROIidx);
        }
Ejemplo n.º 5
0
        /// <summary>
        /// To create a new ROI object the application class initializes a
        /// 'seed' ROI instance and passes it to the ROIController.
        /// The ROIController now responds by manipulating this new ROI
        /// instance.
        /// </summary>
        /// <param name="r">
        /// 'Seed' ROI object forwarded by the application forms class.
        /// </param>
        public void setROIShape(ROI r, double midX, double midY)
        {
            roiMode = r;
            roiMode.setOperatorFlag(stateROI);

            if (roiMode != null)                         //either a new ROI object is created
            {
                roiMode.createROI(midX, midY);

                ROIList.Add(roiMode);

                roiMode      = null;
                activeROIidx = ROIList.Count - 1;
                viewController.repaint();

                NotifyRCObserver(ROIController.EVENT_CREATED_ROI);
            }
        }