renderer = ctx; RenderingStats performanceStats = renderer.getStats();
renderer = ctx; RenderingStats performanceStats = renderer.getStats(); Pixels metadata = renderer.getMetadata();    initAxesSize(planeDef, metadata); performanceStats.startMalloc(); RGBBuffer buf = new RGBBuffer(sizeX1, sizeX2); performanceStats.endMalloc();
    RGBBuffer render(Renderer ctx, PlaneDef planeDef)        throws IOException, QuantizationException    {        //Set the rendering context for the current invocation.        renderer = ctx;        RenderingStats performanceStats = renderer.getStats();                //Initialize sizeX1 and sizeX2 according to the plane.        initAxesSize(planeDef, renderer.getMetadata());        //Process each active wavelength.  If their number N > 1, then         //process N-1 async and one in the current thread.  If N = 1,         //just use the current thread.        RenderHSBWaveTask[] tasks = makeRndTasks(planeDef);        performanceStats.startRendering();        int n = tasks.length;        Future[] rndTskFutures = new Future[n];  //[0] unused.        //CmdProcessor processor = Env.getProcessor();        ExecutorService processor = Executors.newCachedThreadPool();//j.m                while (0 < --n)            rndTskFutures[n] = processor.submit(tasks[n]); //j.m exec(tasks[n]);        RGBBuffer rndDataBuf = null;        byte[] red = null, green = null, blue = null;        if (n == 0) {            rndDataBuf = (RGBBuffer) tasks[0].call();             red = rndDataBuf.getRedBand();            green = rndDataBuf.getGreenBand();            blue = rndDataBuf.getBlueBand();        }            //Wait for all forked tasks (if any) to complete.        //When a task completes, assemble its RGB buffer into rndDataBuf.        RGBBuffer taskBuffer;        int x1, x2, pix;        byte[] r, g, b;        for (n = 1; n < rndTskFutures.length; ++n) {            try {                taskBuffer = (RGBBuffer) rndTskFutures[n].get();//j.m getResult();                r = taskBuffer.getRedBand();                g = taskBuffer.getGreenBand();                b = taskBuffer.getBlueBand();                for (x2 = 0; x2 < sizeX2; ++x2) {                    for (x1 = 0; x1 < sizeX1; ++x1) {                        pix = sizeX1*x2+x1;                        red[pix] = (byte) (red[pix]+r[pix]);                        green[pix] = (byte) (green[pix]+g[pix]);                        blue[pix] = (byte) (blue[pix]+b[pix]);                    }                 }             } catch (Exception e) {                if (e instanceof QuantizationException)                    throw (QuantizationException) e;                throw (RuntimeException) e;                  //B/c call() only throws QuantizationException, it must be RE.            }        }        performanceStats.endRendering();                if (rndDataBuf == null)  //No active channel, return a black image.             return new RGBBuffer(sizeX1, sizeX2);                //Done.        return rndDataBuf;    }