internal void OpenSpectraFile(string fileName)
        {
            if (File.Exists(fileName))
            {
                SpectraFile spectraFile = SpectraFile.Load(fileName);
                if (spectraFile != null)
                {
                    DisplaySpectra(spectraFile.Data, null, m_DisplaySettings, fileName);

                    string videoFile = m_VideoController.GetVideoFileMatchingLcFile(spectraFile.Header.PathToVideoFile, fileName);
                    if (!string.IsNullOrEmpty(videoFile) &&
                        File.Exists(videoFile))
                    {
                        if (m_VideoController.OpenVideoFile(videoFile))
                        {
                            TangraContext.Current.CanPlayVideo = false;
                        }
                    }
                    else
                    {
                        // NOTE: No video file found, just show the saved averaged frame
                        TangraContext.Current.Reset();

                        if (spectraFile.Data.MeasurementInfo.FrameBitmapPixels != null &&
                            spectraFile.Data.MeasurementInfo.FrameBitmapPixels.Length > 0)
                        {
                            if (m_VideoController.SingleBitmapFile(spectraFile.Data.MeasurementInfo.FrameBitmapPixels, spectraFile.Header.Width, spectraFile.Header.Height))
                            {
                                TangraContext.Current.CanPlayVideo = false;
                                m_VideoController.UpdateViews();

                                PSFFit.SetDataRange(spectraFile.Header.BitPix, spectraFile.Header.DataAav16NormVal);
                            }
                        }

                        TangraContext.Current.CanPlayVideo    = false;
                        TangraContext.Current.CanScrollFrames = false;
                    }

                    TangraContext.Current.FileName   = Path.GetFileName(fileName);
                    TangraContext.Current.FileFormat = spectraFile.Header.SourceInfo;
                    m_VideoController.UpdateViews();
                }

                RegisterRecentSpectraFile(fileName);
            }
        }
Example #2
0
        private void LoadSpectraFile(string filePath)
        {
            try
            {
                m_SpectraFile = SpectraFile.Load(filePath);
                if (m_SpectraFile.Data.IsCalibrated())
                {
                    ContainsWavelengthData = true;

                    // TODO: Do an automtic spectra export
                    //m_SpectraFile.Data.Export
                }
            }
            catch (Exception ex)
            {
                Trace.WriteLine(ex);
            }
        }