示例#1
0
 void AOIWindow_AlgServerRequestEvent(object sender, AlgServerRequestEventArgs e)
 {
     if (AlgServerRequestEvent != null)
     {
         AlgServerRequestEvent(sender, e);
     }
 }
示例#2
0
        private void xrayview_AlgServerRequestEvent(object sender, AlgServerRequestEventArgs e)
        {
            XRayView xrayView = sender as XRayView;

            if (xrayView != null)
            {
                //uint[] data = pxeAccess.GetTrimatBuffer(xrayView.ViewName, (int)e.RequestType);

                //for (int i = 0; i < data.Length; i++)
                //{
                //    //Switch the Red and Blue Colors
                //    uint newDataValue = data[i];
                //    uint redColor = newDataValue % 256;
                //    uint blueColor = (newDataValue << 8) >> 24;
                //    newDataValue = (newDataValue - redColor) - (blueColor << 16);
                //    data[i] = (newDataValue + blueColor) + (redColor << 16);
                //    data[i] += (uint)255 << 24;
                //}

                PixelFormat pixelFormat = PixelFormats.Rgb24;
                int         pixelBytes  = pixelFormat.BitsPerPixel / 8;
                int         stride      = (int)xrayView.Image.Source.Width * pixelBytes;

                uint[] data          = _PxeAccess.GetTrimatBuffer(xrayView.ViewName, (int)e.RequestType);
                byte[] convertedData = new byte[data.Length * pixelBytes];

                for (int i = 0; i < data.Length; i++)
                {
                    byte redColor   = Convert.ToByte((data[i] << 24) >> 24);
                    byte greenColor = Convert.ToByte((data[i] << 16) >> 24);
                    byte blueColor  = Convert.ToByte((data[i] << 8) >> 24);

                    convertedData[i * pixelBytes]     = redColor;
                    convertedData[i * pixelBytes + 1] = greenColor;
                    convertedData[i * pixelBytes + 2] = blueColor;
                }

                xrayView.Image.Source = BitmapSource.Create((int)xrayView.Image.Source.Width, (int)xrayView.Image.Source.Height, 96, 96, pixelFormat, null, convertedData, stride);
            }
        }
示例#3
0
 void AOIWindow_AlgServerRequestEvent(object sender, AlgServerRequestEventArgs e)
 {
     if (AlgServerRequestEvent != null)
     {
         AlgServerRequestEvent(sender, e);
     }
 }