code: def main():
      sys.stderr.write(mh.citation(print_out=False, short=True))
      sys.stderr.write("\n\n")
      parser = argparse.ArgumentParser(
          description="Compute features using mahotas"
      )
      parser.add_argument(
          "fnames",
          metavar="input_file_name",
          nargs="+",
          type=str,
          help="Image files names",
      )
      parser.add_argument(
          "--output",
          default="features.tsv",
          type=str,
          help="Output file for feature files",
      )
      parser.add_argument(
          "--clobber",
          default=False,
          action="store_true",
          help="Overwrite output file (if it exists)",
      )
      parser.add_argument(
          "--convert-to-bw",
          default="no",
          help="Convert color images to greyscale.\nAcceptable values:\n\tno: raises an error (default)"
          + "\n\tmax: use max projection"
          + "\n\tyes: use rgb2gray",
      )
      parser.add_argument(
          "--no-color",
          default=False,
          action="store_true",
          help="Do not print in color (for error and warning messages)",
      )
      parser.add_argument(
          "--haralick",
          default=False,
          action="store_true",
          help="Compute Haralick features",
      )
      parser.add_argument(
          "--lbp",
          default=False,
          action="store_true",
          help="Compute LBP (linear binary patterns) features",
      )
      parser.add_argument(
          "--lbp-radius",
          default=8,
          action="store",
          type=int,
          help="Radius to use for LBP features",
      )
      parser.add_argument(
          "--lbp-points",
          default=6,
          action="store",
          type=int,
          help="Nr of points to use for LBP features",
      )
      args = parser.parse_args()
      if not (args.haralick or args.lbp):
          sys.stderr.write(
              """\
  No features selected. Doing nothing.
  
  For example, use --haralick switch to compute Haralick features\n"""
          )
          sys.exit(1)
  
      if not args.clobber and path.exists(args.output):
          print_error(
              "Output file ({}) already exists. Refusing to overwrite results without --clobber argument.".format(
                  args.output
              )
          )
          sys.exit(2)
  
      output = open(args.output, "w")
      colnames = []
      if args.haralick:
          hlabels = mh.features.texture.haralick_labels[:-1]
          colnames.extend(["mean:{}".format(ell) for ell in hlabels])
          colnames.extend(["ptp:{}".format(ell) for ell in hlabels])
      if args.lbp:
          from mahotas.features.lbp import lbp_names
  
          colnames.extend(lbp_names(args.lbp_radius, args.lbp_points))
      _write_row(output, colnames)
  
      for fname in args.fnames:
          cur = []
          im = read_bw(fname, args)
          if args.haralick:
              har = mh.features.haralick(im, return_mean_ptp=True)
              cur.append(har)
          if args.lbp:
              cur.append(
                  mh.features.lbp(im, args.lbp_radius, args.lbp_points)
              )
  
          _write_row(output, chain.from_iterable(cur), fname)
      output.close()
  
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 4 for calling a global function with example usage: main() without return types