public static BitmapSource MakeGray16()
{
var width = 256;
var height = 256;
var bitmapSource = new WriteableBitmap(width, height, 96, 96, PixelFormats.Gray16, null);
var pixels = new ushort[width * height];
for (var y = 0; y < height; ++y)
for (var x = 0; x < width; ++x)
{
var v = x * y;
pixels[y * width + x] = (ushort)v;
}
bitmapSource.WritePixels(new Int32Rect(0, 0, width, height), pixels, width * 2, 0);
return bitmapSource;
}