docstr: Test conversion of 2D sparse with some more complex shapes to dense
  
  Make 10 circles that might overlap
docstr_tok: ["Test","conversion","of","2D","sparse","with","some","more","complex","shapes","to","dense","Make","10","circles","that","might","overlap"]
code: def test_02_05_random_sparse_to_2d_dense(self):
      """
      Test conversion of 2D sparse with some more complex shapes to dense
  
      Make 10 circles that might overlap
      """
      r = np.random.RandomState()
      r.seed(201)
      i, j = np.mgrid[0:50, 0:50]
      ii = []
      jj = []
      vv = []
      for idx in range(10):
          x_loc = r.uniform() * 30 + 10
          y_loc = r.uniform() * 30 + 10
          max_radius = np.min(
              [min(loc - 1, 49 - loc) for loc in (x_loc, y_loc)]
          )
          radius = r.uniform() * (max_radius - 5) + 5
          mask = ((i - y_loc) ** 2 + (j - x_loc) ** 2) <= radius**2
          ii.append(i[mask])
          jj.append(j[mask])
          vv.append(np.ones(np.sum(mask), np.uint32) * (idx + 1))
  
      sparse = np.core.records.fromarrays(
          [np.hstack(x) for x in (ii, jj, vv)],
          [
              (SPARSE_FIELD.y.value, np.uint32, 1),
              (SPARSE_FIELD.x.value, np.uint32, 1),
              (SPARSE_FIELD.label.value, np.uint32, 1),
          ],
      )
  
      dense_shape = (1, 1, 1, 50, 50)
      dense, indices = lib_seg.convert_sparse_to_dense(
          sparse, dense_shape=dense_shape
      )
      assert tuple(dense.shape[1:]) == dense_shape
      assert np.sum(dense > 0) == len(sparse)
  
      retrieval = dense[
          :,
          0,
          0,
          0,
          sparse[SPARSE_FIELD.y.value],
          sparse[SPARSE_FIELD.x.value],
      ]
      matches = retrieval == sparse[SPARSE_FIELD.label.value][None, :]
      assert np.all(np.sum(matches, 0) == 1)
  
imports: import numpy
  import centrosome.outline
  import cellprofiler_library.functions.segmentation
  from cellprofiler_library.functions.segmentation import SPARSE_FIELD
label_desc: Use image node_id 12 for calling the TestSegmentation obj's underlying member method code with example usage: obj.test_02_05_random_sparse_to_2d_dense() without return types