From a28c8209e5e02b4e07a64354619ead90133fae05 Mon Sep 17 00:00:00 2001 From: Leonid Kostrykin Date: Tue, 23 Apr 2024 11:49:56 +0200 Subject: [PATCH] Update `2d_filter_segmentation_by_features` tool --- .../2d_filter_segmentation_by_features.py | 7 ++++--- .../2d_filter_segmentation_by_features.xml | 10 +++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/tools/2d_filter_segmentation_by_features/2d_filter_segmentation_by_features.py b/tools/2d_filter_segmentation_by_features/2d_filter_segmentation_by_features.py index 924e69f6..9f750ec9 100644 --- a/tools/2d_filter_segmentation_by_features/2d_filter_segmentation_by_features.py +++ b/tools/2d_filter_segmentation_by_features/2d_filter_segmentation_by_features.py @@ -1,6 +1,7 @@ import argparse import sys +import giatools.io import pandas as pd import skimage.io import skimage.util @@ -14,14 +15,14 @@ parser.add_argument('rule_file', type=argparse.FileType('r'), default=sys.stdin, help='file with rules per feature (cols: ,f1,2, rows: feature_name, min, max)') args = parser.parse_args() - img_in = skimage.io.imread(args.input_file.name) + img_in = giatools.io.imread(args.input_file.name) features = pd.read_csv(args.feature_file, delimiter="\t") rules = pd.read_csv(args.rule_file, delimiter="\t") cols = [a for a in rules.columns if 'Unnamed' not in a] for a_c in cols: - a_min = rules[rules.ix[:, 0] == 'min'][a_c] - a_max = rules[rules.ix[:, 0] == 'max'][a_c] + a_min = rules[rules.iloc[:, 0] == 'min'][a_c] + a_max = rules[rules.iloc[:, 0] == 'max'][a_c] for a_l in features.label: a_val = float(features[features['label'] == a_l][a_c]) if a_val < float(a_min) or a_val > float(a_max): diff --git a/tools/2d_filter_segmentation_by_features/2d_filter_segmentation_by_features.xml b/tools/2d_filter_segmentation_by_features/2d_filter_segmentation_by_features.xml index 8e6c3d67..f68c75c0 100644 --- a/tools/2d_filter_segmentation_by_features/2d_filter_segmentation_by_features.xml +++ b/tools/2d_filter_segmentation_by_features/2d_filter_segmentation_by_features.xml @@ -1,4 +1,4 @@ - + creators.xml @@ -14,10 +14,10 @@ galaxy_image_analysis - scikit-image - pillow - pandas - tifffile + scikit-image + pandas + tifffile + giatools