@@ -0,0 +1,1414 @@
+package sc.iview;%0A%0Aimport org.scijava.command.CommandService;%0Aimport org.scijava.script.ScriptService;%0A%0Aimport java.io.BufferedWriter;%0Aimport java.io.File;%0Aimport java.io.FileWriter;%0Aimport java.util.HashMap;%0A%0Apublic class VolumeScriptTest %7B%0A%0A    static String script = %22# @SciView sv%5Cn%22 +%0A%22# @UIService ui%5Cn%5Cn%22 +%0A%22import net.imglib2.img.array.ArrayImgs as ArrayImgs%5Cn%22 +%0A%22w = 100%5Cn%22 +%0A%22h = w%5Cn%22 +%0A%22d = w%5Cn%22 +%0A%22img = ArrayImgs.unsignedBytes(w, h, d)%5Cn%22 +%0A%22img_ra = img.randomAccess()%5Cn%22 +%0A%22for x in range(0, w):%5Cn%22 +%0A%22  for y in range(0, h):%5Cn%22 +%0A%22    for z in range(0, d):%5Cn%22 +%0A%22      img_ra.setPosition(%5Bx, y, z%5D)%5Cn%22 +%0A%22      x0 = x - 50%5Cn%22 +%0A%22      y0 = y - 50%5Cn%22 +%0A%22      z0 = z - 50%5Cn%22 +%0A%22      val = 255 - (x0**2 + y0**2 + z0**2) ** 0.65%5Cn%22 +%0A%22      img_ra.get().setReal(val)%5Cn%22 +%0A%22ui.show(img)%5Cn%22 +%0A%22sv.addVolume(img)%5Cn%22;%0A%0A     public static void main(String... args) throws Exception %7B%0A         SciView sv = SciView.create();%0A%0A         ScriptService scriptService = sv.getScijavaContext().getService(ScriptService.class);%0A%0A         File file = File.createTempFile(%22sciview-script%22, %22.py%22);%0A         file.deleteOnExit();%0A%0A         BufferedWriter writer = new BufferedWriter(new FileWriter(file));%0A         writer.write(script);%0A         writer.close();%0A%0A         scriptService.run(file, true, new HashMap%3CString, Object%3E());%0A         scriptService.run(file, true, new HashMap%3CString, Object%3E());%0A%0A%0A    %7D%0A%0A%7D%0A

Add test for adding 2 volumes via script