Mercurial > repos > imgteam > points2labelimage
diff points2label.py @ 2:30ca5d5d03ec draft default tip
planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/points2labelimage/ commit 2286a6c9da88596349ed9d967c51541409c0a7bf
author | imgteam |
---|---|
date | Mon, 13 Nov 2023 22:11:46 +0000 |
parents | 9bd039f46843 |
children |
line wrap: on
line diff
--- a/points2label.py Mon Jul 22 05:04:37 2019 -0400 +++ b/points2label.py Mon Nov 13 22:11:46 2023 +0000 @@ -1,9 +1,11 @@ import argparse import sys +import warnings + import numpy as np +import pandas as pd import skimage.io -import pandas as pd -import warnings + def points2label(labels, shape, output_file=None, has_header=False, is_TSV=True): labelimg = np.zeros([shape[0], shape[1]], dtype=np.int32) @@ -21,7 +23,7 @@ for i in range(0, len(df)): a_row = df.iloc[i] - labelimg[a_row[0], a_row[1]] = i+1 + labelimg[a_row[0], a_row[1]] = i + 1 if output_file is not None: with warnings.catch_warnings(): @@ -30,6 +32,7 @@ else: return labelimg + if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('label_file', type=argparse.FileType('r'), default=sys.stdin, help='label file')