code: def make_rectangular_grid(gridding):
      assert isinstance(gridding, cellprofiler_core.utilities.grid.Grid)
      i0 = gridding.y_location_of_lowest_y_spot
      j0 = gridding.x_location_of_lowest_x_spot
      di = gridding.y_spacing
      dj = gridding.x_spacing
      ni = gridding.rows
      nj = gridding.columns
      i, j = numpy.mgrid[
          0 : (i0 + di * (ni + 1)), 0 : (j0 + di * (nj + 1))
      ]
      i = numpy.round((i - i0).astype(float) / di).astype(int)
      j = numpy.round((j - j0).astype(float) / dj).astype(int)
      mask = (i >= 0) & (j >= 0) & (i < ni) & (j < nj)
      grid = numpy.zeros(
          (int(gridding.image_height), int(gridding.image_width)), int
      )
      g = grid[: i.shape[0], : i.shape[1]]
      g[mask[: g.shape[0], : g.shape[1]]] = gridding.spot_table[
          i[mask], j[mask]
      ]
      return grid
  
file_path: CellProfiler/tests/frontend/modules/test_identifyobjectsingrid.py
imports: import numpy
  import cellprofiler_core.utilities.grid
  import cellprofiler_core.image
  import cellprofiler_core.measurement
  import cellprofiler.modules.definegrid
  import cellprofiler.modules.identifyobjectsingrid
  import cellprofiler_core.object
  import cellprofiler_core.pipeline
  import cellprofiler_core.workspace
label_desc: Use image node_id 2 for calling a global function with example usage: make_rectangular_grid(gridding) and returns: grid