private void Image_Load_Click(object sender, EventArgs e) { //ImageFromFileToDatabase(); wgDB.GetAllReferenceImages(); ImageSelectDialog diag = new ImageSelectDialog(); for (int i = 0; i < wgDB.m_refImageList.Count(); i++) { diag.AddImage(wgDB.m_refImageList[i].ImageData, wgDB.m_refImageList[i].Width, wgDB.m_refImageList[i].Height, "test " + i.ToString(), wgDB.m_refImageList[i].ReferenceImageID); } diag.ShowDialog(); if (diag.result) { ReferenceImageContainer refImage; bool success = wgDB.GetReferenceImage(diag.databaseID, out refImage); if (success) { if (m_colorModel.m_maxPixelValue != refImage.MaxPixelValue) { m_colorModel.SetMaxPixelValue(refImage.MaxPixelValue); m_colorModel.BuildColorMap(); } SetImage(refImage.ImageData, refImage.Width, refImage.Height); } } }
public void StartSimulationTimer(int interval) { Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); LoadSimulationConfiguration(); int hBinning = 1, vBinning = 1; ChartArray.BuildChartArray(m_mask.Rows, m_mask.Cols, hBinning, vBinning, m_indicatorList); //////////////////////////////////////////////////// //m_uiTask = TaskScheduler.FromCurrentSynchronizationContext(); Dictionary <int, ImageDisplay> idDictionary = ChartArray.GetImageDisplayDictionary(); m_displayPipeline = m_imager.CreateDisplayPipeline(m_uiTask, idDictionary); m_storagePipeline = m_imager.CreateImageStoragePipeline(GlobalVars.CompressionAlgorithm, m_iParams.imageWidth, m_iParams.imageHeight); if (ChartArray != null) { m_analysisPipeline = m_imager.CreateAnalysisPipeline(ChartArray, m_mask, m_iParams.imageWidth, m_iParams.imageHeight, m_iParams.HorzBinning, m_iParams.VertBinning, m_iParams.ExperimentIndicatorID, m_controlSubtractionWellList, m_numFoFrames, m_dynamicRatioNumerator.ExperimentIndicatorID, m_dynamicRatioDenominator.ExperimentIndicatorID); } if (m_histogram != null) { m_histogramPipeline = m_imager.CreateHistogramPipeline(m_uiTask, m_histogram); } ///////////////////////////////////////////////////////// // use reference images as simulated images from camera bool success = m_wgDB.GetAllReferenceImages(); m_simulationImageList = new List <ushort[]>(); foreach (ReferenceImageContainer image in m_wgDB.m_refImageList) { ushort[] img = new ushort[image.Width * image.Height]; Buffer.BlockCopy(image.ImageData, 0, img, 0, image.NumBytes); m_simulationImageList.Add(img); } m_simulationTimer = new DispatcherTimer(); m_simulationTimer.Tick += m_simulationTimer_Tick; m_simulationTimer.Interval = TimeSpan.FromMilliseconds(interval); m_simulationTime = 0; m_timerStartDateTime = DateTime.Now; m_simulationTimer.Start(); stopwatch.Stop(); PostMessage("startup time = " + stopwatch.ElapsedMilliseconds.ToString()); }
private void Image_Load_Click(object sender, EventArgs e) { bool success = wgDB.GetAllReferenceImages(); if (success) { ImageSelectDialog diag = new ImageSelectDialog(); foreach (ReferenceImageContainer refImage in wgDB.m_refImageList) { diag.AddImage(refImage.ImageData, refImage.Width, refImage.Height, refImage.Description, refImage.ReferenceImageID); } diag.ShowDialog(); if (diag.result) { LoadReferenceImage(diag.databaseID); } } }
public ImageFileViewer() { m_maxPixelValue = 65535; InitializeComponent(); m_vm = new ImageFileViewer_ViewModel(); DataContext = m_vm; m_lastErrorMsg = ""; m_db = new WaveguideDB(); m_imageTool = new ImageTool(); bool success = m_imageTool.Init(); m_rangeLower = 0; m_rangeUpper = m_maxPixelValue; m_rangeLower1 = 0; m_rangeUpper1 = m_maxPixelValue; m_rangeLower2 = 0; m_rangeUpper2 = m_maxPixelValue; byte[] red, green, blue; m_vm.colorModel.BuildColorMapForGPU(out red, out green, out blue, m_maxPixelValue); m_imageTool.Set_ColorMap(red, green, blue, m_maxPixelValue); // get the list of reference images from the database m_vm.refImages.Clear(); m_db.m_refImageList.Clear(); if (m_db.GetAllReferenceImages()) { foreach (ReferenceImageContainer ric in m_db.m_refImageList) { m_vm.refImages.Add(ric); } } #if (SIMULATE) GetUserList(); #else try { if (!GetUserList()) { System.Windows.MessageBox.Show("Failed to Get User List from Database!", "Database Error", MessageBoxButton.OK, MessageBoxImage.Error); } } catch (Exception ex) { MainTabControl.SelectedIndex = 1; System.Windows.MessageBox.Show("Failed to Get User List from Database!\n" + ex.Message, "Database Error", MessageBoxButton.OK, MessageBoxImage.Error); } #endif }