code: def _binary_image(self, shape, xp=cupy, pct_true=50):
      # cupy and numpy random streams don't match so generate with CuPy only
      rng = cupy.random.default_rng(123)
      x = rng.integers(0, 100, size=shape, dtype=xp.uint8)
      img = x >= pct_true
      if xp == numpy:
          img = cupy.asnumpy(img)
      return img
  
imports: import copy
  import numpy
  import pytest
  import cupy
  from cupy import testing
  import cupyx.scipy.ndimage
label_desc: Use image node_id 1 for calling the TestDistanceTransform obj's underlying member method code with example usage: obj._binary_image(shape, xp, pct_true) and returns: img