Ejemplo n.º 1
0
        void ImageProcessThreadFun()
        {
            while (!Disposing)
            {
                if (QueueImages.Count > 0)
                {
                    ImageProcessThreadMutex.WaitOne();


                    //DateTime tm = DateTime.Now;

                    ImageObject img = QueueImages.Dequeue();
                    img.GenerateImage();
                    RefreshDataDisplay(img);

                    //Console.WriteLine(DateTime.Now - tm);

                    ImageProcessThreadMutex.ReleaseMutex();

                    Thread.Sleep(10);
                }
                else
                {
                    Thread.Sleep(500);
                }
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Mouse move.
        /// Moving without button pressed or with left button pressed
        /// is passed to active tool.
        /// </summary>
        protected virtual void mImgPictureBox_MouseMove(object sender, MouseEventArgs e)
        {
            if (imageData != null && imageData.Length > 0)
            {
                Matrix m = Jacobi_Image.Clone();
                m.Invert();
                Point p = PubMatrix.TransformPoint(e.Location, m);
                int   v = 0;
                if (p.X < 0 || p.Y < 0 || p.X >= imageData.GetLength(1) || p.Y >= imageData.GetLength(0))
                {
                    v = 0;
                }
                else
                {
                    v = imageData[p.Y, p.X];
                }

                if (PositionAndValue != null)
                {
                    PositionAndValue(p, v);
                }
            }

            if (e.Button == MouseButtons.Left)
            {
                int dx = e.X - WLmovePoint.X;
                int dy = e.Y - WLmovePoint.Y;
                if (dx == 0 && dy == 0)
                {
                    return;
                }
                WLmovePoint         = e.Location;
                imgObject.imgWindow = imgObject.imgWindow + dy * 2;
                if (imgObject.imgWindow <= 0)
                {
                    imgObject.imgWindow = 1;
                }
                imgObject.imgLevel = imgObject.imgLevel + dx * 2;
                if (imgObject.imgLevel <= 0)
                {
                    imgObject.imgLevel = 1;
                }

                imgObject.GenerateImage();

                RefreshView();
            }
        }