From 090d266afc99031f5e2c7ddffeb6c17962dca8d0 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Wed, 1 Nov 2023 14:25:13 +0100 Subject: [PATCH] updates "Convert point coordinates to label map" tool --- tools/points2labelimage/points2label.py | 9 ++++++--- tools/points2labelimage/points2label.xml | 10 ++++++++-- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/tools/points2labelimage/points2label.py b/tools/points2labelimage/points2label.py index 9dbb540b..7f701377 100644 --- a/tools/points2labelimage/points2label.py +++ b/tools/points2labelimage/points2label.py @@ -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 @@ def points2label(labels, shape, output_file=None, has_header=False, is_TSV=True) 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 @@ def points2label(labels, shape, output_file=None, has_header=False, is_TSV=True) else: return labelimg + if __name__ == "__main__": parser = argparse.ArgumentParser() parser.add_argument('label_file', type=argparse.FileType('r'), default=sys.stdin, help='label file') diff --git a/tools/points2labelimage/points2label.xml b/tools/points2labelimage/points2label.xml index 6196b196..27e0ce39 100644 --- a/tools/points2labelimage/points2label.xml +++ b/tools/points2labelimage/points2label.xml @@ -1,5 +1,11 @@ - - Points to Label Image + + + + operation_3443 + + + galaxy_image_analysis + numpy scikit-image