code: def read_bw(fname, options):
      """Read image `fname` as greyscale
  
      Parameters
      ----------
      fname : str, file-name
      options : argparse result
  
      Returns
      -------
      image : ndarray
          Two dimensional ndarray
      """
      im = mh.imread(fname)
      if im.ndim == 2:
          return im
      if im.ndim == 3:
          if options.convert_to_bw == "max" or im.ptp(2).max() == 0:
              # This is a greyscale image, saved as colour
              return im.max(2)
          if options.convert_to_bw == "yes":
              return mh.colors.rgb2grey(im, dtype=np.uint8)
      print_error(
          "{} is not a greyscale image (and --convert-to-bw was not specified)".format(
              fname
          ),
          not options.no_color,
      )
      sys.exit(1)
  
file_path: mahotas/mahotas/features_cli.py
imports: import sys
  from os import path
  import numpy
  import mahotas
  import argparse
  from itertools import chain
label_desc: Use image node_id 2 for calling a global function with example usage: read_bw(fname, options) and returns: im, im, mh