示例#1
0
        ////////////////////////////////////////////////////////////////////////////////////
        //
        ////////////////////////////////////////////////////////////////////////////////////
        private void AddFileButton_Click(object sender, RoutedEventArgs e)
        {
            Microsoft.Win32.OpenFileDialog dlg = new Microsoft.Win32.OpenFileDialog();
            dlg.FileName   = "";                                // Default file name
            dlg.DefaultExt = ".spe";                            // Default file extension
            dlg.Filter     = "LightField Data (*.spe)|*.spe";   // Filter files by extension

            // Show open file dialog box
            Nullable <bool> result = dlg.ShowDialog();

            // Process open file dialog box results
            if (result == true)
            {
                // Data Workspace
                if (selectedLocation_ != DisplayLocation.DataWorkspace)
                {
                    // Get the viewer
                    IDisplayViewer viewer = display_.GetDisplay(selectedLocation_, selectedIndex_);

                    // Must be a graph to add source
                    viewer.DisplayType = DisplayType.Graph;

                    // Only support a maximum of 5 sources
                    if (viewer.DisplaySources.Count < 5)
                    {
                        // Create the source and add it
                        IDisplaySource source = display_.Create(dlg.FileName);
                        viewer.Add(source);
                    }
                }
            }
        }
示例#2
0
        ///////////////////////////////////////////////////////////////////////
        // Show 4 Plots of Cos vs Sine in Quad Display
        // 1.) Generates Raw Data
        // 2.) Builds IImageData(s) with the raw data from the DataManager.
        // 3.) Gets 4 Displays and Puts 2 Waveforms in each display.
        ///////////////////////////////////////////////////////////////////////
        private void PlotSinAndCos()
        {
            // Make two curves (720 = 2*PI so its a full cycle)
            ushort[] cosine = new ushort[720];
            ushort[] sine   = new ushort[720];

            // Generate Curves (Amplitude 100)
            for (int pix = 0; pix < 720; pix++)
            {
                // Convert To Angle
                double angle = Math.PI * ((double)pix - 360) / 180.0;

                // Compute Points
                cosine[pix] = (ushort)((double)100 * (Math.Cos(angle) + (double)1));
                sine[pix]   = (ushort)((double)100 * (Math.Sin(angle) + (double)1));
            }

            // Get the data manager
            var datamgr = LightFieldApplication.DataManager;

            if (datamgr != null)
            {
                RegionOfInterest roi = new RegionOfInterest(0, 0, 720, 1, 1, 1);
                // Create Blobs
                IImageDataSet cosData  = datamgr.CreateImageDataSet(cosine, roi, ImageDataFormat.MonochromeUnsigned16);
                IImageDataSet sineData = datamgr.CreateImageDataSet(sine, roi, ImageDataFormat.MonochromeUnsigned16);

                // Get The Display Object
                IDisplay display = LightFieldApplication.DisplayManager;
                if (display != null)
                {
                    // Select Data File Compare Mode & 4 Even Windows
                    display.ShowDisplay(DisplayLocation.ExperimentWorkspace, DisplayLayout.FourEven);
                    IDisplayViewer view = null;

                    // Put the data in all 4 windows
                    for (int i = 0; i <= 3; i++)
                    {
                        view = display.GetDisplay(DisplayLocation.ExperimentWorkspace, i);
                        view.Display("Cosine", cosData);
                        IDisplaySource sinSource = display.Create("Sine", sineData);
                        view.Add(sinSource);
                    }
                }
            }
        }