docs: def frombinary(path, shape=None, dtype=None, ext='bin', start=None, stop=None, recursive=False, nplanes=None, npartitions=None, labels=None, conf='conf.json', order='C', engine=None, credentials=None):
      """
      Load images from flat binary files.
  
      Assumes one image per file, each with the shape and ordering as given
      by the input arguments.
  
      Parameters
      ----------
      path : str
          Path to data files or directory, specified as either a local filesystem path
          or in a URI-like format, including scheme. May include a single '*' wildcard character.
  
      shape : tuple of positive int
          Dimensions of input image data.
  
      ext : string, optional, default = 'bin'
          Extension required on data files to be loaded.
  
      start, stop : nonnegative int, optional, default = None
          Indices of the first and last-plus-one file to load, relative to the sorted
          filenames matching `path` and `ext`. Interpreted using python slice indexing conventions.
  
      recursive : boolean, optional, default = False
          If true, will recursively descend directories from path, loading all files
          with an extension matching 'ext'.
  
      nplanes : positive integer, optional, default = None
          If passed, will cause single files to be subdivided into nplanes separate images.
          Otherwise, each file is taken to represent one image.
  
      npartitions : int, optional, default = None
          Number of partitions for computational engine,
          if None will use default for engine.
  
      labels : array, optional, default = None
          Labels for records. If provided, should be one-dimensional.
      """
      import json
      from thunder.readers import get_file_reader, FileNotFoundError
      try:
          reader = get_file_reader(path)(credentials=credentials)
          buf = reader.read(path, filename=conf).decode('utf-8')
          params = json.loads(buf)
      except FileNotFoundError:
          params = {}
  
      if 'dtype' in params.keys():
          dtype = params['dtype']
      if 'dims' in params.keys():
          shape = params['dims']
      if 'shape' in params.keys():
          shape = params['shape']
  
      if not shape:
          raise ValueError('Image shape must be specified as argument or in a conf.json file')
  
      if not dtype:
          dtype = 'int16'
  
      if nplanes is not None:
          if nplanes <= 0:
              raise ValueError('nplanes must be positive if passed, got %d' % nplanes)
          if shape[-1] % nplanes:
              raise ValueError("Last dimension '%d' must be divisible by nplanes '%d'" %
                               (shape[-1], nplanes))
  
      def getarray(idx_buffer_filename):
          idx, buf, _ = idx_buffer_filename
          ary = frombuffer(buf, dtype=dtype, count=int(prod(shape))).reshape(shape, order=order)
          if nplanes is None:
              yield (idx,), ary
          else:
              # divide array into chunks of nplanes
              npoints = shape[-1] / nplanes  # integer division
              if shape[-1] % nplanes:
                  npoints += 1
              timepoint = 0
              last_plane = 0
              current_plane = 1
              while current_plane < ary.shape[-1]:
                  if current_plane % nplanes == 0:
                      slices = [slice(None)] * (ary.ndim - 1) + [slice(last_plane, current_plane)]
                      yield idx*npoints + timepoint, ary[slices].squeeze()
                      timepoint += 1
                      last_plane = current_plane
                  current_plane += 1
              # yield remaining planes
              slices = [slice(None)] * (ary.ndim - 1) + [slice(last_plane, ary.shape[-1])]
              yield (idx*npoints + timepoint,), ary[slices].squeeze()
  
      recount = False if nplanes is None else True
      append = [nplanes] if (nplanes is not None and nplanes > 1) else []
      newdims = tuple(list(shape[:-1]) + append) if nplanes else shape
      return frompath(path, accessor=getarray, ext=ext, start=start,
                      stop=stop, recursive=recursive, npartitions=npartitions,
                      dims=newdims, dtype=dtype, labels=labels, recount=recount,
                      engine=engine, credentials=credentials)