public static byte[,] IntenstitiesToRGB(double[] intensities, IColormap cmap) { byte[,] output = new byte[intensities.Length, 3]; for (int i = 0; i < intensities.Length; i++) { double intensity = intensities[i] * 255; byte pixelIntensity = (byte)Math.Max(Math.Min(intensity, 255), 0); var(r, g, b) = cmap.GetRGB(pixelIntensity); output[i, 0] = r; output[i, 1] = g; output[i, 2] = b; } return(output); }
public Colormap(IColormap colormap) { cmap = colormap ?? new Colormaps.Grayscale(); Name = cmap.GetType().Name; IList <System.Windows.Media.Color> color_list = new List <System.Windows.Media.Color>(); for (int i = 0; i < 256; i++) { System.Drawing.Color c = GetColor((byte)i); System.Windows.Media.Color MediaColor = System.Windows.Media.Color.FromArgb(c.A, c.R, c.G, c.B); color_list.Add(MediaColor); } palette = new BitmapPalette(color_list); }
public Colormap(IColormap colormap) { cmap = colormap ?? new Colormaps.Grayscale(); Name = cmap.GetType().Name; }
public Colormap(IColormap colormap) { ThisColormap = colormap ?? ColormapFactory.GetDefaultColormap(); }
public string ConvertModelToString(IColormap colormap) => $"{colormap.Id};";