示例#1
0
 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);
 }
示例#2
0
        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);
        }
示例#3
0
 public Colormap(IColormap colormap)
 {
     cmap = colormap ?? new Colormaps.Grayscale();
     Name = cmap.GetType().Name;
 }
示例#4
0
 public Colormap(IColormap colormap)
 {
     ThisColormap = colormap ?? ColormapFactory.GetDefaultColormap();
 }
示例#5
0
 public string ConvertModelToString(IColormap colormap) => $"{colormap.Id};";