Skip to content

Commit

Permalink
Update 2d_filter_segmentation_by_features tool
Browse files Browse the repository at this point in the history
  • Loading branch information
kostrykin committed Apr 23, 2024
1 parent 8772c79 commit a28c820
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import argparse
import sys

import giatools.io
import pandas as pd
import skimage.io
import skimage.util
Expand All @@ -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):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<tool id="ip_2d_filter_segmentation_by_features" name="Filter label map by rules" version="0.0.1-3" profile="20.05">
<tool id="ip_2d_filter_segmentation_by_features" name="Filter label map by rules" version="0.0.1-4" profile="20.05">
<description></description>
<macros>
<import>creators.xml</import>
Expand All @@ -14,10 +14,10 @@
<xref type="bio.tools">galaxy_image_analysis</xref>
</xrefs>
<requirements>
<requirement type="package" version="0.14.2">scikit-image</requirement>
<requirement type="package" version="5.3.0">pillow</requirement>
<requirement type="package" version="0.23.4">pandas</requirement>
<requirement type="package" version="0.15.1">tifffile</requirement>
<requirement type="package" version="0.18.1">scikit-image</requirement>
<requirement type="package" version="2.2.2">pandas</requirement>
<requirement type="package" version="2020.10.1">tifffile</requirement>
<requirement type="package" version="0.1">giatools</requirement>
</requirements>
<command detect_errors="aggressive"><![CDATA[
Expand Down

0 comments on commit a28c820

Please sign in to comment.