async function draw_scan(z_arr, channels = [0, 1, 3]) {
const [r, g, b] = await Promise.all(
channels.map(c => z_arr.getRawChunk(chunkCoords(c)))
);
const rgba = new Uint8ClampedArray(4 * r.data.length).fill(0);
let offset = 0;
for (let i = 0; i < r.data.length; i++) {
rgba[offset] = r.data[i];
rgba[offset + 1] = g.data[i];
rgba[offset + 2] = b.data[i];
rgba[offset + 3] = 255;
offset += 4;
}
const [height, width] = z_arr.chunks.slice(-2);
const img = new ImageData(rgba, width, height);
const context = DOM.context2d(img.width / 2, img.height / 2, null);
context.putImageData(img, 0, 0);
return context.canvas;
}