For example, use --haralick switch to compute Haralick features\n""")
sys.exit(1)
features = []
colnames = []
first = True
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 first:
colnames.extend(mh.features.texture.haralick_labels[:-1])
colnames.extend(["ptp:{}".format(ell) for ell in mh.features.texture.haralick_labels[:-1]])
features.append(np.concatenate(cur))
first = False
features = np.array(features)
try:
import pandas as pd
features = pd.DataFrame(features, index=args.fnames, columns=colnames)
features.to_csv(args.output, sep="\t")
except ImportError:
np.savetxt(args.output, features)