/** * Write the current cell array to the given row of the image file. * * @param r Row index. */ private static void writeCurrentCell(int r) throws IOException { // Set image row's gray values based on current cell states. for (int i = 0; i < C; ++i) { imagerow.setPixel(i, currentCell[i].floatValue()); } // Set row r of the pixel matrix. pixelmatrix[r] = pixelrow; // Write row-r slice of the image to the image file. writer.writeRowSlice(new Range(r, r)); }