code: def run(render, aggregate, params, metadata, layout):
      gfile.MakeDirs("{directory}".format(**params))
  
      layers = params["n_cells"]
      for n_layer in layers:
          params["n_layer"] = n_layer
          tiles = grid.grid(metadata, layout, params)
  
          # TODO: write out summary? might be useful for the client-side renderer
          summary = summarize(tiles, params, layout, metadata)
          print("summary", summary)
          etiles = grid.enumerate_tiles(tiles)
          for i, t in enumerate(etiles):
              ti = t[0]
              tj = t[1]
              tile = t[2]
              cells = grid.tile_cells(tile)
  
              print("aggregate tile", i + 1, "/", len(etiles))
              tile_json = render_tile.aggregate_tile(
                  cells,
                  ti,
                  tj,
                  aggregate,
                  params,
                  metadata,
                  layout,
                  summary,
              )
              filename = "{directory}/{name}-tile_{n_layer}_{n_tile}_{ti}_{tj}.json".format(
                  ti=ti, tj=tj, **params
              )
              print("saving", filename)
              with gfile.Open(filename, "w") as f:
                  json.dump(tile_json, f)
  
              print("render tile", i + 1, "/", len(etiles))
              tile_img = render_tile.render_tile(
                  cells,
                  ti,
                  tj,
                  render,
                  params,
                  metadata,
                  layout,
                  summary,
              )
              filename = "{directory}/{name}-tile_{n_layer}_{n_tile}_{ti}_{tj}.png".format(
                  ti=ti, tj=tj, **params
              )
              print("saving", filename)
              with gfile.Open(filename, "w") as f:
                  tile_img.save(f)
  
file_path: lucid/lucid/scratch/atlas_pipeline/pipeline.py
imports: from __future__ import absolute_import
  from __future__ import division
  from __future__ import print_function
  import json
  import numpy
  import lucid.scratch.atlas_pipeline.render_tile
  import lucid.scratch.atlas_pipeline.grid
  from tensorflow import gfile
label_desc: Use image node_id 1 for calling a global function with example usage: run(render, aggregate, params, metadata, layout) without return types