void ControlChart_MouseLeftButtonUp(object sender, MouseButtonEventArgs e) { m_isDragging = false; if (ImageDisplay.HasImage()) { ImageDisplay.SetColorMap(m_colorModel.m_colorMap); ImageDisplay.UpdateImage(); } }
public void SetImage(ushort[] image, int width, int height) { m_image = image; if (!ImageDisplay.IsReady()) { ImageDisplay.Init(width, height, m_colorModel.m_maxPixelValue, m_colorModel.m_colorMap); } ImageDisplay.DisplayImage(m_image); }
private void RangeMaxThumb_DragCompleted(object sender, System.Windows.Controls.Primitives.DragCompletedEventArgs e) { m_colorModel.m_controlPts[2].m_value = (int)RangeMaxThumb.Value; m_colorModel.m_controlPts[2].m_colorIndex = 1023; m_colorModel.BuildColorMap(); if (ImageDisplay.IsReady() && ImageDisplay.HasImage()) { ImageDisplay.SetColorMap(m_colorModel.m_colorMap); ImageDisplay.UpdateImage(); } }
private void RangeSlider_TrackFillDragCompleted(object sender, Infragistics.Controls.Editors.TrackFillChangedEventArgs <double> e) { m_colorModel.m_controlPts[1].m_value = (int)RangeMinThumb.Value; m_colorModel.m_controlPts[1].m_colorIndex = 0; m_colorModel.m_controlPts[2].m_value = (int)RangeMaxThumb.Value; m_colorModel.m_controlPts[2].m_colorIndex = 1023; m_colorModel.BuildColorMap(); WG_Color color = m_colorModel.m_colorMap[500]; if (ImageDisplay.IsReady() && ImageDisplay.HasImage()) { ImageDisplay.SetColorMap(m_colorModel.m_colorMap); ImageDisplay.UpdateImage(); } }
private void ColorModel_Load_Click(object sender, EventArgs e) { WaveguideDB wgDB = new WaveguideDB(); bool success = wgDB.GetAllColorModels(); if (success) { ColorModelSelectDialog diag = new ColorModelSelectDialog(wgDB.m_colorModelList); diag.ShowDialog(); int colorModelID = diag.dbID; for (int i = 0; i < wgDB.m_colorModelList.Count(); i++) { if (wgDB.m_colorModelList[i].ColorModelID == colorModelID) { ColorModel model = new ColorModel(wgDB.m_colorModelList[i].Description, wgDB.m_colorModelList[i].MaxPixelValue, wgDB.m_colorModelList[i].GradientSize); for (int j = 0; j < wgDB.m_colorModelList[i].Stops.Count(); j++) { model.InsertColorStop(wgDB.m_colorModelList[i].Stops[j].ColorIndex, wgDB.m_colorModelList[i].Stops[j].Red, wgDB.m_colorModelList[i].Stops[j].Green, wgDB.m_colorModelList[i].Stops[j].Blue); } model.BuildColorGradient(); model.BuildColorMap(); SetColorModel(model); DrawColorGradient(); DrawColorMap(); if (ImageDisplay.IsReady() && ImageDisplay.HasImage()) { ImageDisplay.SetColorMap(m_colorModel.m_colorMap); ImageDisplay.UpdateImage(); } } } } }
public void SetImage(ushort[] image, int width, int height) { m_image = image; if (!ImageDisplay.IsReady()) { ImageDisplay.Init(width, height, m_colorModel.m_maxPixelValue, m_colorModel.m_colorMap); } ImageDisplay.DisplayImage(m_image); if (m_imageHistogram.Count() < m_colorModel.m_maxPixelValue + 1) { m_imageHistogram.Clear(); for (int i = 0; i < m_colorModel.m_maxPixelValue + 1; i++) { m_imageHistogram.Add(new HistogramBar(i, 0)); } } BuildImageHistogram(); }
////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////// public async void StartVideo(ImagingParameters iParams) { if (m_imager == null) { return; } //m_uiTask = TaskScheduler.FromCurrentSynchronizationContext(); m_tokenSource = new CancellationTokenSource(); m_cancelToken = m_tokenSource.Token; Progress <int> progress = new Progress <int>(); progress.ProgressChanged += (sender1, num) => { VM.MessageText = num.ToString() + " images"; }; Dictionary <int, ImageDisplay> imageDisplayDictionary = ChartArray.GetImageDisplayDictionary(); foreach (KeyValuePair <int, ImageDisplay> entry in imageDisplayDictionary) { ImageDisplay imageDisplay = entry.Value; imageDisplay.SetImageSize(iParams.imageWidth, m_iParams.imageHeight, m_iParams.maxPixelValue); } Task ImagingTask = Task.Factory.StartNew(() => m_imager.StartImaging(m_iParams, Tuple.Create(m_mask, m_controlSubtractionWellList, m_numFoFrames, m_dynamicRatioNumerator.ExperimentIndicatorID, m_dynamicRatioDenominator.ExperimentIndicatorID), m_cancelToken, m_uiTask, progress, null, m_colorModel.m_colorMap, m_histogram, ChartArray), m_cancelToken); try { await ImagingTask; } catch (AggregateException aggEx) { StringBuilder sb = new StringBuilder(); sb.Append("Exception(s) occurred: "); foreach (Exception ex in aggEx.InnerExceptions) { sb.Append(ex.Message); sb.Append(", "); } MessageBoxResult result = MessageBox.Show(sb.ToString(), "Exception(s) Occurred", MessageBoxButton.OK, MessageBoxImage.Error); } catch (OperationCanceledException) { } catch (Exception ex) { MessageBoxResult result = MessageBox.Show(ex.Message, "Unknown Exception Occurred", MessageBoxButton.OK, MessageBoxImage.Error); } finally { ImagingTask.Dispose(); } }