changeset 4:0a53256b48c6 draft

planemo upload for repository https://github.com/BMCV/galaxy-image-analysis/tree/master/tools/2d_feature_extraction/ commit 6b687746bdb3d5d1fb11ecffd6dd1bf42dc2c38d
author imgteam
date Fri, 10 Nov 2023 14:23:12 +0000
parents 5791a7f65275
children 2436a8807ad1
files 2d_feature_extraction.py 2d_feature_extraction.xml
diffstat 2 files changed, 21 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/2d_feature_extraction.py	Wed Dec 18 05:00:56 2019 -0500
+++ b/2d_feature_extraction.py	Fri Nov 10 14:23:12 2023 +0000
@@ -1,17 +1,18 @@
 import argparse
+
 import numpy as np
 import pandas as pd
+import skimage.feature
 import skimage.io
 import skimage.measure
-import skimage.feature
+import skimage.morphology
 import skimage.segmentation
-import skimage.morphology
 
-#TODO make importable by python script
+# TODO make importable by python script
 
 parser = argparse.ArgumentParser(description='Extract Features 2D')
 
-#TODO create factory for boilerplate code
+# TODO create factory for boilerplate code
 features = parser.add_argument_group('compute features')
 features.add_argument('--all', dest='all_features', action='store_true')
 features.add_argument('--label', dest='add_label', action='store_true')
@@ -19,7 +20,7 @@
 features.add_argument('--max_intensity', dest='max_intensity', action='store_true')
 features.add_argument('--mean_intensity', dest='mean_intensity', action='store_true')
 features.add_argument('--min_intensity', dest='min_intensity', action='store_true')
-features.add_argument('--moments_hu', dest='moments_hu', action='store_true') 
+features.add_argument('--moments_hu', dest='moments_hu', action='store_true')
 features.add_argument('--centroid', dest='centroid', action='store_true')
 features.add_argument('--bbox', dest='bbox', action='store_true')
 features.add_argument('--area', dest='area', action='store_true')
@@ -41,13 +42,13 @@
 parser.add_argument('--label_file_binary', dest='label_file_binary', action='store_true')
 
 parser.add_argument('--raw', dest='raw_file', type=argparse.FileType('r'),
-                   help='Original input file', required=False)
+                    help='Original input file', required=False)
 parser.add_argument('label_file', type=argparse.FileType('r'),
-                   help='Label input file')
+                    help='Label input file')
 parser.add_argument('output_file', type=argparse.FileType('w'),
-                   help='Tabular output file')
+                    help='Tabular output file')
 args = parser.parse_args()
- 
+
 label_file_binary = args.label_file_binary
 label_file = args.label_file.name
 out_file = args.output_file.name
@@ -70,7 +71,7 @@
     df['image'] = df['it'].map(lambda ait: regions[ait].image.astype(np.float).tolist())
     df['intensity_image'] = df['it'].map(lambda ait: regions[ait].intensity_image.astype(np.float).tolist())
 
-#TODO no matrix features, but split in own rows?
+# TODO no matrix features, but split in own rows?
 if args.add_label or args.all_features:
     df['label'] = df['it'].map(lambda ait: regions[ait].label)
 
@@ -119,7 +120,7 @@
 if args.convexity or args.all_features:
     perimeter = df['it'].map(lambda ait: regions[ait].perimeter)
     area = df['it'].map(lambda ait: regions[ait].area)
-    df['convexity'] = area/(perimeter*perimeter)
+    df['convexity'] = area / (perimeter * perimeter)
 
 del df['it']
 df.to_csv(out_file, sep='\t', line_terminator='\n', index=False)
--- a/2d_feature_extraction.xml	Wed Dec 18 05:00:56 2019 -0500
+++ b/2d_feature_extraction.xml	Fri Nov 10 14:23:12 2023 +0000
@@ -1,5 +1,12 @@
-<tool id="ip_2d_feature_extraction" name="2D Feature Extraction" version="0.1.1">
-    <description>Feature Extraction</description>
+<tool id="ip_2d_feature_extraction" name="Extract 2D features" version="0.1.1-2">
+    <description>with scikit-image</description>
+    <edam_operations>
+        <edam_operation>operation_3443</edam_operation>
+    </edam_operations>
+    <xrefs>
+        <xref type="bio.tools">scikit-image</xref>
+        <xref type="biii">scikit-image</xref>
+    </xrefs>
     <requirements> 
         <requirement type="package" version="0.23.4">pandas</requirement>
         <requirement type="package" version="0.14.2">scikit-image</requirement>