{
const width = dimensions[0];
const height = dimensions[1];
const ctx = DOM.context2d(width, height, 1);
const sliceIndex = dimensions[2] / 2;
let image = ctx.getImageData(0, 0, width, height);
for (let y = 0; y < height; y++) {
for (let x = 0; x < width; x++) {
let index = (width * height) * sliceIndex + width * y + x;
let value = data[index];
let i = (image.width * y + x) * 4;
image.data[i] = value;
image.data[i + 1] = value;
image.data[i + 2] = value;
image.data[i + 3] = 255;
}
}
ctx.putImageData(image, 0, 0);
yield ctx.canvas;
}