Beispiel #1
0
        private void AddListModeData()
        {
            List <double[]> UnmanagedEcks = new List <double[]>();

            foreach (var eck in Echks)
            {
                double[] eckUnmanaged = new double[] { eck.MinE, eck.MaxE };
                UnmanagedEcks.Add(eckUnmanaged);
            }
            LahgiWrapper_Static.ResetListmodeData();
            for (uint i = 0; i < 16; ++i)
            {
                LahgiWrapper_Static.ResetSpectrum(i);
            }
            //LACC_Control_Static.ResetLMData();
            while (IsAddingListModeData)
            {
                ushort[] item;
                while (FPGAControl.ShortArrayQueue.TryTake(out item))
                {
                    LahgiWrapper_Static.AddListModeDataWraper(item, UnmanagedEcks);
                    //LACC_Control_Static.AddListModeData(item, CurrentSystemTranformation, Echks, IsMLPEOn);
                    //Thread.Sleep(0);
                }
            }
        }
Beispiel #2
0
        private void DrawBPPointCloudToRealTimePointCloudRGB()
        {
            List <double[]> color = new List <double[]>();
            List <float[]>  uvs   = new List <float[]>();

            try
            {
                LahgiWrapper_Static.GetRealTimeReconImage((double)MLPETime, ref color, ref uvs, selectReconType);
            }
            catch (NullReferenceException e)
            {
                Debug.WriteLine(e.ToString());
                return;
            }

            Bitmap bitmapOut = new Bitmap(ReconRGBPixelWidth, ReconRGBPixelHeight);

            for (int i = 0; i < uvs.Count; i++)
            {
                System.Drawing.Color bitMapColor = System.Drawing.Color.FromArgb(Convert.ToInt32(color[i][3] * 255),
                                                                                 Convert.ToInt32(color[i][0] * 255),
                                                                                 Convert.ToInt32(color[i][1] * 255),
                                                                                 Convert.ToInt32(color[i][2] * 255));

                int u = (int)(uvs[i][0] * ReconRGBPixelWidth);
                int v = (int)(uvs[i][1] * ReconRGBPixelHeight);
                if (u == ReconRGBPixelWidth)
                {
                    --u;
                }
                if (v == ReconRGBPixelHeight)
                {
                    --v;
                }

                bitmapOut.SetPixel(u, v, bitMapColor);
            }



            ReconBitmapImage = Bitmap2BitmapImage(bitmapOut);
            //RealtimeReconPointCloud = new PointGeometry3D() { Positions = v3, Colors = c4 };
        }
Beispiel #3
0
        private async Task StartorStopSessionAsync()
        {
            if (MeasurementTime == "")
            {
                return;
            }
            IsSessionAvailable = false;
            if (!IsSessionStart)
            {
                if (!FPGAControl.SetVaribles(FPGAVariable))
                {
                    VMStatus           = "Please configure FPGA.";
                    IsSessionAvailable = true;
                    return;
                }
                else
                {
                    VMStatus = "FPGA setting Start";

                    string status = "";

                    bool isFPGAStart = await Task.Run(() => FPGAControl.Start_usb(out status)).ConfigureAwait(false);

                    if (isFPGAStart)
                    {
                        IsSessionStart         = true;
                        IsRealTimeImageReconOn = true;
                        await Task.Run(() => StartTimer());

                        IsAddingListModeData        = true;
                        AddListModeDataTaskAsync    = Task.Run(() => AddListModeData());
                        RealTimeImageReconTaskAsync = Task.Run(() => RealTimeImageRecon());
                    }
                    VMStatus = status;
                }
            }
            else // Stoppping Usb
            {
                VMStatus = await FPGAControl.Stop_usb();

                IsSessionStart       = false;
                IsAddingListModeData = false;
                await AddListModeDataTaskAsync.ConfigureAwait(false);

                FPGADispatchTimer.Stop();
                IsRealTimeImageReconOn = false;
                await RealTimeImageReconTaskAsync;
                await Task.Run(() => DrawMLPEPositions()).ConfigureAwait(false);

                IsRealTimeImageReconOn = true;
                if (IsSavingBinaryFile)
                {
                    VMStatus = "Saving CSV file";
                    string saveFileName = Path.GetDirectoryName(FPGAControl.FileMainPath) + "\\" + fileName;
                    LahgiWrapper_Static.SaveListModeData(saveFileName + "_LMData.csv");
                    RealsenseControl.SaveRTPointCloud(saveFileName + "RTPointCloud");
                    RealsenseControl.SaveSLAMEDPointCloud(saveFileName + "RTPointCloud");
                    VMStatus = "Done saving CSV file";
                }
            }
            IsSessionAvailable = true;
        }