コード例 #1
0
 /// <summary>
 /// Clears all variables managing ROI objects
 /// </summary>
 public void reset()
 {
     ROIList.Clear();
     activeROIidx = -1;
     ModelROI     = null;
     roiMode      = null;
     NotifyRCObserver(EVENT_DELETED_ALL_ROIS);
 }
コード例 #2
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);
                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);
        }
コード例 #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>
 /// 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)
 {
     roiMode = r;
     roiMode.setOperatorFlag(stateROI);
 }