docstr: Test converstion of sparse to 3D dense with overlapping labels
  
  dense output: label=2, c=1,t=1,z=3,y=3,x=2
  
         +------+  |     +------+
        / 1  1 /|  |    / 0  0 /|
       / 1  1 / +  |   / 2  2 / +
      +------+ /   |  +------+ / 
      | 1  1 |/    |  | 0  0 |/  
      +------+     |  +------+   
         +------+  |     +------+
        / 1  1 /|  |    / 0  0 /|
       / 1  1 / +  |   / 2  2 / +
      +------+ /   |  +------+ / 
      | 1  1 |/    |  | 0  0 |/  
      +------+     |  +------+   
         +------+  |     +------+
        / 0  0 /|  |    / 0  0 /|
       / 0  0 / +  |   / 2  2 / +
      +------+ /   |  +------+ / 
      | 0  0 |/    |  | 0  0 |/  
      +------+     |  +------+   
docstr_tok: ["Test","converstion","of","sparse","to","3D","dense","with","overlapping","labels","dense","output",":","label=2",",","c=1",",","t=1",",","z=3",",","y=3",",","x=2","+","--","--","--","+","|","+","--","--","--","+","\/","1","1","\/|","|","\/","0","0","\/|","\/","1","1","\/","+","|","\/","2","2","\/","+","+","--","--","--","+","\/","|","+","--","--","--","+","\/","|","1","1","|\/","|","|","0","0","|\/","+","--","--","--","+","|","+","--","--","--","+","+","--","--","--","+","|","+","--","--","--","+","\/","1","1","\/|","|","\/","0","0","\/|","\/","1","1","\/","+","|","\/","2","2","\/","+","+","--","--","--","+","\/","|","+","--","--","--","+","\/","|","1","1","|\/","|","|","0","0","|\/","+","--","--","--","+","|","+","--","--","--","+","+","--","--","--","+","|","+","--","--","--","+","\/","0","0","\/|","|","\/","0","0","\/|","\/","0","0","\/","+","|","\/","2","2","\/","+","+","--","--","--","+","\/","|","+","--","--","--","+","\/","|","0","0","|\/","|","|","0","0","|\/","+","--","--","--","+","|","+","--","--","--","+"]
code: def test_02_07_sparse_to_3d_dense_overlap(self):
      """
      Test converstion of sparse to 3D dense with overlapping labels
  
      dense output: label=2, c=1,t=1,z=3,y=3,x=2
  
             +------+  |     +------+
            / 1  1 /|  |    / 0  0 /|
           / 1  1 / +  |   / 2  2 / +
          +------+ /   |  +------+ /
          | 1  1 |/    |  | 0  0 |/
          +------+     |  +------+
             +------+  |     +------+
            / 1  1 /|  |    / 0  0 /|
           / 1  1 / +  |   / 2  2 / +
          +------+ /   |  +------+ /
          | 1  1 |/    |  | 0  0 |/
          +------+     |  +------+
             +------+  |     +------+
            / 0  0 /|  |    / 0  0 /|
           / 0  0 / +  |   / 2  2 / +
          +------+ /   |  +------+ /
          | 0  0 |/    |  | 0  0 |/
          +------+     |  +------+
      """
      sparse = np.array(
          [
              (0, 0, 0, 1),
              (0, 0, 1, 1),
              (0, 1, 0, 1),
              (0, 1, 1, 1),
              (1, 0, 0, 1),
              (1, 0, 1, 1),
              (1, 1, 0, 1),
              (1, 1, 1, 1),
              (2, 0, 0, 1),
              (2, 0, 1, 1),
              (2, 1, 0, 1),
              (2, 1, 1, 1),
              (1, 0, 0, 2),
              (1, 0, 1, 2),
              (1, 1, 0, 2),
              (1, 1, 1, 2),
              (1, 2, 0, 2),
              (1, 2, 1, 2),
          ],
          dtype=[
              (SPARSE_FIELD.z.value, "<u2"),
              (SPARSE_FIELD.y.value, "<u2"),
              (SPARSE_FIELD.x.value, "<u2"),
              (SPARSE_FIELD.label.value, "u1"),
          ],
      )
  
      dense_plain, dpi = lib_seg.convert_sparse_to_dense(sparse)
      dense_shaped, dsi = lib_seg.convert_sparse_to_dense(
          sparse, dense_shape=(1, 1, 3, 3, 2)
      )
  
      # + 1 padding
      dense_plain_expected = np.array(
          [
              1,
              1,
              0,
              1,
              1,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              1,
              1,
              0,
              1,
              1,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              1,
              1,
              0,
              1,
              1,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              2,
              2,
              0,
              2,
              2,
              0,
              2,
              2,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
          ],
          np.uint8,
      ).reshape((2, 1, 1, 4, 4, 3))
      dense_shaped_expected = np.array(
          [
              1,
              1,
              1,
              1,
              0,
              0,
              1,
              1,
              1,
              1,
              0,
              0,
              1,
              1,
              1,
              1,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              0,
              2,
              2,
              2,
              2,
              2,
              2,
              0,
              0,
              0,
              0,
              0,
              0,
          ],
          np.uint8,
      ).reshape((2, 1, 1, 3, 3, 2))
      indices_expected = [
          np.array([1], dtype=np.uint8),
          np.array([2], dtype=np.uint8),
      ]
  
      np.testing.assert_array_equal(dense_plain, dense_plain_expected)
      np.testing.assert_array_equal(dense_shaped, dense_shaped_expected)
      _check_indices(dpi, indices_expected)
      _check_indices(dsi, indices_expected)
  
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 14 for calling the TestSegmentation obj's underlying member method code with example usage: obj.test_02_07_sparse_to_3d_dense_overlap() without return types