public void InitDefaultColorModel() { bool success = wgDB.GetAllColorModels(); if (success) { if (wgDB.m_colorModelList.Count() > 0) { ColorModelContainer model = wgDB.m_colorModelList[0]; ColorModel m_colorModel = new ColorModel(model.Description, model.MaxPixelValue, model.GradientSize); for (int i = 0; i < model.Stops.Count(); i++) { m_colorModel.InsertColorStop(model.Stops[i].ColorIndex, model.Stops[i].Red, model.Stops[i].Green, model.Stops[i].Blue); } m_colorModel.BuildColorGradient(); m_colorModel.BuildColorMap(); SetColorModel(m_colorModel); DrawColorGradient(); DrawColorMap(); } } }
public void LoadDefaultColorModel() { m_colorModel = null; bool success = m_wgDB.GetAllColorModels(); if (success) { foreach (ColorModelContainer cModel in m_wgDB.m_colorModelList) { if (cModel.IsDefault || m_colorModel == null) { m_colorModel = new ColorModel(cModel, GlobalVars.MaxPixelValue); } } } }
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(); } } } } }